VaryByCustom 属性を使用してキャッシュを無効化したい。次のコードは、キャッシュのセットアップに使用されています。
public override string GetVaryByCustomString(HttpContext context, string arg)
{
if (!string.IsNullOrWhiteSpace(arg))
{
if (context.User.Identity.Name != null)
{
return context.User.Identity.Name;
}
}
return base.GetVaryByCustomString(context, arg);
}