Thursday, March 11, 2010
 

APC singleton pattern

This time small class for APC singleton pattern.

class CSCache {

    static private $m_objMem = NULL;

    function __construct(){

    }

    static function getMem() {
        if (self::$m_objMem == NULL) {


            self::$m_objMem = new CSCache();
        }
        return self::$m_objMem;
    }

    function delete($key) {
        apc_delete($key);
    }

    function restore($key) {
        return apc_fetch($key);
    }

    function store($key, $value, $ttl = 12000) {
        apc_store($key,$value,$ttl);
    }
}
Back »

Comments: 0

Leave a reply »

 
  • Leave a Reply
    Your gravatar
    Your Name
     
     
     
     
     
 
About Remdex site

Simple site for simple peoples.

Get in touch

E-mail: remdex@gmail.com