Module: Sequel::Plugins::Caching::ClassMethods
- Defined in:
- lib/sequel/plugins/caching.rb
Instance Attribute Summary collapse
-
#cache_store ⇒ Object
readonly
The cache store object for the model, which should implement the Ruby-Memcache API.
-
#cache_ttl ⇒ Object
readonly
The time to live for the cache store, in seconds.
Instance Method Summary collapse
-
#inherited(subclass) ⇒ Object
Copy the cache_store and cache_ttl to the subclass.
-
#set_cache_ttl(ttl) ⇒ Object
Set the time to live for the cache store, in seconds (default is 3600, # so 1 hour).
Instance Attribute Details
#cache_store ⇒ Object (readonly)
The cache store object for the model, which should implement the Ruby-Memcache API
31 32 33 |
# File 'lib/sequel/plugins/caching.rb', line 31 def cache_store @cache_store end |
#cache_ttl ⇒ Object (readonly)
The time to live for the cache store, in seconds.
34 35 36 |
# File 'lib/sequel/plugins/caching.rb', line 34 def cache_ttl @cache_ttl end |
Instance Method Details
#inherited(subclass) ⇒ Object
Copy the cache_store and cache_ttl to the subclass.
42 43 44 45 46 47 48 49 50 |
# File 'lib/sequel/plugins/caching.rb', line 42 def inherited(subclass) super store = @cache_store ttl = @cache_ttl subclass.instance_eval do @cache_store = store @cache_ttl = ttl end end |
#set_cache_ttl(ttl) ⇒ Object
Set the time to live for the cache store, in seconds (default is 3600, # so 1 hour).
37 38 39 |
# File 'lib/sequel/plugins/caching.rb', line 37 def set_cache_ttl(ttl) @cache_ttl = ttl end |