1234567891011121314151617181920212223242526272829 |
- # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
- module EventBuffer
- def self.list(key)
- if !Thread.current[:event_buffer]
- Thread.current[:event_buffer] = {}
- end
- Thread.current[:event_buffer][key] || []
- end
- def self.add(key, item)
- if !Thread.current[:event_buffer]
- Thread.current[:event_buffer] = {}
- end
- if !Thread.current[:event_buffer][key]
- Thread.current[:event_buffer][key] = []
- end
- Thread.current[:event_buffer][key].push item
- end
- def self.reset(key)
- return if !Thread.current[:event_buffer]
- return if !Thread.current[:event_buffer][key]
- Thread.current[:event_buffer][key] = []
- end
- end
|