Is there a tutoiral or some working example code for caching? I tried finding something but couldn't see any good examples.
Most of the time its just bits and pieces.
not sure, what are you looking for, but if you want to use ISynchronizedObjectInstanceCache cache, this is how you can do
//ISynchronizedObjectInstanceCache _synchronizedObjectInstanceCache injected in constructor
var cacheKey = $"YOURCACHEKEY";var cacheValue = _synchronizedObjectInstanceCache.Get(cacheKey) as YourModel;if (cacheValue != null) return cacheValue;
var yourModel = GetYourModel();_synchronizedObjectInstanceCache.Insert(cacheKey, yourModel, Global.AbsoluteCacheEvictionPolicy_Short);
Thanks Khan for the response.
Which constructor am I going to inject //ISynchronizedObjectInstanceCache _synchronizedObjectInstanceCache?
Where am I getting the cache key?
That is what I was saying that I couldn't find any proper tutorial.
Thanks for the response Khan.
What I don't get is which constructor should I pass this ISynchronizedObjectInstanceCache _synchronizedObjectInstanceCache into?
Also, how do I configure the cache server? I mean don't I have to set somewhere cache urls for local server and remote server etc?
Google is my friend, https://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/Caching/Object-caching/
Thanks but I have looked into this and couldn't find the proper solution maybe I am missing something. But thanks anyway I will keep looking.