Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

期望client-side-caching可以暴露出一个handle来处理过期的缓存 #168

Open
wosledon opened this issue Dec 14, 2023 · 1 comment

Comments

@wosledon
Copy link

默认是直接删除本地缓存,但是缓存有时不一定是静态数据,而是动态数据,需要做一些更新处理。例如采用动态编译技术实现的动态接口,需要更新后编译到当前环境。

@2881099
Copy link
Owner

2881099 commented Dec 14, 2023

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)
});

2881099 added a commit that referenced this issue Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants