Open wosledon opened 10 months ago
cli.Notice += (s, e) =>
{
if (e.NoticeType == NoticeType.Event && e.Log == "ClientSideCaching:InValidate")
{
var keys = e.Tag as string[];
}
};
cli.UseClientSideCaching(new ClientSideCachingOptions
{
//本地缓存的容量
Capacity = 3,
//过滤哪些键能被本地缓存
//KeyFilter = key => key.StartsWith("Interceptor"),
//检查长期未使用的缓存
CheckExpired = (key, dt) => DateTime.Now.Subtract(dt) > TimeSpan.FromSeconds(600)
});
默认是直接删除本地缓存,但是缓存有时不一定是静态数据,而是动态数据,需要做一些更新处理。例如采用动态编译技术实现的动态接口,需要更新后编译到当前环境。