MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
XcacheCache.php
Ir para a documentação deste ficheiro.
1<?php
2/*
3 * $Id$
4 *
5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 *
17 * This software consists of voluntary contributions made by many individuals
18 * and is licensed under the LGPL. For more information, see
19 * <http://www.doctrine-project.org>.
20 */
21
22namespace Doctrine\Common\Cache;
23
38{
42 public function getIds()
43 {
44 $this->_checkAuth();
45 $keys = array();
46
47 for ($i = 0, $count = xcache_count(XC_TYPE_VAR); $i < $count; $i++) {
48 $entries = xcache_list(XC_TYPE_VAR, $i);
49
50 if (is_array($entries['cache_list'])) {
51 foreach ($entries['cache_list'] as $entry) {
52 $keys[] = $entry['name'];
53 }
54 }
55 }
56
57 return $keys;
58 }
59
63 protected function _doFetch($id)
64 {
65 return $this->_doContains($id) ? unserialize(xcache_get($id)) : false;
66 }
67
71 protected function _doContains($id)
72 {
73 return xcache_isset($id);
74 }
75
79 protected function _doSave($id, $data, $lifeTime = 0)
80 {
81 return xcache_set($id, serialize($data), (int) $lifeTime);
82 }
83
87 protected function _doDelete($id)
88 {
89 return xcache_unset($id);
90 }
91
92
99 protected function _checkAuth()
100 {
101 if (ini_get('xcache.admin.enable_auth')) {
102 throw new \BadMethodCallException('To use all features of \Doctrine\Common\Cache\XcacheCache, you must set "xcache.admin.enable_auth" to "Off" in your php.ini.');
103 }
104 }
105}
_doSave($id, $data, $lifeTime=0)
Definição XcacheCache.php:79
$id
Definição base.php:5