Skip to main content

Documentation Index

Fetch the complete documentation index at: https://upstash-vector.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Arguments

key
str
required
The key to expire.
milliseconds | datetime.timedelta
int
required
The timeout in milliseconds as int or datetime.timedelta
nx
bool
Set expiry only when the key has no expiry
xx
bool
Set expiry only when the key has an existing expiry
gt
bool
Set expiry only when the new expiry is greater than current one
lt
bool
Set expiry only when the new expiry is less than current one

Response

True if the timeout was set
# With milliseconds
redis.set("mykey", "Hello")
redis.expire("mykey", 500)

# With a timedelta
redis.set("mykey", "Hello")
redis.expire("mykey", datetime.timedelta(milliseconds=500))