3 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 * This software consists of voluntary contributions made by many individuals
16 * and is licensed under the MIT license. For more information, see
17 * <http://www.doctrine-project.org>.
20 namespace Doctrine\Common\Cache
;
23 * WinCache cache provider.
25 * @link www.doctrine-project.org
27 * @author Benjamin Eberlei <kontakt@beberlei.de>
28 * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
29 * @author Jonathan Wage <jonwage@gmail.com>
30 * @author Roman Borschel <roman@code-factory.org>
31 * @author David Abdemoulaie <dave@hobodave.com>
33 class WinCacheCache
extends CacheProvider
38 protected function doFetch($id)
40 return wincache_ucache_get($id);
46 protected function doContains($id)
48 return wincache_ucache_exists($id);
54 protected function doSave($id, $data, $lifeTime = 0)
56 return wincache_ucache_set($id, $data, $lifeTime);
62 protected function doDelete($id)
64 return wincache_ucache_delete($id);
70 protected function doFlush()
72 return wincache_ucache_clear();
78 protected function doFetchMultiple(array $keys)
80 return wincache_ucache_get($keys);
86 protected function doSaveMultiple(array $keysAndValues, $lifetime = 0)
88 $result = wincache_ucache_set($keysAndValues, null, $lifetime);
90 return empty($result);
96 protected function doGetStats()
98 $info = wincache_ucache_info();
99 $meminfo = wincache_ucache_meminfo();
102 Cache
::STATS_HITS
=> $info['total_hit_count'],
103 Cache
::STATS_MISSES
=> $info['total_miss_count'],
104 Cache
::STATS_UPTIME
=> $info['total_cache_uptime'],
105 Cache
::STATS_MEMORY_USAGE
=> $meminfo['memory_total'],
106 Cache
::STATS_MEMORY_AVAILABLE
=> $meminfo['memory_free'],