I'm using this module with Varnish, and generally it's working great.

Normally I want node paths to be flushed when a node is updated, user paths to be flushed when a user is updated, etc... (which this module works great for).

However, there are some landing pages on my site that get a lot of views, that display content for many nodes (browse n latest nodes, for example this page). I don't want to these cached landing pages to flush every time a node is updated, because that would be too frequent... but I don't want them to be cached forever, either. Rather, I want pages like these to be flushed from cache every n hours (for example every 24 hours, or every 48 hours), using a wildcard pattern (so flush everything on example.com/browse/graphics|wildcard).

This kind of time-based expiration for certain paths seems fairly basic, so I'm wondering if I'm missing something...? Is there a way to do this out of the box with this module, or another contrib module? Or do I need to implement custom logic in a custom module to get this kind of functionality?

Comments

JordanMagnuson’s picture

Issue summary: View changes
Spleshka’s picture

Consider using Memcache Storage module for this purpose. Well, you will have to enable memcached on your server. But one of advantages in using of this module is advanced page cache handling. See documentation of page cache expirations at https://www.drupal.org/node/2448957. It doesn't allow you to configure custom expiration time for ALL pages. Currently no possibility to do this for several pages, but patches are welcome :)

JordanMagnuson’s picture

@Spleshka, thanks for the reply. Would you potentially accept a patch then that would add a tab to the expire settings for setting time-based expiration for some paths?

Spleshka’s picture

The problem here is that configuration of what you want most likely should be done in settings.php. Because time-based expiration better to do during setting a cache item into the cache backend - and $conf['cache_default_class'] variable is responsible for that.

Anyway, my answer to your question is YES. Just we need to make sure that your patch will bring a generic solution and adds to the module a new valuable use case.

JordanMagnuson’s picture

What I'm thinking is something that would run on cron, check the time requirement, and if n time has passed, expire whatever paths the user has indicated.

For example: I indicate that I want the following paths to be automatically expired every 24 hours:

  • blog|wildcard
  • browse/assets|wildcard
  • browse/templates|wildcard
  • browse/kits|wildcard
  • browse/layouts|wildcard
  • forums|wildcard

On cron, the expire module would check the 24 hours having elapsed since last flush, and if so, expire those paths (in the same way that it would otherwise be expiring paths on node update, comment insert, etc.)

Wouldn't something like that work?

Spleshka’s picture

Well, I think this could work. It would be nice if you will provide this as a sub-module for Cache Expiration, because this is not a core functionality.

JordanMagnuson’s picture

[Sorry for the late reply: was traveling the last week.]

When you say "sub-module," do you mean as a sub-module of Expire to be included in the same project, or do you mean as another separate contrib module that integrates with Expire?

Spleshka’s picture

Hey Jordan. I mean a sub-module of Expire to be included into the same project. Actually, if you want you are welcome to create a separate contrib and maintain it yourself. I'm happy with any of these two approaches and will support you anyway :)