[フレーム]
Docs Pricing
Login Book a meeting Try Redis

PEXPIRE

Syntax
PEXPIRE key milliseconds [NX | XX | GT | LT]
Available since:
Redis Open Source 2.6.0
Time complexity:
O(1)
ACL categories:
@keyspace, @write, @fast,
Compatibility:
Redis Enterprise and Redis Cloud compatibility

This command works exactly like EXPIRE but the time to live of the key is specified in milliseconds instead of seconds.

Options

The PEXPIRE command supports a set of options since Redis 7.0:

A non-volatile key is treated as an infinite TTL for the purpose of GT and LT. The GT, LT and NX options are mutually exclusive.

Examples

SET mykey "Hello" PEXPIRE mykey 1500 TTL mykey PTTL mykey PEXPIRE mykey 1000 XX TTL mykey PEXPIRE mykey 1000 NX TTL mykey

Redis Enterprise and Redis Cloud compatibility

Redis
Enterprise
Redis
Cloud
Notes
✅ Standard
✅ Active-Active
✅ Standard
✅ Active-Active

Return information

One of the following:

  • Integer reply: 0 if the timeout was not set. For example, if the key doesn't exist, or the operation skipped because of the provided arguments.
  • Integer reply: 1 if the timeout was set.

History

RATE THIS PAGE
Back to top ↑

AltStyle によって変換されたページ (->オリジナル) /