How can we set expiry for a record in dotnet using Redis.OM dotnet ?
I did go through documentation of Redis.OM dotnet but could not find any method that we can use to set expiry for a record. But for the same package using python ( Redis OM Python ) there is a method to set expiry.
person_to_expire = Person.get(id)
Person.db().expire(person_to_expire.key(), seconds)
Can someone help me to understand how we can do the similar thing using Redis OM dotnet ?
2
Answers
I got the answer from the contributor of the package.
https://github.com/redis/redis-om-dotnet/issues/107
once the connection has been established and while inserting your record, you can use this method to set the expiration for the record.
Note: Here we need to pass seconds in string format.
You can set TTL (Time to Live) during insert: