librelist archives

« back to archive

Memcached through flask/werkzeug

Memcached through flask/werkzeug

From:
Knacktus
Date:
2012-10-23 @ 15:12
Hi guys,

would you recommend using memcached via flask/werkzeug or directly with 
python-memcached? (python-memcached is the only memcached client that's 
available at my production machines.)

Why is there a werkzeug.contrib.cache module? I guess it has to do with 
the way a python app is invoked by the web-server? Documentation says 
something about creating an object and keeping it around. (I don't know 
much about this stuff (wsgi, etc.) yet)

Cheers,

Jan

Re: [flask] Memcached through flask/werkzeug

From:
Bastian Hoyer
Date:
2012-10-23 @ 15:38
The advantage of using the werkzeug cache classes is that you can switch 
the backend system, turn caching off or use memory cache in development if
you want.
If you know that you never will use something else like redis you can use 
the memcache library directly.

-- 
Bastian Hoyer


Am Dienstag, 23. Oktober 2012 um 17:12 schrieb Knacktus:

> Hi guys,
> 
> would you recommend using memcached via flask/werkzeug or directly with 
> python-memcached? (python-memcached is the only memcached client that's 
> available at my production machines.)
> 
> Why is there a werkzeug.contrib.cache module? I guess it has to do with 
> the way a python app is invoked by the web-server? Documentation says 
> something about creating an object and keeping it around. (I don't know 
> much about this stuff (wsgi, etc.) yet)
> 
> Cheers,
> 
> Jan 

Re: [flask] Memcached through flask/werkzeug

From:
Steven Kryskalla
Date:
2012-10-23 @ 15:41
On Tue, Oct 23, 2012 at 8:12 AM, Knacktus <knacktus@googlemail.com> wrote:
> Why is there a werkzeug.contrib.cache module? I guess it has to do with
> the way a python app is invoked by the web-server? Documentation says
> something about creating an object and keeping it around. (I don't know
> much about this stuff (wsgi, etc.) yet)

werkzeug.contrib.cache just provides a common API to many different
cache backends (in-memory, memcached, redis, flat files, etc.) so you
can switch between the implementations without maintaining two sets of
code (e.g. use in-memory cached for development, then switch to
memcached in production).

The object you create with werkzeug.contrib.cache is treated the same
as a memcache.Client. You should create it during app startup and keep
it around for use while the app is running.

-steve

Re: [flask] Memcached through flask/werkzeug

From:
Sean Lynch
Date:
2012-10-23 @ 16:14
I've used this with great success - http://packages.python.org/Flask-Cache/

On Tue, Oct 23, 2012 at 11:41 AM, Steven Kryskalla <skryskalla@gmail.com>wrote:

> On Tue, Oct 23, 2012 at 8:12 AM, Knacktus <knacktus@googlemail.com> wrote:
> > Why is there a werkzeug.contrib.cache module? I guess it has to do with
> > the way a python app is invoked by the web-server? Documentation says
> > something about creating an object and keeping it around. (I don't know
> > much about this stuff (wsgi, etc.) yet)
>
> werkzeug.contrib.cache just provides a common API to many different
> cache backends (in-memory, memcached, redis, flat files, etc.) so you
> can switch between the implementations without maintaining two sets of
> code (e.g. use in-memory cached for development, then switch to
> memcached in production).
>
> The object you create with werkzeug.contrib.cache is treated the same
> as a memcache.Client. You should create it during app startup and keep
> it around for use while the app is running.
>
> -steve
>

Re: [flask] Memcached through flask/werkzeug

From:
Mark Steve Samson
Date:
2012-10-23 @ 15:30
You should checkout https://github.com/core/cachecore 

-- 
Steve


On Tuesday, October 23, 2012 at 10:12 PM, Knacktus wrote:

> Hi guys,
> 
> would you recommend using memcached via flask/werkzeug or directly with 
> python-memcached? (python-memcached is the only memcached client that's 
> available at my production machines.)
> 
> Why is there a werkzeug.contrib.cache module? I guess it has to do with 
> the way a python app is invoked by the web-server? Documentation says 
> something about creating an object and keeping it around. (I don't know 
> much about this stuff (wsgi, etc.) yet)
> 
> Cheers,
> 
> Jan