3

I have a Django installation that uses the FileSystem caches. The caching system is used by an array of different views. Putting in place various logs to log when a key is not found in the cache and hence regenerated, I've found out that often the keys are lost. I don't have any "cache delete" in place and all the keys are stored to last 24 hours, but in the logs they all appear to be regenerated once in a while.

Is there any hidden parameter like "don't store more than n keys" or "more than n megabytes of data" or something? I'm a bit lost because it just seems that the keys are lost and I don't know when and why.

Also, I originally chose as cache location "/tmp/django-cache", so I thought that maybe the tmp directory was being cleaned by Linux, but changing the location to a "safer" one in my home directory doesn't change the anomaly.

Also, the full cache directory is around 25Mb, so I don't think there is something cleaning it up because it's too big.

Any idea?

pistacchio
  • 56,889
  • 107
  • 278
  • 420

1 Answers1

3

The maximum number of items allowed in the cache before old values are deleted for locmem, filesystem and database backends is 300. You can change it by setting OPTIONS > MAX_ENTRIES.

From the Django documentation:

MAX_ENTRIES: The maximum number of entries allowed in the cache before old values are deleted. This argument defaults to 300.

Selcuk
  • 57,004
  • 12
  • 102
  • 110