You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When putting untagged items in the cache (specifically Redis, in my case), the cache keys look nice and are easy to understand.
For example, Cache::remember('abc:123', now()->addMinute(), fn() => 'this is a test'); will produce a key in Redis like my-app:cache:abc:123
This allows easy navigation of the cache in desktop tools like Another Redis Desktop Manager, which group keys into a hierarchy:
However... adding any tags to the cached item "breaks" the hierarchy of the key identifier.
For example, Cache::tags(['tag1', 'tag2'])->remember('abc:123', now()->addMinute(), fn() => 'this is a test'); will produce a key in Redis like my-app:cache:58f117b9577543a291cdce91560dcf4e41b98c87:abc:123.
This has the unwanted effect of making it impossible to navigate tagged items by their keys within desktop clients, as the tag hash is prepended to the front end of the hierarchy:
I'm not well-versed enough in Redis to know why this needs to be put on the front, and I appreciate Laravel is probably doing some magic here to get tags to work in this way. But is there a good reason this sha1 hash needs to be prepended? Are there any alternative, cleaner approaches that could be used/configured in a future release?
I'm sure I'm not the only one who likes to examine entries in the cache during development, and for debugging things in production too.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
When putting untagged items in the cache (specifically Redis, in my case), the cache keys look nice and are easy to understand.
For example,
Cache::remember('abc:123', now()->addMinute(), fn() => 'this is a test');
will produce a key in Redis likemy-app:cache:abc:123
This allows easy navigation of the cache in desktop tools like Another Redis Desktop Manager, which group keys into a hierarchy:
However... adding any tags to the cached item "breaks" the hierarchy of the key identifier.
For example,
Cache::tags(['tag1', 'tag2'])->remember('abc:123', now()->addMinute(), fn() => 'this is a test');
will produce a key in Redis likemy-app:cache:58f117b9577543a291cdce91560dcf4e41b98c87:abc:123
.This has the unwanted effect of making it impossible to navigate tagged items by their keys within desktop clients, as the tag hash is prepended to the front end of the hierarchy:
I'm not well-versed enough in Redis to know why this needs to be put on the front, and I appreciate Laravel is probably doing some magic here to get tags to work in this way. But is there a good reason this
sha1
hash needs to be prepended? Are there any alternative, cleaner approaches that could be used/configured in a future release?I'm sure I'm not the only one who likes to examine entries in the cache during development, and for debugging things in production too.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions