Is it possible to clear user cache for another user via FreeMarker?
- 5 years ago
It is not possible to get/set values in the user cache for a different user.
Just off the top of my head, if you want to manage a per-user cache and be able to change values for different users, you could alternatively create app cache entries that have a user id as part of the key. By default you could do something like this:
${appcache.put(user.id + ":" + "userInfo", {})}
You'll also have to change any logic that gets "userInfo" from the user cache to get it from the app cache with your new key format:
${appcache.get(user.id + ":" + "userInfo")}
Then if you want to set it for the user with id 5 you could just include that id in the key:
${appcache.put("5:userInfo", {})}
If you do this, it will be up to you to ensure that the right content is shown to the right users (whereas the user cache kind of does that for you).
Also if you do this, you might want to file a support case requesting to double the size of your app cache (since you will now be putting all the entries you used to put in your user cache in your app cache).
-Doug