我的缓存设置,
CACHES = {
"default": {
"BACKEND": "util.redis.ExtendedCache",
"LOCATION": "redis://%s:%i/1" % (REDIS_HOST, REDIS_PORT),
"TIMEOUT": 7 * 24 * 60 * 60, # One week in seconds
"OPTIONS": {
"SOCKET_TIMEOUT": 1,
"CLIENT_CLASS": "util.redis.ExtendedClient",
"CONNECTION_POOL_KWARGS": {"max_connections": 1},
"SERIALIZER": "util.redis.FailsafePickleSerializer",
},
},
}
当我在视图函数中执行以下操作时,
from django.core.cache import cache
cache.set(key, value)
当我在 shell 中查询相同的内容时,它没有返回任何内容,
cache.get(key) # returns nothing!