Sitefinity 4 Application caching.

Posted by Community Admin on 03-Aug-2018 08:02

Sitefinity 4 Application caching.

All Replies

Posted by Community Admin on 18-Jan-2012 00:00

We are looking to store important data such as userids, etc in the cache. When searching about sitefinity 4x I see alot of info about browser,page caching etc but does sitefinity have any built in application cache that would be the equilvalent of the asp.net cache objects?  Does telerik provide any such library?

Once again our end goal is to store important data efficiently in a way which makes it easy for sitefinity to access it.

Posted by Community Admin on 19-Jan-2012 00:00

Hello Anthony,

Sitefinity utilizes the Enterprise Library Caching Application Block for caching some of its data. In order to obtain an instance of the ICacheManager interface you have to call the GetCacheManager(string instanceName) method of Telerik.Sitefinity.Services.SystemManager class. This method will create and return a new manager or retrieve an existent one. Beware not to use one of the internally used cache managers (Global, Configuration, etc. See Telerik.Sitefinity.Services.CacheManagerInstance enumeration). If you want to use a simple dictionary object as a singleton then you can use the CreateStaticCache() method of the same class.

If you intend to use the caching for storing data items, then we have to note that OpenAccess has a second level cache for its persistent items, that is used to cache data items and not retrieve them from the database. Also there will be a problem if you access the same data items by different OpenAccess scopes. By default this second level cache is active for single server environments and inactive when in load balancing mode to prevent serving stale data.

Kind regards,
Ivan Pelovski
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 23-Jan-2012 00:00

Thanks for the insight Ivan, the first paragraph makes sense. However, I read Teleriks documentation on second level cache and the implementation of it is still foggy to me. How do you enable this functionality in 4.4? I read it works but preventing open access statements from occurring if the data has been loaded once but how would you access an item that was in L2 cache, and how would you even specify which items you wanted in the cache and how long to store them?

- Anthony

Posted by Community Admin on 25-Jan-2012 00:00

Hello Anthony,

As I said, by default the second level cache is enabled when in single server environment, and disabled when in load balancing mode. To enable/disable the cache explicitly you have to go to Advanced settings -> Data, type True or False in the "Enable data caching" field and press "Save changes". You can read more about the second level cache of OpenAccess here: http://www.telerik.com/help/openaccess-orm/2nd-level-cache.html. As it says in the article "All of this caching is transparent to the application using OpenAccess." so you cannot access a stored item directly, instead OpenAccess will fetch it from the cache automatically if it is there. Unfortunately you cannot control which items to be stored and for how long.

Kind regards,
Ivan Pelovski
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed