@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function getInstance($url) |
25 | 25 | { |
26 | - if(!$GLOBALS['__CacheMemcache__']) |
|
26 | + if (!$GLOBALS['__CacheMemcache__']) |
|
27 | 27 | { |
28 | 28 | $GLOBALS['__CacheMemcache__'] = new CacheMemcache($url); |
29 | 29 | } |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | { |
42 | 42 | //$config['url'] = array('memcache://localhost:11211'); |
43 | 43 | $config['url'] = is_array($url) ? $url : array($url); |
44 | - if(class_exists('Memcached')) |
|
44 | + if (class_exists('Memcached')) |
|
45 | 45 | { |
46 | 46 | $this->Memcache = new Memcached; |
47 | 47 | $this->SelectedExtension = 'Memcached'; |
48 | 48 | } |
49 | - elseif(class_exists('Memcache')) |
|
49 | + elseif (class_exists('Memcache')) |
|
50 | 50 | { |
51 | 51 | $this->Memcache = new Memcache; |
52 | 52 | $this->SelectedExtension = 'Memcache'; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | return false; |
57 | 57 | } |
58 | 58 | |
59 | - foreach($config['url'] as $url) |
|
59 | + foreach ($config['url'] as $url) |
|
60 | 60 | { |
61 | 61 | $info = parse_url($url); |
62 | 62 | $this->Memcache->addServer($info['host'], $info['port']); |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | */ |
71 | 71 | function isSupport() |
72 | 72 | { |
73 | - if(isset($GLOBALS['XE_MEMCACHE_SUPPORT'])) |
|
73 | + if (isset($GLOBALS['XE_MEMCACHE_SUPPORT'])) |
|
74 | 74 | { |
75 | 75 | return $GLOBALS['XE_MEMCACHE_SUPPORT']; |
76 | 76 | } |
77 | - if($this->SelectedExtension === 'Memcached') |
|
77 | + if ($this->SelectedExtension === 'Memcached') |
|
78 | 78 | { |
79 | 79 | return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', 1); |
80 | 80 | } |
81 | - elseif($this->SelectedExtension === 'Memcache') |
|
81 | + elseif ($this->SelectedExtension === 'Memcache') |
|
82 | 82 | { |
83 | 83 | return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', MEMCACHE_COMPRESSED, 1); |
84 | 84 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function getKey($key) |
98 | 98 | { |
99 | - return md5(_XE_PATH_ . $key); |
|
99 | + return md5(_XE_PATH_.$key); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function put($key, $buff, $valid_time = 0) |
120 | 120 | { |
121 | - if($valid_time == 0) |
|
121 | + if ($valid_time == 0) |
|
122 | 122 | { |
123 | 123 | $valid_time = $this->valid_time; |
124 | 124 | } |
125 | - if($this->SelectedExtension === 'Memcached') |
|
125 | + if ($this->SelectedExtension === 'Memcached') |
|
126 | 126 | { |
127 | 127 | return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time); |
128 | 128 | } |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | $_key = $this->getKey($key); |
146 | 146 | |
147 | 147 | $obj = $this->Memcache->get($_key); |
148 | - if(!$obj || !is_array($obj)) |
|
148 | + if (!$obj || !is_array($obj)) |
|
149 | 149 | { |
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | unset($obj[1]); |
153 | 153 | |
154 | - if($modified_time > 0 && $modified_time > $obj[0]) |
|
154 | + if ($modified_time > 0 && $modified_time > $obj[0]) |
|
155 | 155 | { |
156 | 156 | //$this->_delete($_key); |
157 | 157 | return false; |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | { |
175 | 175 | $_key = $this->getKey($key); |
176 | 176 | $obj = $this->Memcache->get($_key); |
177 | - if(!$obj || !is_array($obj)) |
|
177 | + if (!$obj || !is_array($obj)) |
|
178 | 178 | { |
179 | 179 | return false; |
180 | 180 | } |
181 | 181 | |
182 | - if($modified_time > 0 && $modified_time > $obj[0]) |
|
182 | + if ($modified_time > 0 && $modified_time > $obj[0]) |
|
183 | 183 | { |
184 | 184 | $this->_delete($_key); |
185 | 185 | return false; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | function getInstance($opt = null) |
22 | 22 | { |
23 | - if(!$GLOBALS['__CacheWincache__']) |
|
23 | + if (!$GLOBALS['__CacheWincache__']) |
|
24 | 24 | { |
25 | 25 | $GLOBALS['__CacheWincache__'] = new CacheWincache(); |
26 | 26 | } |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function put($key, $buff, $valid_time = 0) |
61 | 61 | { |
62 | - if($valid_time == 0) |
|
62 | + if ($valid_time == 0) |
|
63 | 63 | { |
64 | 64 | $valid_time = $this->valid_time; |
65 | 65 | } |
66 | - return wincache_ucache_set(md5(_XE_PATH_ . $key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time); |
|
66 | + return wincache_ucache_set(md5(_XE_PATH_.$key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | */ |
77 | 77 | function isValid($key, $modified_time = 0) |
78 | 78 | { |
79 | - $_key = md5(_XE_PATH_ . $key); |
|
79 | + $_key = md5(_XE_PATH_.$key); |
|
80 | 80 | $obj = wincache_ucache_get($_key, $success); |
81 | - if(!$success || !is_array($obj)) |
|
81 | + if (!$success || !is_array($obj)) |
|
82 | 82 | { |
83 | 83 | return false; |
84 | 84 | } |
85 | 85 | unset($obj[1]); |
86 | 86 | |
87 | - if($modified_time > 0 && $modified_time > $obj[0]) |
|
87 | + if ($modified_time > 0 && $modified_time > $obj[0]) |
|
88 | 88 | { |
89 | 89 | //$this->_delete($_key); |
90 | 90 | return false; |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | */ |
104 | 104 | function get($key, $modified_time = 0) |
105 | 105 | { |
106 | - $_key = md5(_XE_PATH_ . $key); |
|
106 | + $_key = md5(_XE_PATH_.$key); |
|
107 | 107 | $obj = wincache_ucache_get($_key, $success); |
108 | - if(!$success || !is_array($obj)) |
|
108 | + if (!$success || !is_array($obj)) |
|
109 | 109 | { |
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
113 | - if($modified_time > 0 && $modified_time > $obj[0]) |
|
113 | + if ($modified_time > 0 && $modified_time > $obj[0]) |
|
114 | 114 | { |
115 | 115 | $this->_delete($_key); |
116 | 116 | return false; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | function delete($key) |
140 | 140 | { |
141 | - $_key = md5(_XE_PATH_ . $key); |
|
141 | + $_key = md5(_XE_PATH_.$key); |
|
142 | 142 | $this->_delete($_key); |
143 | 143 | } |
144 | 144 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function getInstance($opt = null) |
20 | 20 | { |
21 | - if(!$GLOBALS['__CacheApc__']) |
|
21 | + if (!$GLOBALS['__CacheApc__']) |
|
22 | 22 | { |
23 | 23 | $GLOBALS['__CacheApc__'] = new CacheApc(); |
24 | 24 | } |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | */ |
57 | 57 | function put($key, $buff, $valid_time = 0) |
58 | 58 | { |
59 | - if($valid_time == 0) |
|
59 | + if ($valid_time == 0) |
|
60 | 60 | { |
61 | 61 | $valid_time = $this->valid_time; |
62 | 62 | } |
63 | 63 | |
64 | - return apc_store(md5(_XE_PATH_ . $key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time); |
|
64 | + return apc_store(md5(_XE_PATH_.$key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | */ |
75 | 75 | function isValid($key, $modified_time = 0) |
76 | 76 | { |
77 | - $_key = md5(_XE_PATH_ . $key); |
|
77 | + $_key = md5(_XE_PATH_.$key); |
|
78 | 78 | $obj = apc_fetch($_key, $success); |
79 | - if(!$success || !is_array($obj)) |
|
79 | + if (!$success || !is_array($obj)) |
|
80 | 80 | { |
81 | 81 | return false; |
82 | 82 | } |
83 | 83 | unset($obj[1]); |
84 | 84 | |
85 | - if($modified_time > 0 && $modified_time > $obj[0]) |
|
85 | + if ($modified_time > 0 && $modified_time > $obj[0]) |
|
86 | 86 | { |
87 | 87 | //$this->delete($key); |
88 | 88 | return false; |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | */ |
102 | 102 | function get($key, $modified_time = 0) |
103 | 103 | { |
104 | - $_key = md5(_XE_PATH_ . $key); |
|
104 | + $_key = md5(_XE_PATH_.$key); |
|
105 | 105 | $obj = apc_fetch($_key, $success); |
106 | - if(!$success || !is_array($obj)) |
|
106 | + if (!$success || !is_array($obj)) |
|
107 | 107 | { |
108 | 108 | return false; |
109 | 109 | } |
110 | 110 | |
111 | - if($modified_time > 0 && $modified_time > $obj[0]) |
|
111 | + if ($modified_time > 0 && $modified_time > $obj[0]) |
|
112 | 112 | { |
113 | 113 | $this->delete($key); |
114 | 114 | return false; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | function delete($key) |
127 | 127 | { |
128 | - $_key = md5(_XE_PATH_ . $key); |
|
128 | + $_key = md5(_XE_PATH_.$key); |
|
129 | 129 | return apc_delete($_key); |
130 | 130 | } |
131 | 131 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | -CacheApc::$isSupport = function_exists('apc_add'); |
|
151 | +CacheApc::$isSupport = function_exists('apc_add'); |
|
152 | 152 | |
153 | 153 | /* End of file CacheApc.class.php */ |
154 | 154 | /* Location: ./classes/cache/CacheApc.class.php */ |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function getInstance() |
25 | 25 | { |
26 | - if(!$GLOBALS['__CacheFile__']) |
|
26 | + if (!$GLOBALS['__CacheFile__']) |
|
27 | 27 | { |
28 | 28 | $GLOBALS['__CacheFile__'] = new CacheFile(); |
29 | 29 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function CacheFile() |
39 | 39 | { |
40 | - $this->cache_dir = _XE_PATH_ . $this->cache_dir; |
|
40 | + $this->cache_dir = _XE_PATH_.$this->cache_dir; |
|
41 | 41 | FileHandler::makeDir($this->cache_dir); |
42 | 42 | } |
43 | 43 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function getCacheFileName($key) |
51 | 51 | { |
52 | - return $this->cache_dir . str_replace(':', DIRECTORY_SEPARATOR, $key) . '.php'; |
|
52 | + return $this->cache_dir.str_replace(':', DIRECTORY_SEPARATOR, $key).'.php'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $content = array(); |
77 | 77 | $content[] = '<?php'; |
78 | 78 | $content[] = 'if(!defined(\'__XE__\')) { exit(); }'; |
79 | - $content[] = 'return \'' . addslashes(serialize($obj)) . '\';'; |
|
79 | + $content[] = 'return \''.addslashes(serialize($obj)).'\';'; |
|
80 | 80 | FileHandler::writeFile($cache_file, implode(PHP_EOL, $content)); |
81 | - if(function_exists('opcache_invalidate')) |
|
81 | + if (function_exists('opcache_invalidate')) |
|
82 | 82 | { |
83 | 83 | @opcache_invalidate($cache_file, true); |
84 | 84 | } |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | { |
96 | 96 | $cache_file = $this->getCacheFileName($key); |
97 | 97 | |
98 | - if(file_exists($cache_file)) |
|
98 | + if (file_exists($cache_file)) |
|
99 | 99 | { |
100 | - if($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
100 | + if ($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
101 | 101 | { |
102 | 102 | //FileHandler::removeFile($cache_file); |
103 | 103 | return false; |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function get($key, $modified_time = 0) |
120 | 120 | { |
121 | - if(!$cache_file = FileHandler::exists($this->getCacheFileName($key))) |
|
121 | + if (!$cache_file = FileHandler::exists($this->getCacheFileName($key))) |
|
122 | 122 | { |
123 | 123 | return false; |
124 | 124 | } |
125 | 125 | |
126 | - if($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
126 | + if ($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
127 | 127 | { |
128 | 128 | FileHandler::removeFile($cache_file); |
129 | 129 | return false; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | function _delete($_key) |
144 | 144 | { |
145 | 145 | $cache_file = $this->getCacheFileName($_key); |
146 | - if(function_exists('opcache_invalidate')) |
|
146 | + if (function_exists('opcache_invalidate')) |
|
147 | 147 | { |
148 | 148 | @opcache_invalidate($cache_file, true); |
149 | 149 | } |