. */ namespace Doctrine\Common\Cache; /** * WinCache cache provider. * * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.doctrine-project.org * @since 2.2 * @author Benjamin Eberlei * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel * @author David Abdemoulaie */ class WincacheCache extends CacheProvider { /** * {@inheritdoc} */ protected function doFetch($id) { return wincache_ucache_get($id); } /** * {@inheritdoc} */ protected function doContains($id) { return wincache_ucache_exists($id); } /** * {@inheritdoc} */ protected function doSave($id, $data, $lifeTime = 0) { return (bool) wincache_ucache_set($id, $data, (int) $lifeTime); } /** * {@inheritdoc} */ protected function doDelete($id) { return wincache_ucache_delete($id); } /** * {@inheritdoc} */ protected function doFlush() { return wincache_ucache_clear(); } /** * {@inheritdoc} */ protected function doGetStats() { $info = wincache_ucache_info(); $meminfo= wincache_ucache_meminfo(); return array( Cache::STATS_HITS => $info['total_hit_count'], Cache::STATS_MISSES => $info['total_miss_count'], Cache::STATS_UPTIME => $info['total_cache_uptime'], Cache::STATS_MEMORY_USAGE => $meminfo['memory_total'], Cache::STATS_MEMORY_AVAILIABLE => $meminfo['memory_free'], ); } }