00001 <?php 00025 require_once 'Zend/Cache/Backend/Interface.php'; 00026 00028 require_once 'Zend/Cache/Backend/ZendServer.php'; 00029 00030 00037 class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer implements Zend_Cache_Backend_Interface 00038 { 00045 public function __construct(array $options = array()) 00046 { 00047 if (!function_exists('zend_disk_cache_store')) { 00048 Zend_Cache::throwException('Zend_Cache_ZendServer_Disk backend has to be used within Zend Server environment.'); 00049 } 00050 parent::__construct($options); 00051 } 00052 00061 protected function _store($data, $id, $timeToLive) 00062 { 00063 if (zend_disk_cache_store($this->_options['namespace'] . '::' . $id, 00064 $data, 00065 $timeToLive) === false) { 00066 $this->_log('Store operation failed.'); 00067 return false; 00068 } 00069 return true; 00070 } 00071 00077 protected function _fetch($id) 00078 { 00079 return zend_disk_cache_fetch($this->_options['namespace'] . '::' . $id); 00080 } 00081 00088 protected function _unset($id) 00089 { 00090 return zend_disk_cache_delete($this->_options['namespace'] . '::' . $id); 00091 } 00092 00096 protected function _clear() 00097 { 00098 zend_disk_cache_clear($this->_options['namespace']); 00099 } 00100 }