ReadOnlyError Redis in django aplication

i have a Django application that uses redis as a cache. i’m facing a problem that I don’t know the cause of:

ReadOnlyError at /agenda/2025/3/10/

You can't write against a read only replica.

restarting the Docker container solves the problem, but I’d like to find the cause so I don’t have to do this every time the error occurs. docker-compose:

...
  redis:
    image: redis:latest 
    container_name: recinto_redis
    ports:
      - "6379:6379"
    networks:
      - recinto_network
    restart: always
...

settings.py:

CACHES = {
        "default": {
            "BACKEND": "django.core.cache.backends.locmem.LocMemCache",
        },
        "select2": {
            "BACKEND": "django_redis.cache.RedisCache",
            "LOCATION": "redis://localhost:6379/0",
            "OPTIONS": {
                "CLIENT_CLASS": "django_redis.client.DefaultClient",
            },
        },
    }