Module: RedisKit::Cache::Helper::ClassMethods
- Defined in:
- lib/redis-kit/cache/helper.rb
Instance Method Summary collapse
- #cache_namespace(value = nil) ⇒ Object
- #cache_timeout(value = nil) ⇒ Object
- #cached(key, timeout = nil, &block) ⇒ Object
- #expire(key) ⇒ Object
Instance Method Details
#cache_namespace(value = nil) ⇒ Object
9 10 11 12 |
# File 'lib/redis-kit/cache/helper.rb', line 9 def cache_namespace( value = nil ) @cache_namespace = value.to_s unless value == nil @cache_namespace || "" end |
#cache_timeout(value = nil) ⇒ Object
14 15 16 17 |
# File 'lib/redis-kit/cache/helper.rb', line 14 def cache_timeout( value = nil ) @cache_timeout = value if value @cache_timeout || 60 end |
#cached(key, timeout = nil, &block) ⇒ Object
19 20 21 22 |
# File 'lib/redis-kit/cache/helper.rb', line 19 def cached( key, timeout = nil, &block ) timeout ||= cache_timeout RedisKit::Cache.get with_namespace( key ), timeout, &block end |
#expire(key) ⇒ Object
24 25 26 |
# File 'lib/redis-kit/cache/helper.rb', line 24 def expire( key ) RedisKit::Cache.expire with_namespace( key ) end |