You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 23, 2020. It is now read-only.
Currently, when CacheMiddleware is applied then all application endpoints will be cached according to the cache.ttl. Users may want to not cache a specific endpoint, e.g. because its response should always be fresh.
Use @cached(ttl=0): this would work, as currently if the TTL is zero we do not cache at all (see Don't cache if TTL is 0 #10), but it is not the most intuitive API.
To implement this feature:
Add the @never_cache decorator in decorators.py. You may want to implement it as a proxy to @cached(ttl=0), if it turns out to work.
Add a test that if the decorator is applied, the endpoint is not cached even if the application is wrapped in CacheMiddleware.
(Note: the situation where both @cached and @never_cache isn't within the scope of this issue. It will be dealt with as part of #16.)
The text was updated successfully, but these errors were encountered:
florimondmanca
changed the title
Implement no cache decorator
Implement never_cache decorator
Nov 3, 2019
Currently, when
CacheMiddleware
is applied then all application endpoints will be cached according to thecache.ttl
. Users may want to not cache a specific endpoint, e.g. because its response should always be fresh.The proposed API is a new
@never_cache
decorator:Alternatives that were considered:
@cached(ttl=0)
: this would work, as currently if the TTL is zero we do not cache at all (see Don't cache if TTL is 0 #10), but it is not the most intuitive API.To implement this feature:
@never_cache
decorator indecorators.py
. You may want to implement it as a proxy to@cached(ttl=0)
, if it turns out to work.CacheMiddleware
.(Note: the situation where both
@cached
and@never_cache
isn't within the scope of this issue. It will be dealt with as part of #16.)The text was updated successfully, but these errors were encountered: