how does it deal with guest cache? #476
-
Since the doc says it only creates a separate cache for logged-in users? so do guests have a shared cache? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Please take a look at abstract class
As you can see, it returns either User ID or empty string, that is the string use to differ between a logged-in users and guest users. Moreover, you can return as many different string due to as many conditions as you need. If you want both of them to use the same cache, just simply return empty string from the function. |
Beta Was this translation helpful? Give feedback.
Please take a look at abstract class
BaseCacheProfile
, it implements functionuseCacheNameSuffix(Request $request): string
fromCacheProfile
.As you can see, it returns either User ID or empty string, that is the string use to differ between a logged-in users and guest users. Moreover, you can return as many different string due to as many conditions as you need. If you want both of them to use the same cache, just simply return empty string from the function.