MIDDLEWARE = ['django.middleware.cache.UpdateCacheMiddleware','django.middleware.common.CommonMiddleware','django.middleware.cache.FetchFromCacheMiddleware',# 三项放在中间最上面]CACHE_MIDDLEWARE_SECONDS =60# default cache time for the whole websiteCACHES ={"default":{"BACKEND":"django_redis.cache.RedisCache","LOCATION":"redis://redis:6379/1",# "LOCATION": "redis://password@redis:6379/1", # 方法一:Add Password 'TIMEOUT':60,# default expire time per api call"OPTIONS":{"CLIENT_CLASS":"django_redis.client.DefaultClient","SOCKET_CONNECT_TIMEOUT":5,# in seconds"SOCKET_TIMEOUT":5,# r/w timeout in seconds'MAX_ENTRIES':10000,'KEY_PREFIX':'recruit-',#'PASSWORD': 'password', # 方法二:Add Password }}}
# 适合开发MIDDLEWARE = ['django.middleware.cache.UpdateCacheMiddleware','django.middleware.common.CommonMiddleware','django.middleware.cache.FetchFromCacheMiddleware',# 三项放在中间最上面]CACHE_MIDDLEWARE_SECONDS =60# default cache time for the whole websiteCACHES ={'default':{'BACKEND':'django.core.cache.backends.locmem.LocMemCache','LOCATION':'unique-snowflake','TIMEOUT':60,'OPTIONS':{'MAX_ENTRIES':10000,'KEY_PREFIX':'recruit-',}}}