I am using redis
in a node
application for caching data and now i want to access and modify stored data using a django
application on the same server but i can't access to the data.
Django connection:
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/0",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
}
}
using keys *
command in terminal:
$ redis-cli
127.0.0.1:6379> keys *
1) "sess:Ok0eYOko5WaV7njfX04qgqG1oYe0xiL1" -> this key is set in node
2) ":1:from-django" -> this key is set in django
Accessing keys in django application:
keys = cache.keys('*')
print(keys) # prints only one key => ['from-django']
I can't access first key that is set in node application and also django stored keys are prifixed with :1:
by default!
I want to share all keys between node and django but they only access their own keys.
Any idea?
You can access all of data from any where, But you are working with Redis in Cache model! and all of Cache systems has own unique data structure, You must work with Redis in Database model and scan it yourself. Use Python Redis package to access all of Redis in your application.