I am developing an application in which user can add, delete , retrieve or update the transactions. I want to store transactions data in the redis cache based storage to improve the performance, what steps should I follow to achieve this?
-
Did you read the very comprehensive docs on caching?Daniel Roseman– Daniel Roseman2017-02-05 17:48:10 +00:00Commented Feb 5, 2017 at 17:48
-
Yes, some comprehensive knowledge I have acquired by reading some docsAbhishek Jindal– Abhishek Jindal2017-02-05 17:52:18 +00:00Commented Feb 5, 2017 at 17:52
-
But I was not able to link the Django project to the Redis server and How I can use List or Sorted Sets of Redis in DjangoAbhishek Jindal– Abhishek Jindal2017-02-05 17:53:06 +00:00Commented Feb 5, 2017 at 17:53
Add a comment
|
2 Answers
I highly recommend you to check out cacheops django package.
https://github.com/Suor/django-cacheops
It has build in functionality for automatic/manual query/view/template sections/function caching as well as get/set primitives for simple cache by key.
2 Comments
Abhishek Jindal
Like If I have to use Hash data type of redis in Django project, How can I use that?
Alex T
Cacheops is a caching lib for general purposes usage. It provides very simple cache abstractions but there is no low level redis functionaity here. If you want to use specific redis components or implement caching strategies on your own you should use something else.
There is a Django Redis package that might help you.
If you want to automatically cache all querysets (e.g. on SELECT ... operations) you may also use this package with django-redis as a cache backend. Both of above will work with Django Rest Framework.