public
Created

Nancy lightning cache demo

  • Download Gist
gistfile1.cs
C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
using System;
using Nancy;
using Nancy.LightningCache.Extensions;
using Nancy.Routing;
 
public class Home : NancyModule
{
public Home()
{
Get["/"] = parameters => {
return View["index", new object()].AsCacheable(DateTime.Now.AddMinutes(1));
};
}
}
 
public class ApplicationBootrapper : Nancy.DefaultNancyBootstrapper
{
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
this.EnableLightningCache(container.Resolve<IRouteResolver>(), ApplicationPipelines, new[] { "id", "query", "take", "skip" });
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.