Class: LogStash::PluginMixins::JdbcStreaming::StatementHandler
- Inherits:
-
Object
- Object
- LogStash::PluginMixins::JdbcStreaming::StatementHandler
- Defined in:
- lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb
Overview
so as to not clash with the class of the same name and function in the jdbc input
this is in the module JdbcStreaming namespace
this duplication can be removed in a universal plugin
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#statement ⇒ Object
readonly
Returns the value of attribute statement.
Class Method Summary collapse
Instance Method Summary collapse
-
#cache_lookup(db, event) ⇒ Object
Get from cache or performs remote lookup and saves to cache.
-
#initialize(plugin) ⇒ StatementHandler
constructor
A new instance of StatementHandler.
Methods included from LogStash::PluginMixins::Jdbc::ValueHandler
#decorate_value, #extract_values_from
Constructor Details
#initialize(plugin) ⇒ StatementHandler
Returns a new instance of StatementHandler.
20 21 22 23 24 25 |
# File 'lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb', line 20 def initialize(plugin) @statement = plugin.statement klass = plugin.use_cache ? RowCache : NoCache @cache = klass.new(plugin.cache_size, plugin.cache_expiration) post_init(plugin) end |
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
18 19 20 |
# File 'lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb', line 18 def cache @cache end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
18 19 20 |
# File 'lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb', line 18 def parameters @parameters end |
#statement ⇒ Object (readonly)
Returns the value of attribute statement.
18 19 20 |
# File 'lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb', line 18 def statement @statement end |
Class Method Details
.build_statement_handler(plugin) ⇒ Object
13 14 15 16 |
# File 'lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb', line 13 def self.build_statement_handler(plugin) klass = plugin.use_prepared_statements ? PreparedStatementHandler : NormalStatementHandler klass.new(plugin) end |
Instance Method Details
#cache_lookup(db, event) ⇒ Object
Get from cache or performs remote lookup and saves to cache
31 32 33 |
# File 'lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb', line 31 def cache_lookup(db, event) # override in subclass end |