Class: Dbviewer::Cache::Base
- Inherits:
-
Object
- Object
- Dbviewer::Cache::Base
- Defined in:
- lib/dbviewer/cache/base.rb
Overview
Base handles caching concerns for the DatabaseManager It provides an abstraction layer for managing caches efficiently
Direct Known Subclasses
Instance Method Summary collapse
-
#delete(key) ⇒ Object?
Delete a specific cache entry by key.
-
#fetch(key, options = {}) { ... } ⇒ Object
Fetch data from cache or execute block if not found/expired.
-
#initialize(cache_expiry = 300) ⇒ Base
constructor
Initialize the cache manager.
Constructor Details
#initialize(cache_expiry = 300) ⇒ Base
Initialize the cache manager
8 9 10 11 12 |
# File 'lib/dbviewer/cache/base.rb', line 8 def initialize(cache_expiry = 300) @cache_expiry = cache_expiry @unified_cache = {} @cache_last_reset = Time.now end |
Instance Method Details
#delete(key) ⇒ Object?
Delete a specific cache entry by key
27 28 29 |
# File 'lib/dbviewer/cache/base.rb', line 27 def delete(key) raise NotImplementedError, "#{self.class}#delete must be implemented by a subclass" end |
#fetch(key, options = {}) { ... } ⇒ Object
Fetch data from cache or execute block if not found/expired
20 21 22 |
# File 'lib/dbviewer/cache/base.rb', line 20 def fetch(key, = {}, &block) raise NotImplementedError, "#{self.class}#fetch must be implemented by a subclass" end |