Skip to content

Instantly share code, notes, and snippets.

@aramkoukia
Created January 7, 2018 00:03
Show Gist options
  • Select an option

  • Save aramkoukia/6f818724fb1f1cef729d432044a1449a to your computer and use it in GitHub Desktop.

Select an option

Save aramkoukia/6f818724fb1f1cef729d432044a1449a to your computer and use it in GitHub Desktop.
using System;
using Unity;
using Unity.Interception.PolicyInjection.Pipeline;
using Unity.Interception.PolicyInjection.Policies;
namespace CachingAspectOrientedImplemetation
{
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public class InvalidateCacheAttribute : HandlerAttribute
{
public InvalidateCacheAttribute(string keyPrefix)
{
this.KeyPrefix = KeyPrefix;
}
public string KeyPrefix { get; set; }
public override ICallHandler CreateHandler(IUnityContainer container)
{
return new InvalidateCacheAttributeHandler(this.KeyPrefix);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment