Example #1
0
 public void BeforeMethodExecuted(IMethodInvocationContext context)
 {
     ICacheManager manager = DIContainer.DefaultContainer.Resolve<ICacheManager>();
     string key = GetCacheKey(context);
     context.ReturnValue = manager.GetOrAdd<object>(key, () => context.Proceed(), TimeSpan.FromMinutes(CacheDuration));
     context.Cancel = true;
     context.IsMethodExecuted = true;
 }
Example #2
0
 public void OnMethodExecuting(IMethodInvocationContext context)
 {
     ILog log = DIContainer.DefaultContainer.Resolve<ILog>();
     log.DebugFormat("Method: {0} is executing...", context.Method.Name);
     context.ReturnValue = context.Proceed();
     context.Cancel = true;
     log.DebugFormat("Method: {0} done executing.", context.Method.Name);
 }
Example #3
0
 public void ExecuteAsync(IMethodInvocationContext context)
 {
     Task.Factory.StartNew(() => context.Proceed());
     context.Cancel = true;
 }