00001 <?php
00030 class zCache_factory extends zCore{
00037 var $controller;
00038 var $methodName;
00039 var $isReg;
00040
00041 function zCache_factory(&$controller, $methodName, $isRegister = false){
00042 $this->controller =& $controller;
00043 $this->methodName = $methodName;
00044 $this->isReg = $isRegister;
00045 }
00046 function __construct(&$controller, $methodName, $isRegister = false){
00047 $this->controller =& $controller;
00048 $this->methodName = $methodName;
00049 $this->isReg = $isRegister;
00050 }
00058 function renderedView($viewName, $lifeTime=30){
00059 $params = ($this->isReg) ? array($viewName, Z_CACHE_RENDERED_VIEW, $lifeTime) : array($viewName, Z_CACHE_RENDERED_VIEW);
00060 return call_user_func_array(array($this->controller, $this->methodName), $params);
00061 }
00069 function loadedView($viewName, $lifeTime=30){
00070 $params = ($this->isReg) ? array($viewName, Z_CACHE_RENDERED_VIEW, $lifeTime) : array($viewName, Z_CACHE_RENDERED_VIEW);
00071 return call_user_func_array(array($this->controller, $this->methodName), $params);
00072 }
00080 function renderedSharedView($viewName, $lifeTime=30){
00081 $params = ($this->isReg) ? array($viewName, Z_CACHE_RENDERED_VIEW, $lifeTime) : array($viewName, Z_CACHE_RENDERED_VIEW);
00082 return call_user_func_array(array($this->controller, $this->methodName), $params);
00083 }
00091 function loadedSharedView($viewName, $lifeTime=30){
00092 $params = ($this->isReg) ? array($viewName, Z_CACHE_RENDERED_VIEW, $lifeTime) : array($viewName, Z_CACHE_RENDERED_VIEW);
00093 return call_user_func_array(array($this->controller, $this->methodName), $params);
00094 }
00101 function controller($lifeTime=30){
00102 $params = ($this->isReg) ? array($this->controller->className.".".$this->controller->methodName, Z_CACHE_RENDERED_VIEW, $lifeTime) : array($this->controller->className.".".$this->controller->methodName, Z_CACHE_RENDERED_VIEW);
00103 return call_user_func_array(array($this->controller, $this->methodName), $params);
00104 }
00112 function method($methodName, $lifeTime=30){
00113 $params = ($this->isReg) ? array($this->controller->className.".".$methodName, Z_CACHE_RENDERED_VIEW, $lifeTime) : array($this->controller->className.".".$methodName, Z_CACHE_RENDERED_VIEW);
00114 return call_user_func_array(array($this->controller, $this->methodName), $params);
00115 }
00121 function full(){
00122 var_dump($this->controller->xyz);
00123
00124 if(!$this->isReg)perror("<code>zigmoyd.cache.fullPage</code><br />Currently you cant do anything other than register with full Page level Cache");
00125 $params = array($this->controller->className.".".$this->controller->methodName, Z_CACHE_FULL);
00126 $ret = call_user_func_array(array($this->controller, $this->methodName), $params);
00127 echo "From zCache_factory::full()\n<br />";
00128 var_dump($this->controller->cacheConfig);
00129 }
00130 }
00136 class zCache extends zCore{
00143 var $controller;
00150 var $register;
00157 var $exists;
00164 var $exec;
00171 var $delete;
00172
00173 function zCache(&$controller){
00174 $this->controller = &$controller;
00175 $this->register = new zCache_factory($controller, 'registerCache', true);
00176 $this->exists = new zCache_factory(&$controller, 'cacheExists');
00177 $this->exec = new zCache_factory(&$this->controller, 'execCache');
00178 $this->delete = new zCache_factory(&$controller, 'deleteCache');
00179 }
00180 function __construct(&$controller){
00181
00182 $this->register = new zCache_factory(&$controller, 'registerCache', true);
00183 $this->exists = new zCache_factory(&$controller, 'cacheExists');
00184 $this->exec = new zCache_factory(&$this->controller, 'execCache');
00185 $this->delete = new zCache_factory(&$controller, 'deleteCache');
00186 }
00187 }
00189 ?>