Module: SimpleRedisCache
- Extended by:
- SimpleRedisCache
- Included in:
- SimpleRedisCache
- Defined in:
- lib/simple_redis_cache.rb,
lib/simple_redis_cache/version.rb
Defined Under Namespace
Modules: Config
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
Instance Method Details
#cache(key, opts = {}, &block) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/simple_redis_cache.rb', line 12 def cache(key, opts={}, &block) unless (value = redis[key]) value = redis[key] = block.call redis.expire(key, opts[:ttl]) if opts[:ttl] end value end |