How to clear the whole cache when using django's page_cache decorator

后端 未结 3 1229
伪装坚强ぢ
伪装坚强ぢ 2021-02-03 23:21

I\'ve got a pretty simple site where I\'m using the page_cache decorator. I have a cronjob that checks for new data and processes it if it\'s available. (This is r

3条回答
  •  执笔经年
    2021-02-04 00:01

    Put something into cache, then try to call cache.clear() from the manage.py shell console and then manually check database cache contents. If that works then maybe your cache.clear() is just not called when new data is found.

    The easiest way to understand what is going under the hood is just to put import pdb; pdb.set_trace() to the beginning of the cache.clear() function, then run debug server and wait, then some code call this func you'll be able to execute step-by-step its code or you'll just see that this func is not called as your expected.

提交回复
热议问题