![]() |
Xataface 2.0
Xataface Application Framework
|
00001 <?php 00002 /*------------------------------------------------------------------------------- 00003 * Xataface Web Application Framework 00004 * Copyright (C) 2005-2008 Web Lite Solutions Corp (shannah@sfu.ca) 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 *------------------------------------------------------------------------------- 00020 */ 00021 class Dataface_Cache { 00025 var $prefix; 00026 00030 var $cachedir; 00031 00036 var $monitored = array(); 00037 00038 function Dataface_Cache($cachedir=null, $prefix=null){ 00039 if ( $cachedir === null ) $cachedir = '/tmp'; 00040 $this->cachedir = $cachedir; 00041 if ( $prefix === null ) $prefix = DATAFACE_SITE_PATH; 00042 $this->prefix = $prefix; 00043 00044 00045 } 00046 00047 function apc_get($key){ 00048 return apc_fetch($this->prefix.$key); 00049 } 00050 00051 function apc_set($key, &$value){ 00052 return apc_store($this->prefix.$key, $value); 00053 } 00054 00055 function get($key){ 00056 return $this->apc_get($key); 00057 } 00058 00059 function set($key, &$value){ 00060 return $this->apc_set($key, $value); 00061 } 00062 00063 public static function &getInstance(){ 00064 static $instance = null; 00065 if ( $instance === null ){ 00066 $instance = new Dataface_Cache(); 00067 } 00068 return $instance; 00069 } 00070 00071 } 00072