i want to use best naming convention for cache tag key but i could not find it. i checked in official docs and other websites for example for cache tag but i could find only 1 word tags , should i use same casing as variable name or other format like globalMenus
or should i use global:menus or global_menus. i am looking for best practices.
https://laravel.com/docs/9.x/cache#cache-tags
Cache::tags(['globalmenus')->get('slider_media');
2
Answers
I would go with kebab case for cache tags as this is how Laravel uses Blade component tags in rendering components
Anything would work really. But if you look at how Laravel does it you’ll see:
So I’d say use underscores for separating words and colons for separating groups
https://github.com/laravel/framework/blob/b9203fca96960ef9cd8860cb4ec99d1279353a8d/tests/Cache/CacheTaggedCacheTest.php#L236