Proper way to use AgilityDependencyCache

Posted by Giovanni Mattucci on January 9, 2017

Can you please show an example of the proper way to use this method: to get the list of items from a `AgilityContentRepository`?

Right now I am getting data in this manner:
var data = new AgilityContentRepository<KeyValue>("ContentRepositoryRefName").Items();

Is there a more efficient way of doing this using the Dependency Cache?

   0 people like this question
15 30 50   per page
Hi Giovanni,

Your AgilityContentRepository call doesn't really require you to do any dependency cache since there is already some caching built-in to the AgilityContentRepository call. 

Where you might want to use the AgilityDependencyCache would be if you were manipulating a large list of items from Shared Content and doing some sort of filtering, or sorting etc - where the filtering is an expensive task and you don't want to do it over and over again.

Think of the AgilityDependencyCache as an alternative to using the ASP.NET built-in Cache where the cache gets cleared from memory when a list in Shared Content has been modified.

The example here: is a good starting point, just ignore the Data.GetContentView line as that Data call still works but is deprecated and replaced with the AgilityContentRepository call.


Posted By: James Vidler

Previous Next


Log in with your Agility username and password or
register for the site

Log In