search

Home  >  Q&A  >  body text

python2.7 - When using django-redis, the data in redis cannot be accessed after connecting?

Using dango-redis, when using redis for caching, the data in redis cannot be accessed
Configuration items:

Data in redis

function in views:

Ask God for guidance

曾经蜡笔没有小新曾经蜡笔没有小新2839 days ago1023

reply all(1)I'll reply

  • 迷茫

    迷茫2017-05-16 13:20:41

    The reason is predicted to be that you directly use django cache to perform the get operation. The get function will do some conversion on the key internally. As for the specifics, you still need to test and track it yourself

    1 When getting the value, the key will be converted internally, that is

    key = self.make_key(key, version=version)

    That is, if the key is test2, the converted key is :1:test2. When you use the converted key to obtain it from your cache service, it will be empty

    2 You can use ipython to set a value and then test whether get is ok

    reply
    0
  • Cancelreply