Method: Xunch::RedisClient#set

Defined in:
lib/xunch/shard/redis.rb

#set(key, value, ttl) ⇒ Object

set key value with expire time in second

Parameters:

  • key (String)
  • value (String)
  • ttl (Fixnum)

    time to live



91
92
93
94
95
96
97
98
99
# File 'lib/xunch/shard/redis.rb', line 91

def set(key, value, ttl)
  with do | redis |
    if(ttl > 0)
      redis.setex(key,ttl,value)
    else
      redis.set(key,value)
    end
  end
end