Closed chamchenko closed 3 years ago
Hello. I'm glad you find this project useful. Sorry for the late reply. What that site is doing is a bit strange, but i think there is a solution that should work for you.
Solution 1:
If the url you are using does not use any url fragments, then you should be able to add #kids
or #adult
to the url.
This will cause the caching system to treat them differently. But the url resource will be the same, asuming the site isn't doing anything strange with url fragments.
Solution 2: There is currently an undocumented feature that I didn't get around to documenting yet. This new feature is a callback level cache. With this you can cache the results of a callback for the specified time. If solution 1 don't work, this should definitely work.
@Route.register(cache_ttl=60) # time in minutes
def root(plugin):
pass
Thank you for your reply your first solution work fine.
First of all thank you for this amazing tool, I really appreciate it. I'm not sure if should post this here or in urlquick repo, I hope that I'm not wrong. So I have been working on this add-on lately, and your framework have been very useful. At some point I'm working on fetching kids contents and it turns out that the api is filtering content using a http header containing profile infos that differentiate adults from kids, the issue is that the same url could be called to fetch content for kids or for adult and the only difference is that header. which make it impossible to make use of caching as it's the same url, my only solution (the only one that I could see) is disabling cache for those requests by using max_age=0 for urlquick So long story short my question is, is it possible to differentiate those requests when storing their respective responses into cache database. If not, would it not be a useful to implement it.