diff --git a/examples/console_net8_client_side_caching/Program.cs b/examples/console_net8_client_side_caching/Program.cs index e0e57e5..5d5e2f1 100644 --- a/examples/console_net8_client_side_caching/Program.cs +++ b/examples/console_net8_client_side_caching/Program.cs @@ -32,6 +32,13 @@ static void Main(string[] args) Thread.CurrentThread.CurrentCulture = new CultureInfo("nb"); var test = long.Parse("-1"); + cli.Notice += (s, e) => + { + if (e.NoticeType == NoticeType.Event && e.Log == "ClientSideCaching:InValidate") + { + var keys = e.Tag as string[]; + } + }; cli.UseClientSideCaching(new ClientSideCachingOptions { //本地缓存的容量 diff --git a/src/FreeRedis/ClientSideCaching.cs b/src/FreeRedis/ClientSideCaching.cs index e17d142..a413963 100644 --- a/src/FreeRedis/ClientSideCaching.cs +++ b/src/FreeRedis/ClientSideCaching.cs @@ -164,7 +164,8 @@ void InValidate(string chan, object msg) { foreach (var key in keys) RemoveCache(string.Concat(key)); - } + _cli.OnNotice(_cli, new NoticeEventArgs(NoticeType.Event, null, "ClientSideCaching:InValidate", keys)); + } } static readonly DateTime _dt2020 = new DateTime(2020, 1, 1); diff --git a/src/FreeRedis/RedisClientEvents.cs b/src/FreeRedis/RedisClientEvents.cs index 6bcbf2b..01ade08 100644 --- a/src/FreeRedis/RedisClientEvents.cs +++ b/src/FreeRedis/RedisClientEvents.cs @@ -7,7 +7,7 @@ namespace FreeRedis { public enum NoticeType { - Call, Info + Call, Info, Event } public class NoticeEventArgs : EventArgs {