We are currently using the StackExchange Redis library to handle our Redis-database but came across a little snag. Please keep in mind that we are new to Redis, so there might be a better way to do this entirely.
Our requirement is to store about 10000 keys as quickly as possible, but all with the same expiration time. The expiration is not really a requirement, only that the database should not grow over time, and the next update might be 10100 keys, but only 90% of the keys will be same, or maybe the next update is only 9000 keys. So in effect some of the keys might never be visited again, or overridden.
I could use a diff to find all the keys from last time and remove them manually, but that seems unnecessary complicated when we have the concept of expiration as well as a redis actively removing expired keys.
When using the StringSetAsync I can send all keys at once and the operation is completed very quickly, but I cannot set the expiration-time, only parameters for When and CommandFlag is possible.
If I use StringSetAsync to add the keys one-by-one, I get the expiration parameter, but the process takes a magnitude more time.
Is there an good way to do this?