Closed vikstrous2 closed 2 years ago
Hi,
I just merged on master a first implementation of generics for CacheInterface so you have to instantiate cache the following way now:
cacheManager := cache.NewChain[any](
cache.New[any](ristrettoStore),
cache.New[any](redisStore),
)
Of course, you can declare your own type instead or any
, that’s generics behavior ;-)
Please feel free to comment if you have any issue.
Closing this issue since v3 has been released. Thank you
Have you considered adding support for generics to remove the need for casting when using the cache? I think a change like that would have to be a new major version, but I think that it would make using the cache much nicer. I don't know the implications for the stores interface. I would have to experiment a bit to understand the implications. I think this would be a fun little project, so I'm open to making the PR :)