Hi there,

I've got a need to build a Manual purge admin form, similar to what Aquia purge module offers. The Aquia purge module provides this form as a way for admins to manually purge URL's from the Acquia Varnish cache layer. The site that I'm working on uses both Varnish and Akamai, so the Acquia purge Manual Purge admin form isn't enough.

I'm going to set out to build said form, based on the interface that Acquia purge offers, and triggering a ExpiresAPI::executeExpiration($internal_paths), which will kick off expiring the cache, just like the expire-url and expire-path drush commands do.

Any thoughts? Would there be interest in including this kind of a feature? Any gotchas for me to watch for?

Thanks,
Matt

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

m4olivei’s picture

Here's an initial go at it against 7.x-2.0-rc3. Will re-roll against dev once I've worked out the kinks and have a moment.

Spleshka’s picture

Hi @m4olivei. I would suggest you to build manual purge with help of Rules and Rules link modules. In the Rules you can create a new action with urls that should be expired, and Rules Link will help you to trigger expiration by click on the link.

Correct me if I am wrong, but those modules together do more or less the same that you want to commit to Cache Expiration module.

m4olivei’s picture

Revised patch to allow the admin to limit cache expiration by implementing module.

m4olivei’s picture

@Spleshka thanks for the feedback. That's a great suggestion that may work for some use cases. However, here, what we're looking for is way for an admin to trigger expiration on a manual list of URLs when and if they are seeing stale URLs that they need to purge immediately. From what you suggested with Rules and Rules Link, it sounds like you'd have to pre-set a list of URL's for the link to expire. Additionally, the site I'm working on doesn't have Rules enabled, and enabling it for such a small feature feels like overkill.

The desire to add this feature was inspired by Acquia Purge module. That module has a manual expiration form, which is very useful. However, the site I'm working on also uses Akamai, so it makes a lot of sense to make a Manual Expire form that affects both Akamai and Acquia Purge (and any other module implementing hook_expire_cache).

m4olivei’s picture

Slight change to consider the case when there are no modules on the site that implement hook_expire. It's an odd case, but sometimes in a test or local environment, your CI might disable cache modules, which makes for an empty checkboxes field on the Manual Expire form.

m4olivei’s picture

Revised to be even simpler. I had modeled the admin interface by Acquia Purge's interface. Instead opted for a simple textarea where you can enter URLs to purge one per line.

Spleshka’s picture

Status: Active » Needs work

Hi @m4olivei. Sorry for a very long time to response, I've been incredibly busy the latest few months.

Talking about your idea - I like it! The only thing that stops me from commiting this right now is that it is not a core competence of this module and I am not a fan of putting all features into one module. If you will move your feature to the separate submodule - I'd be happy to commit it.

m4olivei’s picture

@Spleshka no worries for the long response, I totally get it :).

If you will move your feature to the separate submodule - I'd be happy to commit it.

Which submodule do you mean? I don't see an existing one in the project. Are you suggesting I start a new submodule, maybe called expire_ui?

Spleshka’s picture

Currently the module doesn't have any submodules, that's true. I mean that we could create a new one, for example expire_manual and put it to /modules/expire_manual folder.

Unfortunately, expire_ui is not a best name, because expire module already has UI out of the box :)

m4olivei’s picture

Thanks for clarifying. Sounds good, I'll post when I get time to work on it.

Spleshka’s picture

Awesome, thanks! Looking forward to review your patch.

Pere Orga’s picture

Hi,

FWIW there is now a module that does this: https://www.drupal.org/project/expire_admin

Pere Orga’s picture

(Form for purging arbitrary URLs was implemented in https://www.drupal.org/node/2721273)