Sha256: 73bb05aadf3ffe732882ee76657167d748ddcffb7e09abd4533d23624eda0663
Contents?: true
Size: 896 Bytes
Versions: 4
Compression:
Stored size: 896 Bytes
Contents
class Redis class Store < self module Ttl def set(key, value, options = nil) if ttl = expires_in(options) setex(key, ttl.to_i, value, :raw => true) else super(key, value, options) end end def setnx(key, value, options = nil) if ttl = expires_in(options) setnx_with_expire(key, value, ttl.to_i) else super(key, value) end end protected def setnx_with_expire(key, value, ttl) multi do setnx(key, value, :raw => true) expire(key, ttl) end end private def expires_in(options) if options # Rack::Session Merb Rails/Sinatra options[:expire_after] || options[:expires_in] || options[:expire_in] end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
redis-store-1.4.0 | lib/redis/store/ttl.rb |
redis-store-1.3.0 | lib/redis/store/ttl.rb |
redis-store-1.2.0 | lib/redis/store/ttl.rb |
redis-store-1.2.0.pre | lib/redis/store/ttl.rb |