Opened 5 years ago
Closed 5 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)
...
Note:
See TracTickets
for help on using tickets.
touch()works for me withLocMemCache. I cannot reproduce this issue.