django-cache-machine with Redis

137 views
Skip to first unread message

Alan Johnson

unread,
Mar 29, 2013, 12:56:13 AM3/29/13
to django...@googlegroups.com
How does one configure this?  The documentation only explains how to use locmem or memcached, and yet the commit logs reference Redis multiple times, so it must be doable. Does anybody have any advice or experience with this?

Mike Megally

unread,
Apr 23, 2014, 9:29:55 PM4/23/14
to django...@googlegroups.com
Did you figure this out? I'm currently in the same situation.

Ramón Carrillo

unread,
Apr 24, 2014, 12:30:49 PM4/24/14
to django...@googlegroups.com
Hi Mike,

You need a cache backend, you can write it by yourself [0] or use an
existing one [1,2]

[0] https://docs.djangoproject.com/en/1.6/topics/cache/#using-a-custom-cache-backend
[1] https://github.com/niwibe/django-redis
[2] https://github.com/sebleier/django-redis-cache
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e147c975-33e9-466d-81f0-8b3949330b18%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Mike Megally

unread,
Apr 24, 2014, 1:20:27 PM4/24/14
to django...@googlegroups.com
Thanks! I got the redis cache set up. What is worrying me is that django-cache-machine says that you need to use one of its backends for caching and django-cache-machine doesn't come with one for redis. Just memcache and localmem. I'm wondering if its safe to just use the redis cache i've setup.

Ramón Carrillo

unread,
Apr 24, 2014, 10:44:04 PM4/24/14
to django...@googlegroups.com
Oh, my mistake. I did miss the django-cache-machine part.

Anyway, from the sources it seems supported and dependant on
django-redis-cache [0,1]. So, you should installed first.

According to a commit message [0] and an example [2], this should be
in your settings.py:

CACHE_MACHINE_USE_REDIS = True
REDIS_BACKEND = 'redis://host:port?opt=val'

REDIS_BACKEND value should be parsable by django-redis-cache.

Have you tried this?

Bear in mind that the commit is rather old, and the REDIS_BACKEND
should be in a format intended for Django 1.3 [3]. Maybe, it's
undocumented because it doesn't work anymore.

[0] https://github.com/jbalogh/django-cache-machine/commit/c8af02142999629c561ec6a4ccd4268a621bd607
[1] https://github.com/jbalogh/django-cache-machine/blob/master/caching/invalidation.py
[2] https://github.com/jbalogh/django-cache-machine/blob/master/examples/cache_machine/redis_settings.py
[3] https://github.com/sebleier/django-redis-cache#usage
> https://groups.google.com/d/msgid/django-users/86df6e91-edc8-425c-bb8d-204b46ef3cb7%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages