Opened 4 years ago

Closed 4 years ago

#31794 closed Uncategorized (worksforme)

NotImplementedError: subclasses of BaseCache must provide a touch() method

Reported by: Robin Owned by: nobody
Component: Core (Cache system) Version: 3.1
Severity: Normal Keywords: cache
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I am getting the following exception when trying to call cache.touch() method.

File "PROJECT_PATH/.venv/lib/python3.8/site-packages/django/core/cache/backends/base.py", line 135, in touch
    raise NotImplementedError('subclasses of BaseCache must provide a touch() method')
NotImplementedError: subclasses of BaseCache must provide a touch() method
# settings.py

CACHES = {
    "default": {
        "BACKEND": "django.core.cache.backends.locmem.LocMemCache",
        "LOCATION": "unique-snowflake",
    }
}

#tasks.py
from django.core.cache import cache


def test():
    ...
    cache.touch("session_cache_ffff0000", 1500)
   ...

Change History (1)

comment:1 by Mariusz Felisiak, 4 years ago

Resolution: worksforme
Status: newclosed

touch() works for me with LocMemCache. I cannot reproduce this issue.

Note: See TracTickets for help on using tickets.
Back to Top