dotnetcore / EasyCaching

:boom: EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
MIT License
1.96k stars 323 forks source link

FasterKv MaxRdSecond set 0 or -1 not come into effect #550

Open dongzhaosheng73 opened 1 month ago

dongzhaosheng73 commented 1 month ago

IServiceCollection services = new ServiceCollection();

services.AddEasyCaching(option => { //use fasterkv cache option.UseFasterKv(config => { config.EnableLogging = true; config.MaxRdSecond = -1; }, "testcaching").WithMessagePack("testcaching"); });

IServiceProvider serviceProvider = services.BuildServiceProvider();

var factory = serviceProvider.GetService();

var caching = factory.GetCachingProvider("testcaching");

caching.TrySet("testcaching", $"testcachingmsg", TimeSpan.FromSeconds(1));

var msg = caching.Get("testcaching");

Debug.WriteLine($"caching msg->{msg}");

Thread.Sleep(3000);

var msg2 = caching.Get("testcaching", () => "12345", TimeSpan.FromSeconds(1));

Debug.WriteLine($"caching msg2->{msg2}");

print is

11:57:26:112 caching msg->testcachingmsg 11:57:29:114 caching msg2->testcachingmsg

I see issues setting MaxRdSecond to 0 or -1 has no effect

There is no such case. Why? In addition, the documentation of UseFasterKv is too few. I can only know from the preferred documentation that it is similar to the combination of UseInMemory and UseDisk. I don't know if this is the right understanding, there is so little documentation

Memoyu commented 1 month ago

@dongzhaosheng73 EasyCaching中FasterKv缓存实现中Set设置的超时时间似乎有点问题(MaxRdSecond 同理),没有起作用,近期我会PR修复一下;

还有,更多关于FasterKv的信息可以移步看看microsoft/FASTER项目,以及官方文档

dongzhaosheng73 commented 1 month ago

@dongzhaosheng73 EasyCaching中FasterKv缓存实现中设置设置的超时时间好像有点问题(MaxRdSecond同理),没有操作系统,近期我会PR修复一下;

另外,更多关于FasterKv的信息可以移步看看microsoft/FASTER项目,以及官方文档

Thank you. Can UseInMemory and UseDisk be used together? Like, if the content cache does not match, it will automatically search the hard disk cache. Reassigning the cache automatically fills both caches but their lifetimes can be set separately, right?

Memoyu commented 1 month ago

Thank you. Can UseInMemory and UseDisk be used together? Like, if the content cache does not match, it will automatically search the hard disk cache. Reassigning the cache automatically fills both caches but their lifetimes can be set separately, right?

@dongzhaosheng73 目前没有这样的混合场景的实现,只有HybridCache中混合分布式缓存的实现,你可以参考这个自己实现。