Skip to content

Is there a way to not cached on some specific endpoints #139

Answered by JWCook
sinkaroid asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, currently the best option is to use URL patterns to set an expiration of 0. for example:

cache = SQLiteBackend(
    urls_expire_after={
        '/random': 0,
        '*': 360,   # Default expiration for all other URLs
    }
)

That will likely do what you want, but it's not 100% the same as disabling the cache for that /random endpoint. The response will be stored in the cache, but it won't actually be used unless you specifically request it. The reason for that is to support things like max-stale or conditional requests (not yet implemented in this library, but mentioned in #79 if anyone needs it).

what is -1 mean

That means "never expires." Docs for the different expiration values…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JWCook
Comment options

Answer selected by JWCook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants