43 require_once(
'Cache/Lite.php');
 
   44 require_once(
'XML/RPC2/Exception.php');
 
  158         if (isset($options[
'cacheOptions'])) {
 
  159             $array = $options[
'cacheOptions'];
 
  160             if (isset($array[
'defaultCacheGroup'])) {
 
  161                 $this->_defaultCacheGroup = $array[
'defaultCacheGroup'];
 
  162                 unset($array[
'defaultCacheGroup']); 
 
  164             if (isset($array[
'cachedMethods'])) {
 
  165                 $this->_cachedMethods = $array[
'cachedMethods'];
 
  166                 unset($array[
'cachedMethods']); 
 
  168             if (isset($array[
'notCachedMethods'])) {
 
  169                 $this->_notCachedMethods = $array[
'notCachedMethods'];
 
  170                 unset($array[
'notCachedMethods']); 
 
  172             if (isset($array[
'cacheByDefault'])) {
 
  173                 $this->_cacheByDefault = $array[
'cacheByDefault'];
 
  174                 unset($array[
'CacheByDefault']); 
 
  176             $array[
'automaticSerialization'] = 
false; 
 
  177             if (!isset($array[
'lifetime'])) {
 
  178                 $array[
'lifetime'] = 3600; 
 
  180             unset($options[
'cacheOptions']); 
 
  184                 'automaticSerialization' => 
false  
  187         if (isset($options[
'cacheDebug'])) {
 
  188             $this->_cacheDebug = $options[
'cacheDebug'];
 
  189             unset($options[
'cacheDebug']); 
 
  191         $this->_cacheOptions = $array;
 
  192         $this->_cacheObject = 
new Cache_Lite($this->_cacheOptions);    
 
  193         $this->_options = $options;
 
  210     public static function create($uri, $options = array()) 
 
  230     public function __call($methodName, $parameters)
 
  232         if (!isset($this->_cacheObject)) {
 
  233             $this->_cacheObject = 
new Cache_Lite($this->_cacheOptions);
 
  235         if (in_array($methodName, $this->_notCachedMethods)) {
 
  237             if ($this->_cacheDebug) {
 
  238                 print 
"CACHE DEBUG : the called method is listed in _notCachedMethods => no cache !\n";    
 
  242         if (!($this->_cacheByDefault)) {
 
  243             if ((!(isset($this->_cachedMethods[$methodName]))) and (!(in_array($methodName, $this->_cachedMethods)))) {
 
  246                 if ($this->_cacheDebug) {
 
  247                     print 
"CACHE DEBUG : cache is not on by default and the called method is not listed in _cachedMethods => no cache !\n";    
 
  252         if (isset($this->_cachedMethods[$methodName])) {
 
  253             if ($this->_cachedMethods[$methodName] == -1) {
 
  255                 if ($this->_cacheDebug) {
 
  256                     print 
"CACHE DEBUG : called method has a -1 lifetime value => no cache !\n";    
 
  262             $this->_cacheObject->setLifetime($this->_cachedMethods[$methodName]);
 
  265             $this->_cacheObject->setLifetime($this->_cacheOptions[
'lifetime']);
 
  268         $data = $this->_cacheObject->get($cacheId, $this->_defaultCacheGroup);
 
  269         if (is_string(
$data)) {
 
  271             if ($this->_cacheDebug) {
 
  272                 print 
"CACHE DEBUG : cache is hit !\n";
 
  274             return unserialize(
$data);
 
  277         if ($this->_cacheDebug) {
 
  278             print 
"CACHE DEBUG : cache is not hit !\n";
 
  281         $this->_cacheObject->save(serialize(
$result)); 
 
  300         if (!(isset($this->_clientObject))) {
 
  302             require_once(
'XML/RPC2/Client.php');
 
  306         return call_user_func_array(array($this->_clientObject, $methodName), $parameters);
 
  324         return md5($methodName . serialize($parameters) . serialize($this->_uri) . serialize($this->_options)); 
 
  342         $this->_cacheObject->remove($id, $this->_defaultCacheGroup);
 
  356         $this->_cacheObject->clean($this->_defaultCacheGroup, 
'ingroup');