-
Notifications
You must be signed in to change notification settings - Fork 9
Flatwhite.RevalidateAttribute
Van Nguyen edited this page Jan 10, 2016
·
2 revisions
Use this attribute to decorate on a method where you want to re-validate a specific cache entry after a method is invoked. We decorate the method with this attribute, provided a list of reference keys to validate cache entries when method is called:
public interface IUserService
{
[OutputCache(Duration = 2, StaleWhileRevalidate = 2, VaryByParam = "userId", RevalidateKeyFormat = "User_{userId}")]
object GetById(Guid userId);
[OutputCache(Duration = 2, VaryByParam = "userId", RevalidateKeyFormat = "User_{userId}")]
Task<object> GetByIdAsync(Guid userId);
[Revalidate("User_{userId}")]
void DisableUser(Guid userId);
}