linuxapt-get install redis-serverpip 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-cliINFO
时间: 2024-10-17 13:51:45