This article introduces basic caching concepts and Ektron's caching options.
Caching enables you to store data in memory for rapid access. Applications can access the cache instead of retrieving data from the database whenever the data is accessed. This strategy avoids repeated queries for data, and is beneficial because it can improve site performance and scalability. Caching also makes data available when the data source is temporarily unavailable.
Types of Caching
- Page Level Output Caching - this keeps a copy of the HTML or API that was sent in response to a request in memory, resulting in large performance gains. This can be configured with the CacheInterval property of selected Ektron server controls or by adding an OutputCache directive to the page:
<%@ outputcache duration="60" varybyparam="*" %>
- Data Caching - data caching stores the required data in cache so that the web server will not send requests to the DB server every time for each request, which ultimately increases the site's performance.
- Fragment Caching - Caches the portion of the page generated by the request. Sometimes, it is not practical to cache an entire page. In such cases, you can use the Page Level Output Caching on a portion of page.
What does Ektron provide for caching out of the box?
- Ektron Server Controls - a select amount of Server Controls have a CacheInterval property, where you can cache the number of seconds that a control's data is cached. See Caching with Server Controls.
- WebCache - Ektron provides a web cache provider that can be found in the web.config file under the providers section. Use this provider in the context of a Global caching strategy.
- In this setting, the cacheTimeSeconds can be modified to fit specifications. The default time is set to 5 minutes (300 seconds).
- Business Objects Caching - Ektron provides a way to cache the Business Layer APIs to improve performance on individual API calls.
- Here you can set the the default container for the framework to Cache, which allows the Framework APIs to utilize the caching layer. For more information on Business Object caching and how to configure, click here.
Need a cache wrapper class?
Ektron Support has provided a sample Generic Cache Wrapper, which is an excellent means of improving performance and reducing load on databases and other resources. Not everyone's requirements are the same and caching needs to take into account things like permissions which is not accounted for in this wrapper sample.
In addition, here is a code sample on how to use the Cache Wrapper in conjunction with the Ektron Framework APIs.