> Redis EXPIRE doesn't actually delete any data after it expires though.
I guess OP likes the simplicity that built-in expiration provides. In your example - all selects reading the value will need to have this expiration check. And also some scheduled process will have to be written to actually delete the values.
I would access the table through a view that had that query built into it.
create table all_items(id integer, value text, expires timestamp);
create index all_item_expiry on all_items(expires);
create view items as (select id, value, expires from all_items where expires > now());
Then you can treat items as your base table and postgres neatly allows INSERT/UPDATE/DELETE from it. You'll need a job to clean up expires < now() items but it can be done at whatever arbitrary interval you like, could even be a trigger in PG if you were feeling spicy.
I guess OP likes the simplicity that built-in expiration provides. In your example - all selects reading the value will need to have this expiration check. And also some scheduled process will have to be written to actually delete the values.