Redis Cache store - Jaxelr/Nancy.RapidCache GitHub Wiki

RapidCache also contains an implementation of Redis as a Cache Store that allows us to cache the content as part of a Redis service.

It is a separate library that must be installed via nuget:

Install-Package Nancy.RapidCache.Redis

The usage is similar to other type of stores:

using Nancy.RapidCache.Extensions;
using Nancy.Routing;
using Nancy.TinyIoc;
using Nancy.Bootstrapper;

namespace MyCustomWebApp
{
    public class ApplicationBootrapper : DefaultNancyBootstrapper
    {
        protected override void ApplicationStartup
        (TinyIoCContainer container, IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            //Declaring the Redis Cache Store explicitly.
            this.EnableRapidCache(
                container.Resolve<IRouteResolver>(), 
                ApplicationPipelines, 
                new[] { "query", "form", "accept" }, 
                new RedisCacheStore("localhost")); //default redis port is 6379.
        }
    }
}