4

In Panels, one can configure caching for blocks/content panes/etc. The built-in method is Simple Cache, for which two settings can be configured: Lifetime and Granularity.

For Lifetime, one can choose a value from 15 sec to 7 days.

Is this lifetime a minimum or a maximum? In other words, if I set the Lifetime to 7 days for a content pane, will that content pane be cached for 7 days no matter what? Or will it be cached for 7 days unless it is updated?

1 Answer 1

5

Simple cache, is unfortunately not very clever, hence the name "Simple".

A 7 day cache will be cleared when the first request past the 7 day mark occurs, so it is the minimum lifetime of the cache.

The reason that it isn't smarter than that, is probably that content panes can come in a great deal of forms, and it's not trivial to implement a generic solution to knowing "When something was updated".

Continuing on that, I've implemented Panels cache which attempts to be smarter, but is limited to Content panes based on an entity context. It considers the cache lifetime to be infinitely long, but clears it when the entity that is the context is updated.

It's not terribly well tested, but it was written for a paying client that had it running in production without issues or complaints at least for the months I worked with them.

2
  • 1
    I have resorted to manually blasting cache bins via hook_node_insert, hook_node_update, hook_nodequeue_add, etc, for handling the sitation, too. Sledgehammer for the fly, but it works.
    – mpdonadio
    Aug 23, 2013 at 19:28
  • 1
    That's essentially what the Panels cache module, linked in the answer, does, although it tries to be entity generic. :)
    – Letharion
    Aug 24, 2013 at 0:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.