Honestly I think WoT relay basically does this already paired with lmdb. There is a purge by date function built in and lmdb already handles the caching by accessibility out of the box. While also preventing majority of spam and being able to act as a single local relay by pulling notes from other relays as a background task.
Ill give it a try, but I don't want to purge the events by their created_at date. I want to purge them by the last time they where accessed ( i.e. sent to a client ) that way profiles event stay around
Fairly certain we only purge kind 1, reactions and zaps But to build exactly how you want it wouldn't be that hard either, a little patch and just added a map in ram with last accessed by and some job to purge by