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

Knowing if a cache from the cluster is valid or not, whatever the backend used

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • 4.2011
    • None

    Description

      This enhancement is from discussion on the forum here:
      http://share.ez.no/forums/developer/problem-with-ezfs2filehandler

      In fact I need to know if a file in the cluster is valid or not.
      With eZFSFileHandler, it's not a problem, as the delete process really deletes the file on the disk, and exists() will therefore return false
      => So for this backend, knowing if a cache is valid is easy, just uses the exists() or fileExists() method)

      But on the other backends, eZFS2FileHandler, eZDBFileHandler, the deletion seems to consist in not really delete the cache, but instead just changing the mtime
      (mtime to a negative value for eZDBFileHandler, and mtime to a specific value in the past for eZFS2FileHandler)

      As a result, after deletion, the file still exists, and exists() method returns true, but the cache is not usable

      I've been looking for a method to know if the cache is valid, but for now I haven't found, I'm certainly wrong, so please tell me what to use from the API ?

      Or if it doesn't exist, why not add a isValid() and isFileValid() methods ?

      in kernel/classes/clusterfilehandlers/ezfsfilehandler.php (that ezFS2FileHandler extends), and in kernel/classes/clusterfilehandlers/ezdbfilehandler.php code could be:

      function isValid()
      {
          return $this->exists() && !$this->isExpired( -1, time(), null );
      }
      
      function isFileValid( $path )
      {
          return $this->fileExists() && !$this->isFileExpired( $path, @filemtime($path), -1, time(), null );
      }
      

      Attachments

        Activity

          People

            unknown unknown
            enzo enzo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: