Created
November 20, 2015 15:52
-
-
Save asimmon/5587eb89abd266f9dadf to your computer and use it in GitHub Desktop.
Caching method results with AOP - Autofac Configuration
This file contains hidden or 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
public class MyModule : Module | |
{ | |
protected override void Load(ContainerBuilder builder) | |
{ | |
builder.RegisterType<MemoryCacheProvider>() | |
.As<ICacheProvider>() | |
.SingleInstance(); | |
builder.RegisterType<CacheResultInterceptor>() | |
.SingleInstance(); | |
builder.RegisterType<FakeExpensiveClass>() | |
.As<IDoExpensiveWork>() | |
.EnableInterfaceInterceptors() | |
.InterceptedBy(typeof(CacheResultInterceptor)) | |
.SingleInstance(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment