GETEX

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Get the value and set expire time

GETEX gets the value and can also set or remove expire time. The options are as follows.

  • EX: Set expire time in seconds.
  • PX: Set expire time in milliseconds.
  • EXAT: Set expire time as timestamp-seconds.
  • PXAT: Set expire time as timestamp-milliseconds.
  • PERSIST: Remove expire time.

Example

Command>getex key ex 10
Result>value
Command>get key after 10 seconds
Result>(nil)


Syntax

GETEX key [EX seconds|PX milliseconds|EXAT timestamp|PXAT milliseconds-timestamp|PERSIST]

  • Available since version 6.2.0.
  • Time complexity is O(1).
Related commands GET

<< GET GETEX GETDEL >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.