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

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Medium Medium
    • Resolution: Unresolved
    • Affects Version/s: 4.2011
    • Fix Version/s: None
    • Labels:
      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 );
      }
      

        Activity

        Hide
        Jerome Despatis added a comment -

        Well in some case, this problem is more a blocking code than a feature to implement
        => more info on this pull that tries to correct this problem:
        https://github.com/ezsystems/ezpublish/pull/262

        Show
        Jerome Despatis added a comment - Well in some case, this problem is more a blocking code than a feature to implement => more info on this pull that tries to correct this problem: https://github.com/ezsystems/ezpublish/pull/262

          People

          • Assignee:
            unknown
            Reporter:
            Jerome Despatis
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: