Module: Sequel::Plugins::Caching::ClassMethods
- Defined in:
- lib/sequel/plugins/caching.rb
Instance Attribute Summary collapse
-
#cache_ignore_exceptions ⇒ Object
readonly
If true, ignores exceptions when gettings cached records (the memcached API).
-
#cache_store ⇒ Object
readonly
The cache store object for the model, which should implement the Ruby-Memcache (or memcached) API.
-
#cache_ttl ⇒ Object
readonly
The time to live for the cache store, in seconds.
Instance Method Summary collapse
-
#inherited(subclass) ⇒ Object
Copy the necessary class instance variables 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_ignore_exceptions ⇒ Object (readonly)
If true, ignores exceptions when gettings cached records (the memcached API).
36 37 38 |
# File 'lib/sequel/plugins/caching.rb', line 36 def cache_ignore_exceptions @cache_ignore_exceptions end |
#cache_store ⇒ Object (readonly)
The cache store object for the model, which should implement the Ruby-Memcache (or memcached) API
40 41 42 |
# File 'lib/sequel/plugins/caching.rb', line 40 def cache_store @cache_store end |
#cache_ttl ⇒ Object (readonly)
The time to live for the cache store, in seconds.
43 44 45 |
# File 'lib/sequel/plugins/caching.rb', line 43 def cache_ttl @cache_ttl end |
Instance Method Details
#inherited(subclass) ⇒ Object
Copy the necessary class instance variables to the subclass.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/sequel/plugins/caching.rb', line 51 def inherited(subclass) super store = @cache_store ttl = @cache_ttl cache_ignore_exceptions = @cache_ignore_exceptions subclass.instance_eval do @cache_store = store @cache_ttl = ttl @cache_ignore_exceptions = cache_ignore_exceptions end end |
#set_cache_ttl(ttl) ⇒ Object
Set the time to live for the cache store, in seconds (default is 3600, # so 1 hour).
46 47 48 |
# File 'lib/sequel/plugins/caching.rb', line 46 def set_cache_ttl(ttl) @cache_ttl = ttl end |