예제 #1
0
 /**
  * Changes prefix for all entries given key prefix
  *
  * @param string $sourcePrefix
  * @param string $targetPrefix
  *
  * @return bool true if successful
  */
 public function changePrefix($sourcePrefix, $targetPrefix)
 {
     $sourceCachePath = $this->createCachePath($sourcePrefix, true);
     if (!$this->backend->hasDirectory($sourceCachePath)) {
         return false;
     }
     $targetCachePath = $this->createCachePath($targetPrefix, true);
     return $this->backend->rename($sourceCachePath, $targetCachePath);
 }
 /**
  * Saves the resized image in backend
  *
  * @return bool true if saved successfully
  */
 public function save()
 {
     if (!$this->backend->hasDirectory($this->getDirectory())) {
         $this->backend->createDir($this->getDirectory());
     }
     $saved = $this->backend->put($this->getFilePath(), $this->resizedImageData);
     if ($saved) {
         $this->timestamp = time();
     }
     return $saved;
 }