Module Sequel::Plugins::Caching::ClassMethods
In: lib/sequel/plugins/caching.rb

Methods

Attributes

cache_ignore_exceptions  [R]  If true, ignores exceptions when gettings cached records (the memcached API).
cache_store  [R]  The cache store object for the model, which should implement the Ruby-Memcache (or memcached) API
cache_ttl  [R]  The time to live for the cache store, in seconds.

Public Instance methods

Delete the cached object with the given primary key.

[Source]

    # File lib/sequel/plugins/caching.rb, line 59
59:         def cache_delete_pk(pk)
60:           cache_delete(cache_key(pk))
61:         end

Return the cached object with the given primary key, or nil if no such object is in the cache.

[Source]

    # File lib/sequel/plugins/caching.rb, line 65
65:         def cache_get_pk(pk)
66:           cache_get(cache_key(pk))
67:         end

Return a key string for the given primary key.

[Source]

    # File lib/sequel/plugins/caching.rb, line 75
75:         def cache_key(pk)
76:           raise(Error, 'no primary key for this record') unless pk.is_a?(Array) ? pk.all? : pk
77:           "#{cache_key_prefix}:#{Array(pk).join(',')}"
78:         end

Returns the prefix used to namespace this class in the cache.

[Source]

    # File lib/sequel/plugins/caching.rb, line 70
70:         def cache_key_prefix
71:           "#{self}"
72:         end

Set the time to live for the cache store, in seconds (default is 3600, # so 1 hour).

[Source]

    # File lib/sequel/plugins/caching.rb, line 83
83:         def set_cache_ttl(ttl)
84:           @cache_ttl = ttl
85:         end

[Validate]