I think the redis-store cache in rails also uses a rack middleware, and supports setting ttl on keys which will auto-expire on redis...?
https://github.com/jodosha/redis-store/blob/master/redis-rac...