public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
Search Repo:
Fixed issue with CmsCache

It was originally written with too many statics and would cause issues
if you used page caching and function caching at the same time (like
when a page is cached on first load)

Signed-off-by: Ted Kulp <ted@cmsmadesimple.org>


git-svn-id: http://svn.cmsmadesimple.org/svn/cmsmadesimple/trunk@4123 
3d254a34-79dc-0310-9e5f-be208747d8a0
tedkulp (author)
Sun Sep 09 01:04:27 -0700 2007
commit  a11ef674ead2618eb15652709b18c9aa06e5c4f0
tree    8eebbfae290bb07801d09391f3617eefeccef098
parent  d6ea7c4aaf6f8533b93aaf2e267c0cde1dd3d092
...
30
31
32
33
 
 
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
49
50
51
52
 
53
54
55
56
57
 
58
59
60
61
62
63
64
65
 
66
67
 
68
69
70
 
71
72
 
73
74
75
 
76
77
78
79
80
 
81
82
83
84
85
 
86
87
88
89
90
91
 
92
93
94
95
96
97
 
98
99
100
101
102
103
 
104
105
106
...
30
31
32
 
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
...
50
51
52
 
53
54
55
56
57
 
58
59
60
61
62
63
 
 
 
64
65
 
66
67
68
 
69
70
 
71
72
73
 
74
75
76
77
78
 
79
80
81
82
83
 
84
85
86
87
88
89
 
90
91
92
93
94
95
 
96
97
98
99
100
101
 
102
103
104
105
0
@@ -30,7 +30,8 @@
0
  **/
0
 class CmsCache extends CmsObject
0
 {
0
- static private $cache = null;
0
+ static private $instances = null;
0
+ private $cache = null;
0
   
0
   function __construct($type = 'function')
0
   {
0
0
0
0
0
0
0
0
0
0
0
0
@@ -49,58 +50,56 @@
0
         $options['caching'] = false;
0
 
0
       require_once(cms_join_path(ROOT_DIR, 'lib', 'pear', 'cache', 'lite', 'Function.php'));
0
- self::$cache = new Cache_Lite_Function($options);
0
+ $this->cache = new Cache_Lite_Function($options);
0
     }
0
     else
0
     {
0
       require_once(cms_join_path(ROOT_DIR, 'lib', 'pear', 'cache', 'lite', 'Function.php'));
0
- self::$cache = new Cache_Lite($options);
0
+ $this->cache = new Cache_Lite($options);
0
     }
0
   }
0
   
0
   public static function get_instance($type = 'function')
0
   {
0
- static $instances;
0
-
0
- if (!isset($instances))
0
+ if (self::$instances == null)
0
     {
0
- $instances = array();
0
+ self::$instances = array();
0
     }
0
 
0
- if (empty($instances[$type]))
0
+ if (empty(self::$instances[$type]))
0
     {
0
- $instances[$type] = new CmsCache($type);
0
+ self::$instances[$type] = new CmsCache($type);
0
     }
0
 
0
- return $instances[$type];
0
+ return self::$instances[$type];
0
   }
0
   
0
   public function get($id, $group = 'default', $doNotTestCacheValidity = FALSE)
0
   {
0
- return self::$cache->get($id, $group, $doNotTestCacheValidity);
0
+ return $this->cache->get($id, $group, $doNotTestCacheValidity);
0
   }
0
   
0
   public function save($data, $id = NULL, $group = 'default')
0
   {
0
- return self::$cache->save($data, $id, $group);
0
+ return $this->cache->save($data, $id, $group);
0
   }
0
   
0
   public function call()
0
   {
0
     $args = func_get_args();
0
- return call_user_func_array(array(&self::$cache, 'call'), $args);
0
+ return call_user_func_array(array($this->cache, 'call'), $args);
0
   }
0
   
0
   public function drop()
0
   {
0
     $args = func_get_args();
0
- return call_user_func_array(array(&self::$cache, 'drop'), $args);
0
+ return call_user_func_array(array($this->cache, 'drop'), $args);
0
   }
0
   
0
   public function clean($group = FALSE, $mode = 'ingroup')
0
   {
0
     CmsContentOperations::clear_cache();
0
- return self::$cache->clean($group, $mode);
0
+ return $this->clean($group, $mode);
0
   }
0
   
0
   static public function clear($group = FALSE, $mode = 'ingroup')

Comments

    No one has commented yet.