-
Notifications
You must be signed in to change notification settings - Fork 644
Description
Currently, CacheRef only implements Deref which cannot expose the reference with the 'a lifetime.
Is the lack of a method or inherent function which lets you retrieve this by design, or is this an oversight? If it is by design, it should probably be documented. My guess is that this ref keeps the entry in the cache alive, so referencing it is only safe while the CacheRef exists, is this about correct?
For context: I was migrating a bot which had a util function for either getting a message from the cache or downloading it if necessary, this function returned an owned object because both the cache and download method did. Since the cache no longer serves owned objects, my first instinct was to go for Cow, but this won't work because the lifetime is shortened to that of the CacheRef.