Actively gc cache entries with ttl on supported storage backends
Context: Followup from a discussion with @Atinux as he asked if it is possible to pass custom transaction options to defineCachedHandlerto allow setItem with custom ttl and allow invalidating caches. currently, some unstorage drivers support ttl inconsistently.
Currently, the caching layer, passively (on demand) invalidates cache entries on the next access. But it does not delete them during revalidation or in the background.
Actively (automatically by storage backend) invalidating caches, is pending for universal ttl support, which afterward, we can set it.
We might also find a strategy for passive invalidation (during revalidation if it fails for example) but not sure. Another option is for unstorage to support background gc.
I imagine the plan is to pass maxAge (if, for example swr: false) as the ttl for that setItem right?
https://github.com/nitrojs/nitro/pull/2783 adds maxAge to the underlying storage backend. I think next steps to increase support (and also to the passive mode for unsupported ones) goes to the storage side.