12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
-
-
-
- namespace Doctrine\Common\Cache;
-
-
- class ApcCache extends CacheProvider
- {
-
-
- protected function doFetch($id)
- {
- return apc_fetch($id);
- }
-
-
-
- protected function doContains($id)
- {
- return apc_exists($id);
- }
-
-
-
- protected function doSave($id, $data, $lifeTime = 0)
- {
- return (bool) apc_store($id, $data, (int) $lifeTime);
- }
-
-
-
- protected function doDelete($id)
- {
- return apc_delete($id);
- }
-
-
-
- protected function doFlush()
- {
- return apc_clear_cache() && apc_clear_cache('user');
- }
-
-
-
- protected function doGetStats()
- {
- $info = apc_cache_info();
- $sma = apc_sma_info();
-
- return array(
- Cache::STATS_HITS => $info['num_hits'],
- Cache::STATS_MISSES => $info['num_misses'],
- Cache::STATS_UPTIME => $info['start_time'],
- Cache::STATS_MEMORY_USAGE => $info['mem_size'],
- Cache::STATS_MEMORY_AVAILIABLE => $sma['avail_mem'],
- );
- }
- }
|