YouTip LogoYouTip

Keys Pexpireat

Redis PEXPIREAT Command

Redis PEXPIREAT Command

--

Redis Tutorial

Redis Tutorial Redis Introduction Redis Installation Redis Configuration Redis Data Types

Redis Commands

Redis Commands Redis Keys Redis Strings Redis Hashes Redis Lists Redis Sets Redis Sorted Sets Redis HyperLogLog Redis Pub/Sub Redis Transactions Redis Scripting Redis Connection Redis Server Redis GEO Redis Stream

Redis Advanced Tutorial

Redis Backup and Recovery Redis Security Redis Performance Testing Redis Client Connection Redis Pipelining Redis Partitioning Java Using Redis PHP Using Redis Redis Commands Redis Strings

Redis PEXPIREAT Command

Redis Key

The Redis PEXPIREAT command is used to set the expiration time for a key in milliseconds. The key will no longer be available after it expires.

Syntax

The basic syntax of the redis PEXPIREAT command is as follows:

redis 127.0.0.1:6379> PEXPIREAT KEY_NAME TIME_IN_MILLISECONDS_IN_UNIX_TIMESTAMP

Available Version

>= 1.0.0

Return Value

Returns 1 if the setting is successful. Returns 0 when the key does not exist or the expiration time cannot be set for the key (e.g., trying to update the expiration time of a key in a version of Redis lower than 2.1.3).

Example

First, create a key and assign a value:

redis 127.0.0.1:6379> SET tutorialkey redis
OK

Set an expiration time for the key:

redis 127.0.0.1:6379> PEXPIREAT tutorialkey 1555555555005
(integer) 1
Redis Key Redis Commands Redis Strings

ByteArk Coding Plan supports mainstream large models such as Doubao, GLM, DeepSeek, Kimi, MiniMax, etc., directly supplied by the official with stable and reliable performance. Configuration Guide Β₯9.9/month Subscribe Now

← Keys MoveKeys Keys β†’