upstash / redis-py

HTTP based Python Redis Client for Serverless and Edge Functions
https://docs.upstash.com/redis
MIT License
29 stars 3 forks source link

Add documentation, missing options and datetime support to expire commands #36

Closed ytkimirti closed 10 months ago

ytkimirti commented 10 months ago

Now expire and pexpire can be used with datetime.deltatime and expireat and pexpireat can be used with datetime.datetime

import datetime

# Expire next month
date = datetime.datetime.now() + datetime.timedelta(days=30)
redis.expireat("mykey", date)

# Expire after a month
redis.expire("mykey", datetime.timedelta(days=30))
And they support the nx xx gt lt options