From f5cb2180b60a9a687261547cc47674b6500c1ce5 Mon Sep 17 00:00:00 2001 From: Arthur Vuillard Date: Mon, 2 Nov 2015 17:28:46 +0100 Subject: [PATCH] improve doc --- docs/index.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/index.rst b/docs/index.rst index 2ed3a23..458b909 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -58,6 +58,19 @@ The cached decorator has another optional argument called ``unless``. This argument accepts a callable that returns True or False. If ``unless`` returns ``True`` then it will bypass the caching mechanism entirely. +.. warning:: + + When using ``cached`` on a view, take care to put it between Flask's + ``@route`` decorator and your function definition. Example:: + + @app.route('/') + @cache.cached(timeout=50) + def index(): + return 'Cached for 50s' + + If you reverse both decorator, what will be cached is the result of + ``@route`` decorator, and not the result of your view function. + Caching Other Functions -----------------------