Created
December 2, 2012 21:19
-
-
Save thecodejunkie/4191120 to your computer and use it in GitHub Desktop.
Nancy lightning cache demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment