• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/Zend/Cache/Backend/Test.php

00001 <?php
00027 require_once 'Zend/Cache/Backend/Interface.php';
00028 
00032 require_once 'Zend/Cache/Backend.php';
00033 
00040 class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
00041 {
00047     protected $_options = array();
00048 
00054     protected $_directives = array();
00055 
00061     private $_log = array();
00062 
00068     private $_index = 0;
00069 
00076     public function __construct($options = array())
00077     {
00078         $this->_addLog('construct', array($options));
00079     }
00080 
00087     public function setDirectives($directives)
00088     {
00089         $this->_addLog('setDirectives', array($directives));
00090     }
00091 
00103     public function load($id, $doNotTestCacheValidity = false)
00104     {
00105         $this->_addLog('get', array($id, $doNotTestCacheValidity));
00106         if ($id=='false') {
00107             return false;
00108         }
00109         if ($id=='serialized') {
00110             return serialize(array('foo'));
00111         }
00112         if ($id=='serialized2') {
00113             return serialize(array('headers' => array(), 'data' => 'foo'));
00114         }
00115         if (($id=='71769f39054f75894288e397df04e445') or ($id=='615d222619fb20b527168340cebd0578')) {
00116             return serialize(array('foo', 'bar'));
00117         }
00118         if (($id=='8a02d218a5165c467e7a5747cc6bd4b6') or ($id=='648aca1366211d17cbf48e65dc570bee')) {
00119             return serialize(array('foo', 'bar'));
00120         }
00121         return 'foo';
00122     }
00123 
00133     public function test($id)
00134     {
00135         $this->_addLog('test', array($id));
00136         if ($id=='false') {
00137             return false;
00138         }
00139         if (($id=='d8523b3ee441006261eeffa5c3d3a0a7') or ($id=='3c439c922209e2cb0b54d6deffccd75a')) {
00140             return false;
00141         }
00142         if (($id=='40f649b94977c0a6e76902e2a0b43587') or ($id=='e83249ea22178277d5befc2c5e2e9ace')) {
00143             return false;
00144         }
00145         return 123456;
00146     }
00147 
00160     public function save($data, $id, $tags = array(), $specificLifetime = false)
00161     {
00162         $this->_addLog('save', array($data, $id, $tags));
00163         if ($id=='false') {
00164             return false;
00165         }
00166         return true;
00167     }
00168 
00178     public function remove($id)
00179     {
00180         $this->_addLog('remove', array($id));
00181         if ($id=='false') {
00182             return false;
00183         }
00184         return true;
00185     }
00186 
00205     public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
00206     {
00207         $this->_addLog('clean', array($mode, $tags));
00208         if ($mode=='false') {
00209             return false;
00210         }
00211         return true;
00212     }
00213 
00219     public function getLastLog()
00220     {
00221         return $this->_log[$this->_index - 1];
00222     }
00223 
00229     public function getLogIndex()
00230     {
00231         return $this->_index;
00232     }
00233 
00239     public function getAllLogs()
00240     {
00241         return $this->_log;
00242     }
00243 
00249     public function isAutomaticCleaningAvailable()
00250     {
00251         return true;
00252     }
00253 
00261     private function _addLog($methodName, $args)
00262     {
00263         $this->_log[$this->_index] = array(
00264             'methodName' => $methodName,
00265             'args' => $args
00266         );
00267         $this->_index = $this->_index + 1;
00268     }
00269 
00270 }

Generated on Thu Apr 19 2012 17:01:16 for openbiz by  doxygen 1.7.2