Oct 24


Sitefinity uses an in-memory cache service derived from the popular, (in it's day) Microsoft Enterprise Library application blocks. The trouble is that if you have a load balanced environment you are saving a copy of your cached data on every node. This extension adds a distributed cache option via Redis. It has some caveats to consider so make sure you understand those first.

For a long time I have nagged that Sitefinity can't call itself an Enterprise application until it has an enterprise caching solution. (In my opinion.)

Out of the box their is a local in-memory cache option which is really good and without doubt the fastest cache you can use. But there are scenarios when it doesn't solve your problems.

Perhaps you have a third party service that charges for every request and you have a lot of web nodes requesting the same data. Perhaps you have user supplied data that is submitted to a node and you need the other nodes to know this.

Sitefinity comes with the ability to notify other nodes of changes using cache dependency which works but adds that extra layer of implementation. Having a shared storage area would just be much easier and so I have created a little module allowing you to push and retrieve data to a Redis cache server.

But Sitefinity already supports Redis...?

Yeah, nah! (There is a good Kiwi answer for you.)

Sitefinity first allowed you to use Redis to manage the Sitefinity load balanced server communication. You don't need to specify each node or enable WCF communications between the nodes. Just provide the connection to Redis. This was brought in to support running Sitefinity on Azure.

They then supported using Redis to store the page 'output cache' data. Your generated page HTML docs. But they don't allow you to save a List<YourData> in Redis.

I suspect there was a good reason for this. When using the local in-memory cache you can store almost anything. You can just say here is my object put it in the cache. But with cache servers you often need to first, put it into a 'String', meaning for Sitefinity to use a distributed cache they would need to ensure every object was serializable' and could be converted. That doesn't sound so easy.

The implementation for the output cache is fine because the HTML is a big String so easy to cache.

The module

You can have a look at the module details on its help page. If you need to use another cache service you can look to copy what I have done by inheriting the ICacheManager interface and implementing its methods.

Darrin Robertson - Sitefinity Developer

Thanks for reading and feel free to comment - Darrin Robertson

If I was really helpful and you would buy me a coffee if you could, yay! You can.

Leave a comment
Load more comments

Make a Comment

recapcha code