Пример #1
0
<?php

/**
 * Shared memory cache.
 *
 * Note that the method 'clearCache' does _not_
 * perform unconditional clearing of the cache.
 *
 * @author Jean-Lou Dupont
 * @package Cache
 * @version 1.0.2
 * @Id $Id: Cache.php 295 2007-11-30 15:17:03Z JeanLou.Dupont $
 */
//<source lang=php>
// create only one instance of the following class.
JLD_Cache_Manager::singleton();
class JLD_Cache_Manager
{
    /**
     * Array sorted in order of preference
     */
    static $classes = array('JLD_Cache_eAccel', 'JLD_Cache_APC', 'JLD_Cache_Fake');
    static $instance = null;
    static $cache = null;
    /**
     * Can't create an instance of this class directly;
     * need to go through the singleton interface.
     *
     */
    protected function __construct()
    {
Пример #2
0
 public function testDeleteExistingKey()
 {
     $o = JLD_Cache_Manager::singleton();
     $c = $o->getCache();
     $c->delete('key5');
     $c->add('key5', 'value5');
     $c->delete('key5');
     $r = $c->get('key5');
     $this->assertEquals(false, $r);
 }