Try our conversational search powered by Generative AI!

ISynchronizedObjectInstanceCache vs ObjectCache


What is the difference between using C# ObjectCache vs ISynchronizedObjectInstanceCache in an Episerver web application.

Oct 25, 2019 16:49

It's synchronized, meaning if you have more than 1 web server, it will (atleast try) to communicate to the other servers and evict cache if one of the servers has modified the object behind the cache :)

Oct 25, 2019 16:54
Dileep D - Oct 25, 2019 20:53
Thanks Joel. I used Object cache earlier in my application which worked fine in dev environment but could see some weird behavior in higher environments where there are more than one server. Ended up using synchronized cache and yet to validate the issue but wanted to know that it is what it means :)

Hi Dileep

As a general rule, we should always use ISynchronizedObjectInstanceCache when caching custom data. It is the safest to do, when there are more than one server hosting the solution. Even if there is only one server, this is still the best way.

Of course we can also use IObjectInstanceCache. But for most scenarios it doesn't makes sense to use it.

Oct 27, 2019 7:52
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.