@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function &getInstance($target = 'object', $info = null, $always_use_file = false) |
32 | 32 | { |
33 | - $cache_handler_key = $target . ($always_use_file ? '_file' : ''); |
|
34 | - if(!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key]) |
|
33 | + $cache_handler_key = $target.($always_use_file ? '_file' : ''); |
|
34 | + if (!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key]) |
|
35 | 35 | { |
36 | 36 | $GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key] = new CacheHandler($target, $info, $always_use_file); |
37 | 37 | } |
@@ -51,61 +51,61 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function CacheHandler($target, $info = null, $always_use_file = false) |
53 | 53 | { |
54 | - if(!$info) |
|
54 | + if (!$info) |
|
55 | 55 | { |
56 | 56 | $info = Context::getDBInfo(); |
57 | 57 | } |
58 | 58 | |
59 | - if($info) |
|
59 | + if ($info) |
|
60 | 60 | { |
61 | - if($target == 'object') |
|
61 | + if ($target == 'object') |
|
62 | 62 | { |
63 | - if($info->use_object_cache == 'apc') |
|
63 | + if ($info->use_object_cache == 'apc') |
|
64 | 64 | { |
65 | 65 | $type = 'apc'; |
66 | 66 | } |
67 | - else if(substr($info->use_object_cache, 0, 8) == 'memcache') |
|
67 | + else if (substr($info->use_object_cache, 0, 8) == 'memcache') |
|
68 | 68 | { |
69 | 69 | $type = 'memcache'; |
70 | 70 | $url = $info->use_object_cache; |
71 | 71 | } |
72 | - else if($info->use_object_cache == 'wincache') |
|
72 | + else if ($info->use_object_cache == 'wincache') |
|
73 | 73 | { |
74 | 74 | $type = 'wincache'; |
75 | 75 | } |
76 | - else if($info->use_object_cache == 'file') |
|
76 | + else if ($info->use_object_cache == 'file') |
|
77 | 77 | { |
78 | 78 | $type = 'file'; |
79 | 79 | } |
80 | - else if($always_use_file) |
|
80 | + else if ($always_use_file) |
|
81 | 81 | { |
82 | 82 | $type = 'file'; |
83 | 83 | } |
84 | 84 | } |
85 | - else if($target == 'template') |
|
85 | + else if ($target == 'template') |
|
86 | 86 | { |
87 | - if($info->use_template_cache == 'apc') |
|
87 | + if ($info->use_template_cache == 'apc') |
|
88 | 88 | { |
89 | 89 | $type = 'apc'; |
90 | 90 | } |
91 | - else if(substr($info->use_template_cache, 0, 8) == 'memcache') |
|
91 | + else if (substr($info->use_template_cache, 0, 8) == 'memcache') |
|
92 | 92 | { |
93 | 93 | $type = 'memcache'; |
94 | 94 | $url = $info->use_template_cache; |
95 | 95 | } |
96 | - else if($info->use_template_cache == 'wincache') |
|
96 | + else if ($info->use_template_cache == 'wincache') |
|
97 | 97 | { |
98 | 98 | $type = 'wincache'; |
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - if($type) |
|
102 | + if ($type) |
|
103 | 103 | { |
104 | - $class = 'Cache' . ucfirst($type); |
|
104 | + $class = 'Cache'.ucfirst($type); |
|
105 | 105 | include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class); |
106 | 106 | $this->handler = call_user_func(array($class, 'getInstance'), $url); |
107 | 107 | $this->keyGroupVersions = $this->handler->get('key_group_versions', 0); |
108 | - if(!$this->keyGroupVersions) |
|
108 | + if (!$this->keyGroupVersions) |
|
109 | 109 | { |
110 | 110 | $this->keyGroupVersions = array(); |
111 | 111 | $this->handler->put('key_group_versions', $this->keyGroupVersions, 0); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | function isSupport() |
123 | 123 | { |
124 | - if($this->handler && $this->handler->isSupport()) |
|
124 | + if ($this->handler && $this->handler->isSupport()) |
|
125 | 125 | { |
126 | 126 | return true; |
127 | 127 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | $key = str_replace('/', ':', $key); |
141 | 141 | |
142 | - return __XE_VERSION__ . ':' . $key; |
|
142 | + return __XE_VERSION__.':'.$key; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | function get($key, $modified_time = 0) |
154 | 154 | { |
155 | - if(!$this->handler) |
|
155 | + if (!$this->handler) |
|
156 | 156 | { |
157 | 157 | return false; |
158 | 158 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | function put($key, $obj, $valid_time = 0) |
176 | 176 | { |
177 | - if(!$this->handler && !$key) |
|
177 | + if (!$this->handler && !$key) |
|
178 | 178 | { |
179 | 179 | return false; |
180 | 180 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | function delete($key) |
194 | 194 | { |
195 | - if(!$this->handler) |
|
195 | + if (!$this->handler) |
|
196 | 196 | { |
197 | 197 | return false; |
198 | 198 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | function isValid($key, $modified_time = 0) |
214 | 214 | { |
215 | - if(!$this->handler) |
|
215 | + if (!$this->handler) |
|
216 | 216 | { |
217 | 217 | return false; |
218 | 218 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | function truncate() |
231 | 231 | { |
232 | - if(!$this->handler) |
|
232 | + if (!$this->handler) |
|
233 | 233 | { |
234 | 234 | return false; |
235 | 235 | } |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | */ |
256 | 256 | function getGroupKey($keyGroupName, $key) |
257 | 257 | { |
258 | - if(!$this->keyGroupVersions[$keyGroupName]) |
|
258 | + if (!$this->keyGroupVersions[$keyGroupName]) |
|
259 | 259 | { |
260 | 260 | $this->keyGroupVersions[$keyGroupName] = 1; |
261 | 261 | $this->handler->put('key_group_versions', $this->keyGroupVersions, 0); |
262 | 262 | } |
263 | 263 | |
264 | - return 'cache_group_' . $this->keyGroupVersions[$keyGroupName] . ':' . $keyGroupName . ':' . $key; |
|
264 | + return 'cache_group_'.$this->keyGroupVersions[$keyGroupName].':'.$keyGroupName.':'.$key; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |