I am trying to cache a view unless the user is logged in. current_user
only works inside a view though, so I'm having trouble passing it to unless=
. How do I do this correctly?
@app.route("/")
@app.cache.cached(timeout=300, unless=current_user.is_authenticated())
def index():
return 'stuff to return'