I have a Django project and i am using django-redis where I want to implement different types of caching,
- Caching search query
- Caching static pages
- Cache user Data (eg: online status)
I can add different prefix for different kind of caching, but I want to use different redis server for all the different caching I have. I couldn't find anything on the docs how to do this
My current settings
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://localhost:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"PARSER_CLASS": "redis.connection.HiredisParser",
"IGNORE_EXCEPTIONS": True,
},
"KEY_PREFIX": "db_cache",
}
}
What I would want
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://localhost:6379/",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"PARSER_CLASS": "redis.connection.HiredisParser",
},
"KEY_PREFIX": "db_cache",
},
'static_page': {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://localhost:6378/",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"PARSER_CLASS": "redis.connection.HiredisParser",
"IGNORE_EXCEPTIONS": True,
},
"KEY_PREFIX": "db_cache",
},
'user_data': {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://localhost:6377/",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"PARSER_CLASS": "redis.connection.HiredisParser",
},
"KEY_PREFIX": "db_cache",
}
}