Clear cache after switching culture?

Vote:
 

I'm using ISynchronizedObjectInstanceCache for caching objects in our application and run into an issue when we enabled globalization. After an user changes language/culture on the site the cache doesn't get invalidated, which makes all cached objects to show up in the wrong language. I cannot seem to find any lang/culture variables to be set in the insert method nor in the CacheEvictionPolicy object, and cannot find anything from the documentation. What is the best practice for handling this on a globalized site? 

//J

#176232
Mar 14, 2017 10:47
Vote:
 

A cache should not have to worry about culture or anything, it is after all a cache, it should just cache whatever you tell it with the given cache key.

You make the cache keys, so if you need culture specific cache items then perhaps build the culture info into the cachekey you generate when you work with the cache? But think about invariant culture as well for items you cache that are not culture specific otherwise you will have duplicate items in the cache which is bad for memory consumption and therefor performance.

#176302
Mar 15, 2017 12:50
Vote:
 

That works perfect, Thanks!

#176341
Mar 16, 2017 12:29
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.