Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-12860

A noninvasive (non-hack) way of extending the cache clear list

    Details

      Description

      I would postulate for a noninvasive (non-hack) way of extending the cache clear list. I mean the list that can be found in kernel/classes/ezcache.php in fetchList() method.

      We create more and more extensions that have their own cache, and it would be great, if those extensions could automatically extend the administration interface's clear list (thus making it manageable without custom clear solutions).

        Issue Links

          Activity

          Hide
          André R added a comment -

          Online Editor 5.0 would also benefit from this, so it would be possible to clear the stylesheets and javascript cache it generates.

          Show
          André R added a comment - Online Editor 5.0 would also benefit from this, so it would be possible to clear the stylesheets and javascript cache it generates.
          Hide
          Kristof Coomans added a comment -

          Steps to take after a first look:

          1. Define a PHP Interface which needs to be implemented by cache clearing classes.

          2. Move out the different items in the array returned from eZCache::fetchList() to separate cache clearing classes (in case custom functions need to be used), and/or to INI settings.

          3. Move out all custom functions to their corresponding class.

          Show
          Kristof Coomans added a comment - Steps to take after a first look: 1. Define a PHP Interface which needs to be implemented by cache clearing classes. 2. Move out the different items in the array returned from eZCache::fetchList() to separate cache clearing classes (in case custom functions need to be used), and/or to INI settings. 3. Move out all custom functions to their corresponding class.
          Hide
          André R added a comment - - edited

          Not the way kc suggested, but anyone having any objections against this approach? (site.ini setting to map to cache items):

          [Cache]
          # Array with cache items to extend ezcache
          CacheItems[]
           
          # Example of use:
          #CacheItems[]=custom
          #
          #[Cache_custom]
          #
          # [optional] Name of the cache item, key (custom) is used camel-cased if not set
          #name=Custom cache
          # [optional] Id of cache item, to be used from command line, key (custom) is used if not set
          #id=custom
          # [optional] If cache item should be cleared using cluster instead of plain file handler, def: false
          #isClustered=true
          # [optional] tags that will trigger clearing of this item, default: empty array
          #tags[]=content
          #tags[]=custom
          # [optional] If cache uses eZExpiryHandler, then this is the key to get expiry time
          #expiryKey=global-custom-cache
          # [optional] (bool) If this cache is enabled or not, default: true
          #enabled=false
          # [optional] Path where cache is stored, either directory or file if class/purgeClass
          # variables are unset, relative to current cache directory is assumed
          #path=custom_cache.php
          # [optional] custom cache clear function "<class>::clearCache()" to be called  
          #class=eZSomeClassName
          # [optional] custom cache purge function "<class>::purgeCache()" to be called
          #purgeClass=eZSomeClassName
          

          Only thing here that implies a change to eZCache::clearItem is is_content_related, so this variable is defined in cache item instead of being hard coded to cache item id.

          Show
          André R added a comment - - edited Not the way kc suggested, but anyone having any objections against this approach? (site.ini setting to map to cache items): [Cache] # Array with cache items to extend ezcache CacheItems[]   # Example of use: #CacheItems[]=custom # #[Cache_custom] # # [optional] Name of the cache item, key (custom) is used camel-cased if not set #name=Custom cache # [optional] Id of cache item, to be used from command line, key (custom) is used if not set #id=custom # [optional] If cache item should be cleared using cluster instead of plain file handler, def: false #isClustered=true # [optional] tags that will trigger clearing of this item, default: empty array #tags[]=content #tags[]=custom # [optional] If cache uses eZExpiryHandler, then this is the key to get expiry time #expiryKey=global-custom-cache # [optional] (bool) If this cache is enabled or not, default: true #enabled=false # [optional] Path where cache is stored, either directory or file if class/purgeClass # variables are unset, relative to current cache directory is assumed #path=custom_cache.php # [optional] custom cache clear function "<class>::clearCache()" to be called #class=eZSomeClassName # [optional] custom cache purge function "<class>::purgeCache()" to be called #purgeClass=eZSomeClassName Only thing here that implies a change to eZCache::clearItem is is_content_related, so this variable is defined in cache item instead of being hard coded to cache item id.
          Hide
          Piotr Karaś added a comment -

          Looks good to me In which version do you plan to introduce it?

          Show
          Piotr Karaś added a comment - Looks good to me In which version do you plan to introduce it?
          Hide
          André R added a comment - - edited

          Implemented in
          trunk (4.3.0alpha1) rev. 24656 & 24700

          @Doc: see above for new site.ini settings.

          Show
          André R added a comment - - edited Implemented in trunk (4.3.0alpha1) rev. 24656 & 24700 @Doc: see above for new site.ini settings.
          Hide
          Geir Arne Waaler added a comment -

          Documentation required.

          Geir Arne Waaler
          eZ Documentation

          Show
          Geir Arne Waaler added a comment - Documentation required. Geir Arne Waaler eZ Documentation

            People

            • Assignee:
              André R
              Reporter:
              Piotr Karaś
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: