Questions tagged [django-redis]

105 questions
3
votes
3 answers

How to add Redis Database in Django-1.9?

I Want to add Redis Database in Django-1.9, so i followed this documents for integration https://niwinz.github.io/django-redis/latest/ But i didn't find any clue on how to mention Database name in the settings, Here i want to mention Redis as a…
Srinivas 25
  • 63
  • 2
  • 6
3
votes
1 answer

Django Redis appends same annotaion on key

I am using Django-Redis to store some simple data. Everything works fine for me, but I am wondering why Django-Redis prepends to every key that I save the string :1:. SET Key and Value (working) cache.set("foo", "bar", timeout=100) GET Key and…
2
votes
1 answer

Django Redis cache get TTL (expire time)

Is it possible to get key's expire time in Django using Redis cache? Something like: from django.core.cache import cache cache.get_expire('mykey') # 300 (seconds) I tried: cache.ttl('my_key') getting an error AttributeError: 'RedisCache'…
2
votes
1 answer

ReadOnlyError in Django application with Redis and DjangoCannels

I have a Django app using DgangoChannels, Djangochannelrestframework. It establishes a websocket connection with ReactJS frontend. As channel layers I use Redis like that CHANNEL_LAYERS = { "default": { "BACKEND":…
Ivan
  • 121
  • 1
  • 9
2
votes
1 answer

Django Use multiple redis for caching

I have a Django project and i am using django-redis where I want to implement different types of caching, Caching search query Caching static pages Cache user Data (eg: online status) I can add different prefix for different kind of caching, but I…
wetler
  • 374
  • 2
  • 11
2
votes
1 answer

Error accessing AWS elasticache redis in cluster mode) + TLS Enabled from django service

I'm trying to connect AWS elasticache(redis in cluster mode) with TLS enabled, the library versions and django cache settings as below ====Dependencies====== redis==3.0.0 redis-py-cluster==2.0.0 django-redis==4.11.0 ======settings======= CACHES =…
2
votes
1 answer

Don't serialize and unserialize (Pickle and Unpickle) the data while reading and writing from redis

I am working in a system in which multiple code bases access the same redis instance, So while reading some data written from some other code base, in django framework, i am getting the following error. Traceback (most recent call last): File…
2
votes
1 answer

Django_redis lock fails with UnpicklingError

In one place of my code, I use django_redis to update cache with a lock: from django.core.cache import cache with cache.lock('hello'): # do stuff In another place, I check whether cache is not locked using: if not cache.get('hello'): # do…
t_tia
  • 556
  • 1
  • 4
  • 17
2
votes
1 answer

Share redis storage between multiple apps

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":…
Ali Sherafat
  • 3,506
  • 2
  • 38
  • 51
2
votes
1 answer

Working of @cache_page() decorator in django-redis-cache

I am using(trying) redis as a cache to my django app. This is how I am trying to do it. def postview(request): post_list = [] if cache.get("posts") == None: post_list = Post.objects.all() cache.set("posts", post_list,…
Luv33preet
  • 1,686
  • 7
  • 33
  • 66
1
vote
0 answers

Redis connection scheduled to be closed ASAP for overcoming of output buffer limits

I have some celery tasks that run on VMs to run some web crawling tasks. Python 3.6, Celery 4.2.1 with broker as Redis (self-managed). The same Redis server is used for caching and locks. There are two relevant tasks: 1. job_executor: This celery…
Prashant Sengar
  • 506
  • 1
  • 7
  • 24
1
vote
0 answers

does django-redis support retry on TimeOut Exception while doing CRUD operation on Redis?

I am using the django-redis package version (4.12.1), I am getting a TimeOut Exception(Intermittent issue) while reading data from the Redis cache, I would like to Retry for some N number of times to fetch the data I tried using these settings but…
1
vote
1 answer

Redis GRAPH | unable to set TTL to the node and edge created in redis graph via python

I am using redis graph in my django project to save huge number of data nodes. I am not able to set the expire time of these nodes so the redis data keeps on increasing. I do not want to set a TTL in configuration as different nodes can have…
1
vote
0 answers

Does Django open and close connection to cache every time I call cache.delete(key)?

Consider the following code snippet: from django.core.cache import cache cache.delete('key_1') cache.delete('key_2') If i'm using an Instance of Redis as my default cache, will Django create two seperate connections to the Redis instance, for each…
Scratcha
  • 1,359
  • 1
  • 14
  • 22
1
vote
1 answer

Using fakeredis in a Django development settings file?

My Django settings.py file contains the following configuration options: # Caches CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.redis.RedisCache', 'LOCATION': 'redis://redis:6379', } } # Queues RQ_QUEUES =…
Scratcha
  • 1,359
  • 1
  • 14
  • 22