Redis store key without a value

Who said that you should actually store anything in redis key? Empty string “” is a perfectly valid value for a redis key, and it’s a shortest possible one: > SET foo “” OK > GET foo “” > BITCOUNT foo (integer) 0

TTL for a set member

No, this isn’t possible (and not planned either). The recommended approach is to use an ordered set with score set to timestamp and then manually removing expired keys. To query for non-expired keys, you can use ZRANGEBYSCORE $now +inf, to delete expired keys, ZREMRANGEBYSCORE -inf $now will do the trick. In my application, I simply … Read more

Is there a way to set an “expiry” time, after which a data entry is automatically deleted in PostgreSQL?

There is no built in expiration feature but if your goal is to automatically expire fields and have the logic contained within your database (and thus no outside dependency like a cron job) then you can always write a trigger. Below is an example of a trigger that deletes rows from a table that have … Read more

tech