[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 11 include_once dirname(__FILE__) . '/Connectors.php'; 12 13 class Vtiger_Cache_Connector { 14 protected $connection; 15 16 protected function __construct() { 17 if (!$this->connection) { 18 $this->connection = new Vtiger_Cache_Connector_Memory(); 19 } 20 } 21 22 protected function cacheKey($ns, $key) { 23 if(is_array($key)) $key = implode('-', $key); 24 return $ns . '-' . $key; 25 } 26 27 public function set($namespace, $key, $value) { 28 $this->connection->set($this->cacheKey($namespace, $key), $value); 29 } 30 31 public function get($namespace, $key) { 32 return $this->connection->get($this->cacheKey($namespace, $key)); 33 } 34 35 public function has($namespace, $key) { 36 return $this->get($namespace, $key) !== false; 37 } 38 39 public function flush(){ 40 $this->connection->flush(); 41 42 $time = time()+1; //one second future 43 while(time() < $time) { 44 //sleep 45 } 46 } 47 48 public static function getInstance() { 49 static $singleton = NULL; 50 if ($singleton === NULL) { 51 $singleton = new self(); 52 } 53 return $singleton; 54 } 55 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |