Module: Redis::Store::Ttl

Included in:
Redis::Store
Defined in:
lib/redis/store/ttl.rb

Instance Method Summary collapse

Instance Method Details

#set(key, value, options = nil) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/redis/store/ttl.rb', line 4

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

#setnx(key, value, options = nil) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/redis/store/ttl.rb', line 12

def setnx(key, value, options = nil)
  if ttl = expires_in(options)
    setnx_with_expire(key, value, ttl.to_i, options)
  else
    super(key, value)
  end
end