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; }
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); }
public void ExecuteAsync(IMethodInvocationContext context) { Task.Factory.StartNew(() => context.Proceed()); context.Cancel = true; }