Open weotch opened 10 years ago
To tell Apache to NOT use the cache, the freezer-skip
cookie needs to be present. The freezer-skip
cookie would need to be added when the user logs in. Maybe with an API like:
Freezer::disable()
The current conditionallyCache()
would delete the freezer-skip
on the next request though. I think maybe we save a session variable like freezer_disable => true
. This is set when Freezer::disable()
is called. conditionallyCache()
does not delete the freezer-skip
if that variable is present. When the user logs out again, the dev calls:
Freezer::enable()
That would clear the freezer_disable
session var, restoring Freezer to it's normal behavior.
Thus, we don't need a callback registration thing. Updating the ticket title.
To summarize the changes:
Freezer::disable()
freezer-skip
cookiefreezer::disable_skip
session var. Which is checked for by conditionallyCache()
.Freezer::enable()
freezer::disable_skip
session var@sdaves, you think this would solve for your use case?
It just may! Can you commit the changes to a branch so I can test it?
Robert Reinhard notifications@github.com wrote:
@sdaves, you think this would solve for your use case?
Reply to this email directly or view it on GitHub: https://github.com/BKWLD/freezer/issues/21#issuecomment-32197072
Ok, try the above commit out, found in the toggle-api
branch.
Works perfectly :)
Nice, I'll merge it into master.
Inspired by the conversation in #20.
The idea is that you could register a callback function that would be used to determine whether to cache the current request.