How do I access redis values of keys stored from elsewhere

So I’m inserting data into a redis url in an external script via a cron.

I want to read this in Django 4.1.7.

A simple print("name = ", cache.get('name')) doesn’t work.

Because if I do in my

cache.set('name', 'John')
print("name = ", cache.get('name'))

works as it stores it in the Redis cache as :


So how do I get just name stored from elsewhere ?

I am using upstash.

Looking up the source code from django, i had found the default_key_func on django/core/cache/backends/ this function is used by the BaseBackend class also defined later on that file. This is the base class for all backends, and on the RedisBackend defined on django/core/cache/backends/ on the set method, it will make use of this key.

This function will use the make_default_key function that creates a namespace around the key, so on that case name can be something like: 1:name where 1 prefix is the version (this parameter is the default when you call set, without the version argument), considering that the KEY_PREFIX is the default (a empty string).
You can provide a custom function to make the key, this is documented here

For the time-being to make it work I did in my file r = redis.Redis(...)