Respawnsive / Apizr

Refit based web api client management, but resilient (retry, connectivity, cache, auth, log, priority, etc...)
https://www.apizr.net
Apache License 2.0
140 stars 12 forks source link

[question] how to invalidate cache for a specific request? #9

Closed roubachof closed 2 years ago

roubachof commented 2 years ago

I did myself my fork of the "insane" pack, but I must say you did a terrific job here and I would like to stop using my fork and start using your implementation :) The only thing I couldn't find in the docs is the possibility to invalidate the cache of a request. In my fork I added a Boolean on each request to invalidate the cache (force a remote fetch). This particularly important when you are doing a pull 2 refresh on mobile. So, am I missing something or are you accepting PRs :) ?

JeremyBP commented 2 years ago

Hi, the power pack was a good point of start. But the nasty guy I am was looking for something fluently configurable, magically extendable and easily declarable by attributes for all the resilient common needs. Apizr was born to get all the resilient glue right in place, the one line way (or almost). I would love to get feature ideas, issues tracking or anything that could improve the project, so feel free.

About cache, actually you could first call this method to clear dedicated request cache https://github.com/Respawnsive/Apizr/blob/d3ff0701f363c813cd550942fe098d2cb23790ee/Apizr/Apizr/IApizrManager.cs#L97 Then call the execute one to get fresh data. But I agree with you that a simple optional forceFetch bool param would do the trick easier. I'll try to implement it while I'm finalizing v4. And yes you could send PRs from/to develop branch (but this one could be a large one as adding a param should be done everywhere down core and integration packages).

roubachof commented 2 years ago

ok thanks ! I will use this mechanism until is new version is out !

JeremyBP commented 2 years ago

It's now implemented and will be shipped with v4 Thanks for suggesting :)