0

I have the settings cache and my TIMEOUT not working. My cache never do update.

CACHES = {
    'default': {
        'BACKEND': 'redis_cache.cache.RedisCache',
        'LOCATION': 'localhost:6379',
        'TIMEOUT': 5,
        'OPTIONS': {
            "SOCKET_CONNECT_TIMEOUT": 5,  # in seconds
            "SOCKET_TIMEOUT": 5,  # in seconds
            'DB': 1,
            'PASSWORD': '',
            'PARSER_CLASS': 'redis.connection.HiredisParser',
            'PICKLE_VERSION': 2,
        },
    },
}
4
  • if you are expiring items in the cache after 5 seconds, that means you shouldn't be caching anything at all Commented Feb 2, 2017 at 12:28
  • but this is problem, I set 5 seconds for test, but not import the time, he don't cache anything. Commented Feb 2, 2017 at 12:34
  • one place your say " My cache never do update." and then you say "he don't cache anything" which one is it? Commented Feb 2, 2017 at 12:36
  • The problem and the following, my cache stored the information, days later I made some insertions and deletes in the database, but it did not catch those changes. Commented Feb 2, 2017 at 12:38

1 Answer 1

1

everyone my problem has been solved with django-rest-framework-cache. It seems that django-redis-cache is having trouble understanding the timeout.

https://github.com/Onyo/django-rest-framework-cache/blob/master/README.md

Sign up to request clarification or add additional context in comments.

1 Comment

I used that and it helped me a lot. Thank you very much.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.