Class: RecordCache::Strategy::FullTableCache
- Defined in:
- lib/record_cache/strategy/full_table_cache.rb
Constant Summary collapse
- FULL_TABLE =
'full-table'
Class Method Summary collapse
-
.parse(base, record_store, options) ⇒ Object
parse the options and return (an array of) instances of this strategy.
Instance Method Summary collapse
-
#cacheable?(query) ⇒ Boolean
Can the cache retrieve the records based on this query?.
-
#record_change(record, action) ⇒ Object
Clear the cache on any record change.
Methods inherited from Base
#attribute, #fetch, #initialize, #invalidate
Constructor Details
This class inherits a constructor from RecordCache::Strategy::Base
Class Method Details
.parse(base, record_store, options) ⇒ Object
parse the options and return (an array of) instances of this strategy
7 8 9 10 11 12 |
# File 'lib/record_cache/strategy/full_table_cache.rb', line 7 def self.parse(base, record_store, ) return nil unless [:full_table] return nil unless base.table_exists? FullTableCache.new(base, :full_table, record_store, ) end |
Instance Method Details
#cacheable?(query) ⇒ Boolean
Can the cache retrieve the records based on this query?
15 16 17 |
# File 'lib/record_cache/strategy/full_table_cache.rb', line 15 def cacheable?(query) true end |
#record_change(record, action) ⇒ Object
Clear the cache on any record change
20 21 22 |
# File 'lib/record_cache/strategy/full_table_cache.rb', line 20 def record_change(record, action) version_store.delete(cache_key(FULL_TABLE)) end |