Delete a custom cache when admin clean content view cache

Author Message

Jerome Despatis

Thursday 25 August 2011 10:20:50 am

Hello,

An extension is creating a feed, and use a cache for that, that I store somewhere in var/ezwebin_site/cache/myfeeds

But if the admin clean the content view cache, my cache are not deleted, and I would like them to be (as my feed links towards some content)

Any idea how to 'register' a cache to be deleted whenever the admin deletes the content view cache?

Thanks for your help

Carlos Revillo

Thursday 25 August 2011 10:37:21 am

Hi Jerome. not really what you want, but probably you can define a new cache id and a php class that delete the files you want to. have a look at

https://github.com/ezsystems/ezpublish/blob/master/settings/site.ini#L17

you can then use php bin/php/ezcache.php --clear-id=myfeeds to delete those cache files.

Jerome Despatis

Thursday 25 August 2011 12:04:23 pm

Hey you mean it's exactly what I need :)

As my cache files are in a specific dir into cache, I don't need any class to make the purge (I just need to put path=mydir)

And in order to trigger the delete of the files, I add tags[]=content, therefore, when the content is deleted, then my cache is deleted also

As a result, here are the settings I was looking for:

[Cache]
CacheItems[]=djgeofeeds
[Cache_djgeofeeds]
name=djGeo feeds cache
id=djgeofeeds
tags[]=content
path=geofeeds

 

Thanks again crevillo, you answer quicker on the forum than on irc ;)

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.