django-redis

linux
apt-get install redis-server
pip install django-redis

vim /etc/redis/redis.conf

maxmemory 20mb


settings.py

CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
}
}
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
SESSION_CACHE_ALIAS = "default"


/etc/init.d/redis-server restart

redis-cli
INFO

你可能感兴趣的:(django-redis)