Setting a TTL for CACHE_PERMANENT

Events happening in the community are now at Drupal community events on www.drupal.org.
digi24's picture

Hello,

I am currently experimenting with different cache strategies and came across the following question:

Is it problematic, ignoring cache fragmentation issues, if I enforce a general TTL on CACHE_PERMANENT items, eg. purging every item x hours after its creation?

Clearly, just purging the whole cache does not create any problems, but are there any known problems when cached items disappear one by one?

Thanks,
martin

Comments

If by "cache" here you're

Garrett Albright's picture

If by "cache" here you're referring to Drupal's cache tables, then no, this will never cause a problem (unless someone is writing really bad code).

I'm curious as to why you think doing this would improve performance, though. Things that are cached are cached for a reason.

I'm curious as to why you

digi24's picture

I'm curious as to why you think doing this would improve performance, though. Things that are cached are cached for a reason.

I do not necessarily think it would improve performance, I have however noticed that some modules unnecessarily use permanent caches or do not implement the cache clearing hooks properly. While these issues are clearly to be fixed within the modules, something can always be overlooked.

At the same time inspecting the cache tables stored in other engines than the database is often a complicated task requiring me to write little helper functions to display the contents. Some cache engines may further behave in a suboptimal way when their capacity is reached (eg. apc) or grow unnecessarily (mongodb). Enforcing a general TTL would mitigate these issues.

If you ever come across a

Garrett Albright's picture

If you ever come across a contrib module which doesn't seem to be caching right, please file an issue and notify the coder about your case. Often times the coders are just individuals who aren't using the code in high-performance situations and may not be aware of all the effects of their code in such situations. I say this as one such coder.

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: