Method: Redis::Commands::Strings#getex
- Defined in:
- lib/redis/commands/strings.rb
#getex(key, ex: nil, px: nil, exat: nil, pxat: nil, persist: false) ⇒ String
Get the value of key and optionally set its expiration. GETEX is similar to GET, but is a write command with additional options. When no options are provided, GETEX behaves like GET.
293 294 295 296 297 298 299 300 301 302 |
# File 'lib/redis/commands/strings.rb', line 293 def getex(key, ex: nil, px: nil, exat: nil, pxat: nil, persist: false) args = [:getex, key] args << "EX" << Integer(ex) if ex args << "PX" << Integer(px) if px args << "EXAT" << Integer(exat) if exat args << "PXAT" << Integer(pxat) if pxat args << "PERSIST" if persist send_command(args) end |