@@ -32,7 +32,7 @@ public function initialize($options = array())
3232 {
3333 parent ::initialize ($ options );
3434
35- $ this ->enabled = function_exists ('apc_store ' ) && ini_get ( ' apc.enabled ' );
35+ $ this ->enabled = function_exists ('apcu_store ' ) && apcu_enabled ( );
3636 }
3737
3838 /**
@@ -69,14 +69,16 @@ public function has($key)
6969 * @see sfCache
7070 *
7171 * @param mixed|null $lifetime
72+ *
73+ * @return bool|array
7274 */
7375 public function set ($ key , $ data , $ lifetime = null )
7476 {
7577 if (!$ this ->enabled ) {
7678 return true ;
7779 }
7880
79- return apc_store ($ this ->getOption ('prefix ' ).$ key , $ data , $ this ->getLifetime ($ lifetime ));
81+ return apcu_store ($ this ->getOption ('prefix ' ).$ key , $ data , $ this ->getLifetime ($ lifetime ));
8082 }
8183
8284 /**
@@ -88,7 +90,7 @@ public function remove($key)
8890 return true ;
8991 }
9092
91- return apc_delete ($ this ->getOption ('prefix ' ).$ key );
93+ return apcu_delete ($ this ->getOption ('prefix ' ).$ key );
9294 }
9395
9496 /**
@@ -101,7 +103,7 @@ public function clean($mode = sfCache::ALL)
101103 }
102104
103105 if (sfCache::ALL === $ mode ) {
104- return apc_clear_cache ( ' user ' );
106+ return apcu_clear_cache ( );
105107 }
106108 }
107109
@@ -138,7 +140,7 @@ public function removePattern($pattern)
138140 return true ;
139141 }
140142
141- $ infos = apc_cache_info ( ' user ' );
143+ $ infos = apcu_cache_info ( );
142144 if (!is_array ($ infos ['cache_list ' ])) {
143145 return ;
144146 }
@@ -147,7 +149,7 @@ public function removePattern($pattern)
147149
148150 foreach ($ infos ['cache_list ' ] as $ info ) {
149151 if (preg_match ($ regexp , $ info ['info ' ])) {
150- apc_delete ($ info ['info ' ]);
152+ apcu_delete ($ info ['info ' ]);
151153 }
152154 }
153155 }
@@ -165,7 +167,7 @@ protected function getCacheInfo($key)
165167 return false ;
166168 }
167169
168- $ infos = apc_cache_info ( ' user ' );
170+ $ infos = apcu_cache_info ( );
169171
170172 if (is_array ($ infos ['cache_list ' ])) {
171173 foreach ($ infos ['cache_list ' ] as $ info ) {
@@ -181,7 +183,7 @@ protected function getCacheInfo($key)
181183 private function fetch ($ key , &$ success )
182184 {
183185 $ has = null ;
184- $ value = apc_fetch ($ key , $ has );
186+ $ value = apcu_fetch ($ key , $ has );
185187 // the second argument was added in APC 3.0.17. If it is still null we fall back to the value returned
186188 if (null !== $ has ) {
187189 $ success = $ has ;
0 commit comments