~ubuntu-branches/ubuntu/wily/php-doctrine-common/wily-proposed

« back to all changes in this revision

Viewing changes to DoctrineCommon-2.3.0/Doctrine/Common/Cache/Cache.php

  • Committer: Package Import Robot
  • Author(s): David Prévot
  • Date: 2014-06-15 11:26:00 UTC
  • mfrom: (2.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20140615112600-sg4mgpwq9sfg4mre
Tags: 2.4.2-2
* Upload to unstable
* No tests if DEB_BUILD_OPTIONS contains nocheck

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 MIT license. For more information, see
19
 
 * <http://www.doctrine-project.org>.
20
 
 */
21
 
 
22
 
namespace Doctrine\Common\Cache;
23
 
 
24
 
/**
25
 
 * Interface for cache drivers.
26
 
 *
27
 
 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
28
 
 * @link    www.doctrine-project.org
29
 
 * @since   2.0
30
 
 * @author  Benjamin Eberlei <kontakt@beberlei.de>
31
 
 * @author  Guilherme Blanco <guilhermeblanco@hotmail.com>
32
 
 * @author  Jonathan Wage <jonwage@gmail.com>
33
 
 * @author  Roman Borschel <roman@code-factory.org>
34
 
 * @author  Fabio B. Silva <fabio.bat.silva@gmail.com>
35
 
 */
36
 
interface Cache
37
 
{
38
 
    const STATS_HITS    = 'hits';
39
 
    const STATS_MISSES  = 'misses';
40
 
    const STATS_UPTIME  = 'uptime';
41
 
    const STATS_MEMORY_USAGE        = 'memory_usage';
42
 
    const STATS_MEMORY_AVAILIABLE   = 'memory_available';
43
 
 
44
 
    /**
45
 
     * Fetches an entry from the cache.
46
 
     *
47
 
     * @param string $id cache id The id of the cache entry to fetch.
48
 
     * @return mixed The cached data or FALSE, if no cache entry exists for the given id.
49
 
     */
50
 
    function fetch($id);
51
 
 
52
 
    /**
53
 
     * Test if an entry exists in the cache.
54
 
     *
55
 
     * @param string $id cache id The cache id of the entry to check for.
56
 
     * @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.
57
 
     */
58
 
    function contains($id);
59
 
 
60
 
    /**
61
 
     * Puts data into the cache.
62
 
     *
63
 
     * @param string $id The cache id.
64
 
     * @param mixed $data The cache entry/data.
65
 
     * @param int $lifeTime The lifetime. If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime).
66
 
     * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.
67
 
     */
68
 
    function save($id, $data, $lifeTime = 0);
69
 
 
70
 
    /**
71
 
     * Deletes a cache entry.
72
 
     *
73
 
     * @param string $id cache id
74
 
     * @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.
75
 
     */
76
 
    function delete($id);
77
 
 
78
 
    /**
79
 
     * Retrieves cached information from data store
80
 
     *
81
 
     * The server's statistics array has the following values:
82
 
     *
83
 
     * - <b>hits</b>
84
 
     * Number of keys that have been requested and found present.
85
 
     *
86
 
     * - <b>misses</b>
87
 
     * Number of items that have been requested and not found.
88
 
     *
89
 
     * - <b>uptime</b>
90
 
     * Time that the server is running.
91
 
     *
92
 
     * - <b>memory_usage</b>
93
 
     * Memory used by this server to store items.
94
 
     *
95
 
     * - <b>memory_available</b>
96
 
     * Memory allowed to use for storage.
97
 
     *
98
 
     * @since   2.2
99
 
     * @var     array Associative array with server's statistics if available, NULL otherwise.
100
 
     */
101
 
    function getStats();
102
 
}