This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.sessions.backends.base import SessionBase, CreateError | |
from django.conf import settings | |
from django.utils.encoding import force_unicode | |
import redis | |
class SessionStore(SessionBase): | |
""" Redis store for sessions""" | |
def __init__(self, session_key=None): | |
self.redis = redis.Redis( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To use the two-layer cache: | |
* Run memcached on each Django webserver | |
* Add "LOCAL_CACHE_ADDR = ('127.0.0.1:11211',)" to settings.py | |
* Replace "from django.core.cache import cache" with "from dualcache import cache" everywhere | |
you want to use the two-layer cache. It can be freely mix and matched with Django's default caching. |