Class: LogStash::Codecs::Netflow::TemplateRegistry
- Inherits:
-
Object
- Object
- LogStash::Codecs::Netflow::TemplateRegistry
- Defined in:
- lib/logstash/codecs/netflow.rb
Instance Method Summary collapse
-
#fetch(key) ⇒ BinData::Struct
Fetch a Template by name.
-
#initialize(logger, ttl, file_path = nil) ⇒ TemplateRegistry
constructor
A new instance of TemplateRegistry.
-
#persist ⇒ Object
Force persist, potentially cleaning up elements from the file-based cache that have already been evicted from the memory-based cache.
-
#register(key, field_tuples) {|| ... } ⇒ BinData::Struct
Register a Template by name using an array of type/name tuples.
Constructor Details
#initialize(logger, ttl, file_path = nil) ⇒ TemplateRegistry
Returns a new instance of TemplateRegistry.
539 540 541 542 543 544 545 546 547 548 549 550 |
# File 'lib/logstash/codecs/netflow.rb', line 539 def initialize(logger, ttl, file_path=nil) @logger = logger @ttl = Integer(ttl) @file_path = file_path @mutex = Mutex.new @bindata_struct_cache = Vash.new @bindata_spec_cache = Vash.new do_load unless file_path.nil? end |
Instance Method Details
#fetch(key) ⇒ BinData::Struct
Fetch a Template by name
580 581 582 583 584 |
# File 'lib/logstash/codecs/netflow.rb', line 580 def fetch(key) @mutex.synchronize do do_fetch(key) end end |
#persist ⇒ Object
Force persist, potentially cleaning up elements from the file-based cache that have already been evicted from the memory-based cache
589 590 591 592 593 |
# File 'lib/logstash/codecs/netflow.rb', line 589 def persist() @mutex.synchronize do do_persist end end |
#register(key, field_tuples) {|| ... } ⇒ BinData::Struct
Register a Template by name using an array of type/name tuples.
If a block is given, the template is yielded to the block before being saved in the cache.
567 568 569 570 571 |
# File 'lib/logstash/codecs/netflow.rb', line 567 def register(key, field_tuples, &block) @mutex.synchronize do do_register(key, field_tuples, &block) end end |