Closed pablojmp closed 3 years ago
Hi, thanks for the feedback. You right, there is missing support for the expiration type for the memory cache.
In a few days, I will implement this expiration type enum :)
@tomasjurasek thanks a lot for the quick response! is it too much to ask for an ETA on the release of the nuget version that'll contain the patch?
@pablojmp I do PRV now. It can be probably released tomorrow.
baking the build at https://github.com/Kentico/kontent-delivery-sdk-net/releases/tag/14.2.0
@pablojmp here you go: https://www.nuget.org/packages/Kentico.Kontent.Delivery/14.2.0
please let us know if it works fine for you ;)
will test right away! thanks guys, that was ultra fast!
i was testing this configuration
services.AddDeliveryClientCache(new DeliveryCacheOptions
{
StaleContentExpiration = TimeSpan.FromSeconds(2),
DefaultExpirationType = CacheExpirationType.Absolute,
DefaultExpiration = TimeSpan.FromSeconds(10),
CacheType = CacheTypeEnum.Memory
});
while using wireshark to sniff the traffic. if i keep refreshing a page that fetches content, i don't see more requests to kentico, event after the 10 seconds windows. if i stop refreshing the page and wait 10 seconds before refreshing, the sdk makes the request again. it's behaving as a sliding expiration. am i missing something in the configuration?
Maybe this method here
void Configure(DeliveryCacheOptions o)
{
o.DefaultExpiration = options.DefaultExpiration;
o.StaleContentExpiration = options.StaleContentExpiration;
o.CacheType = options.CacheType;
o.Name = name;
}
it's missing the new property assignment
@petrsvihlik @tomasjurasek can you reopen this one?
@pablojmp sorry, I missed this configuration. Fixed in the 14.2.1
@tomasjurasek don't worry, i'm the one who feels sorry for throwing more work at you 😄 thanks again!
confirmed: it's working as intended, thanks!
Motivation
When using the DeliveryClientCache, one can only set a sliding expiration via DeliveryCacheOptions.DefaultExpiration. If no webhooks are set up for the app and the cache is accessed frequently, there's no way to evict older content.
Proposed solution
Add a parameter to select what type of expiration DefaultExpiration has (i.e. DefaultExpirationType = Absolute | Sliding) and set the expiration accordingly in here