Come utilizzare 2 diversi backend della cache in Django?
-
07-11-2019 - |
Domanda
Devo usare la cache memcached e basata su file. Imposta la mia cache nelle impostazioni:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': 'c:/foo/bar',
},
'inmem': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
Il manichino è temporaneo. Docs dicono:
cache.set('my_key', 'hello, world!', 30)
cache.get('my_key')
Ok, ma come posso ora impostare e ottenere la cache solo per backend di cache 'inmem' (in futuro memcached)? La documentazione non menziona come farlo.
Nessuna soluzione corretta
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow