|
|
|
|
|
by St-Clock
3324 days ago
|
|
"Don’t cache Django models" This is too broad to be good advice. A typical solution to stale models is to increment a cache version key, effectively invalidating the old cache. Version keys can be coarse- or fine-grained. For example, you may have one version key for the entire application (supported by Django by default) and one version key per model or application (you have to roll your own solution). If your app's models change, you can increment the app version key and the next time you try to fetch a model instance from the cache, you will miss and instead fetch the instance from the DB. |
|