Class: Fluent::Plugin::RedisEnrichmentFilter::Cache::LazyCache
- Defined in:
- lib/fluent/plugin/filter_redis_enrichment.rb
Instance Attribute Summary
Attributes inherited from NoCache
Instance Method Summary collapse
- #cache ⇒ Object
- #get(key) ⇒ Object
-
#initialize(redis:, size: DEFAULT_CACHE_SIZE, ttl: DEFAULT_CACHE_TTL, log: nil) ⇒ LazyCache
constructor
A new instance of LazyCache.
Methods inherited from NoCache
Constructor Details
#initialize(redis:, size: DEFAULT_CACHE_SIZE, ttl: DEFAULT_CACHE_TTL, log: nil) ⇒ LazyCache
Returns a new instance of LazyCache.
209 210 211 |
# File 'lib/fluent/plugin/filter_redis_enrichment.rb', line 209 def initialize(redis:, size: DEFAULT_CACHE_SIZE, ttl: DEFAULT_CACHE_TTL, log: nil) super end |
Instance Method Details
#cache ⇒ Object
217 218 219 |
# File 'lib/fluent/plugin/filter_redis_enrichment.rb', line 217 def cache @cache ||= LruRedux::TTL::ThreadSafeCache.new(@size, @ttl) end |
#get(key) ⇒ Object
213 214 215 |
# File 'lib/fluent/plugin/filter_redis_enrichment.rb', line 213 def get(key) cache.getset(key) { @redis.get(key) } end |