Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
executable file 87 lines (71 sloc) 2.04 KB
<?php /*
ocPortal
Copyright (c) ocProducts, 2004-2012
See text/EN/licence.txt for full licencing information.
NOTE TO PROGRAMMERS:
Do not edit this file. If you need to make changes, save your changed file to the appropriate *_custom folder
**** If you ignore this advice, then your website upgrades (e.g. for bug fixes) will likely kill your changes ****
*/
/**
* @license http://opensource.org/licenses/cpal_1.0 Common Public Attribution License
* @copyright ocProducts Ltd
* @package core
*/
/*EXTRA FUNCTIONS: apc\_.+*/
class apccache
{
/**
* (Plug-in replacement for memcache API) Get data from the persistant cache.
*
* @param mixed Key
* @param ?TIME Minimum timestamp that entries from the cache may hold (NULL: don't care)
* @return ?mixed The data (NULL: not found / NULL entry)
*/
function get($key,$min_cache_date=NULL)
{
$data=apc_fetch($key);
if ($data===false) return NULL;
if (($min_cache_date!==NULL) && ($data[0]<$min_cache_date)) return NULL;
return $data[1];
}
/**
* (Plug-in replacement for memcache API) Put data into the persistant cache.
*
* @param mixed Key
* @param mixed The data
* @param integer Various flags (parameter not used)
* @param integer The expiration time in seconds.
*/
function set($key,$data,$flags,$expire_secs)
{
unset($flags);
// Update list of e-objects
global $ECACHE_OBJECTS;
if (!isset($ECACHE_OBJECTS[$key]))
{
$ECACHE_OBJECTS[$key]=1;
@apc_store(get_file_base().'ECACHE_OBJECTS',$ECACHE_OBJECTS,0);
}
@apc_store($key,array(time(),$data),$expire_secs);
}
/**
* (Plug-in replacement for memcache API) Delete data from the persistant cache.
*
* @param mixed Key name
*/
function delete($key)
{
// Update list of e-objects
global $ECACHE_OBJECTS;
unset($ECACHE_OBJECTS[$key]);
@apc_store(get_file_base().'ECACHE_OBJECTS',$ECACHE_OBJECTS,0);
apc_delete($key);
}
/**
* (Plug-in replacement for memcache API) Remove all data from the persistant cache.
*/
function flush()
{
apc_clear_cache('user');
}
}
Jump to Line
Something went wrong with that request. Please try again.