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

CNAME and A record have different TTLs. Which one will be cached?

You can see that the CNAME and subsequent record have different TTLs by using dig.. dig docs.nwesd.org ; <<>> DiG 9.5.1-P3 <<>> docs.nwesd.org ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28244 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 4, ADDITIONAL: 4 ;; QUESTION SECTION: ;docs.nwesd.org. … Read more

Varnish Cache – default TTL?

This is in the default template: sub vcl_fetch { if (beresp.ttl <= 0s || beresp.http.Set-Cookie || beresp.http.Vary == “*”) { /* * Mark as “Hit-For-Pass” for the next 2 minutes */ set beresp.ttl = 120 s; return (hit_for_pass); } return (deliver); } So, 120 seconds.