*/
public function get($key, $lifetime = 1)
{
+ $key = $this->_params['prefix'] . $key;
$this->_setExpire($key, $lifetime);
return apc_fetch($key);
}
*/
public function set($key, $data, $lifetime = null)
{
+ $key = $this->_params['prefix'] . $key;
$lifetime = $this->_getLifetime($lifetime);
apc_store($key . '_expire', time(), $lifetime);
return apc_store($key, $data, $lifetime);
*/
public function exists($key, $lifetime = 1)
{
+ $key = $this->_params['prefix'] . $key;
$this->_setExpire($key, $lifetime);
return (apc_fetch($key) === false) ? false : true;
}
*/
public function expire($key)
{
+ $key = $this->_params['prefix'] . $key;
apc_delete($key . '_expire');
return apc_delete($key);
}
*/
protected function _setExpire($key, $lifetime)
{
+ $key = $this->_params['prefix'] . $key;
if ($lifetime == 0) {
// Don't expire.
return;
}
$this->_params = array_merge($this->_params, $params);
+ if (empty($this->_params['prefix'])) {
+ $this->_params['prefix'] = $_SERVER['SERVER_NAME']
+ ? $_SERVER['SERVER_NAME']
+ : $_SERVER['HOSTNAME'];
+ }
}
/**
*/
public function get($key, $lifetime = 1)
{
+ $key = $this->_params['prefix'] . $key;
$this->_setExpire($key, $lifetime);
return eaccelerator_get($key);
}
*/
public function set($key, $data, $lifetime = null)
{
+ $key = $this->_params['prefix'] . $key;
$lifetime = $this->_getLifetime($lifetime);
eaccelerator_put($key . '_expire', time(), $lifetime);
return eaccelerator_put($key, $data, $lifetime);
*/
public function exists($key, $lifetime = 1)
{
+ $key = $this->_params['prefix'] . $key;
$this->_setExpire($key, $lifetime);
return (eaccelerator_get($key) === false) ? false : true;
}
*/
public function expire($key)
{
+ $key = $this->_params['prefix'] . $key;
eaccelerator_rm($key . '_expire');
return eaccelerator_rm($key);
}
return;
}
+ $key = $this->_params['prefix'] . $key;
$expire = eaccelerator_get($key . '_expire');
// Set prune period.
protected $_dir;
/**
- * The filename prefix for cache files.
- *
- * @var string
- */
- protected $_prefix = 'cache_';
-
- /**
- * The subdirectory level the cache files should live at.
- *
- * @var integer
- */
- protected $_sub = 0;
-
- /**
* List of key to filename mappings.
*
* @var array
? $params['dir']
: Horde_Util::getTempDir();
- if (isset($params['prefix'])) {
- $this->_prefix = $params['prefix'];
+ if (!isset($params['prefix'])) {
+ $params['prefix'] = 'cache_';
}
- if (isset($params['sub'])) {
- $this->_sub = intval($params['sub']);
+ if (!isset($params['sub'])) {
+ $params['sub'] = 0;
}
parent::__construct($params);
$dir = $this->_dir . '/';
$sub = '';
$md5 = md5($key);
- if (!empty($this->_sub)) {
- $max = min($this->_sub, strlen($md5));
+ if (!empty($this->_params['sub'])) {
+ $max = min($this->_params['sub'], strlen($md5));
for ($i = 0; $i < $max; $i++) {
$sub .= $md5[$i];
if ($create && !is_dir($dir . $sub)) {
$sub .= '/';
}
}
- $this->_file[$key] = $dir . $sub . $this->_prefix . $md5;
+ $this->_file[$key] = $dir . $sub . $this->_params['prefix'] . $md5;
}
return $this->_file[$key];
continue;
}
- if (strpos($entry, $this->_prefix) === 0) {
+ if (strpos($entry, $this->_params['prefix']) === 0) {
$d_time = isset($excepts[$path]) ? $excepts[$path] : $this->_params['lifetime'];
if (!empty($d_time) &&
(($c_time - $d_time) > filemtime($path))) {
@unlink($path);
unset($excepts[$path]);
}
- } elseif (!empty($this->_sub) && is_dir($path)) {
+ } elseif (!empty($this->_params['sub']) && is_dir($path)) {
$this->_gcDir($path, $excepts);
}
}
*/
public function get($key, $lifetime = 1)
{
+ $key = $this->_params['prefix'] . $key;
if (isset($this->_expirecache[$key])) {
return $this->_expirecache[$key];
}
*/
public function set($key, $data, $lifetime = null)
{
+ $key = $this->_params['prefix'] . $key;
$lifetime = $this->_getLifetime($lifetime);
+
return ($this->_memcache->set($key . '_e', time(), $lifetime) === false)
? false
: $this->_memcache->set($key, $data, $lifetime);
*/
public function exists($key, $lifetime = 1)
{
+ $key = $this->_params['prefix'] . $key;
+
return ($this->get($key, $lifetime) !== false);
}
*/
public function expire($key)
{
+ $key = $this->_params['prefix'] . $key;
unset($this->_expirecache[$key]);
$this->_memcache->delete($key . '_e');
+
return $this->_memcache->delete($key);
}
class Horde_Cache_Xcache extends Horde_Cache_Base
{
/**
- * Construct a new Horde_Cache_Xcache object.
- *
- * @param array $params Configuration parameters:
- * <pre>
- * 'prefix' - (string) Key prefix.
- * </pre>
- */
- public function __construct($params = array())
- {
- parent::__construct($params);
-
- if (empty($this->_params['prefix'])) {
- $this->_params['prefix'] = $_SERVER['SERVER_NAME']
- ? $_SERVER['SERVER_NAME']
- : $_SERVER['HOSTNAME'];
- }
- }
-
- /**
* Attempts to retrieve a piece of cached data and return it to the caller.
*
* @param string $key Cache key to fetch.
*/
protected function _setExpire($key, $lifetime)
{
- $key = $this->_params['prefix'] . $key;
if ($lifetime == 0) {
// don't expire
return;
}
-
+ $key = $this->_params['prefix'] . $key;
$expire = xcache_get($key . '_expire');
// set prune period
*/
public function get($key, $lifetime = 1)
{
+ $key = $this->_params['prefix'] . $key;
return output_cache_get($key, $lifetime);
}
*/
public function set($key, $data, $lifetime = null)
{
+ $key = $this->_params['prefix'] . $key;
output_cache_put($key, $data);
return true;
}
*/
public function exists($key, $lifetime = 1)
{
+ $key = $this->_params['prefix'] . $key;
$exists = output_cache_exists($key, $lifetime);
output_cache_stop();
return $exists;
*/
public function expire($key)
{
+ $key = $this->_params['prefix'] . $key;
return output_cache_remove_key($key);
}
--- /dev/null
+<?php
+/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
+// $Id: dd4b5b37397f084ee826751d6aee0bb5dca8d833 $
+$conf['vhosts'] = false;
+$conf['debug_level'] = E_ALL & ~E_DEPRECATED;
+$conf['max_exec_time'] = 0;
+$conf['compress_pages'] = false;
+$conf['secret_key'] = 'f3f2eb066cee536a156bf47ed7c403fa3800d975';
+$conf['umask'] = 077;
+$conf['testdisable'] = false;
+$conf['use_ssl'] = 0;
+$conf['server']['name'] = $_SERVER['SERVER_NAME'];
+$conf['server']['port'] = 80;
+$conf['urls']['token_lifetime'] = 30;
+$conf['urls']['hmac_lifetime'] = 30;
+$conf['urls']['pretty'] = false;
+$conf['safe_ips'] = array();
+$conf['session']['name'] = 'Horde';
+$conf['session']['use_only_cookies'] = true;
+$conf['session']['cache_limiter'] = 'nocache';
+$conf['session']['timeout'] = 0;
+$conf['cookie']['domain'] = '';
+$conf['cookie']['path'] = '/horde';
+$conf['sql']['persistent'] = true;
+$conf['sql']['username'] = 'root';
+$conf['sql']['password'] = 'ashley42';
+$conf['sql']['socket'] = '/opt/local/var/run/mysql5/mysqld.sock';
+$conf['sql']['protocol'] = 'unix';
+$conf['sql']['database'] = 'horde';
+$conf['sql']['charset'] = 'iso-8859-1';
+$conf['sql']['ssl'] = false;
+$conf['sql']['splitread'] = false;
+$conf['sql']['phptype'] = 'mysql';
+$conf['ldap']['useldap'] = false;
+$conf['auth']['admins'] = array('mike', 'mrubinsk');
+$conf['auth']['checkip'] = true;
+$conf['auth']['checkbrowser'] = true;
+$conf['auth']['alternate_login'] = false;
+$conf['auth']['redirect_on_logout'] = false;
+$conf['auth']['list_users'] = 'list';
+$conf['auth']['params']['app'] = 'imp';
+$conf['auth']['driver'] = 'application';
+$conf['signup']['allow'] = false;
+$conf['log']['priority'] = 'DEBUG';
+$conf['log']['ident'] = 'HORDE';
+$conf['log']['name'] = '/tmp/horde.log';
+$conf['log']['params']['append'] = true;
+$conf['log']['params']['format'] = 'default';
+$conf['log']['type'] = 'file';
+$conf['log']['enabled'] = true;
+$conf['log_accesskeys'] = false;
+$conf['prefs']['params']['driverconfig'] = 'horde';
+$conf['prefs']['driver'] = 'Sql';
+$conf['alarms']['params']['driverconfig'] = 'horde';
+$conf['alarms']['params']['ttl'] = 300;
+$conf['alarms']['driver'] = 'Sql';
+$conf['datatree']['driver'] = 'null';
+$conf['group']['driverconfig'] = 'horde';
+$conf['group']['driver'] = 'sql';
+$conf['group']['cache'] = true;
+$conf['perms']['driverconfig'] = 'horde';
+$conf['perms']['driver'] = 'Sql';
+$conf['share']['no_sharing'] = false;
+$conf['share']['world'] = true;
+$conf['share']['any_group'] = false;
+$conf['share']['hidden'] = false;
+$conf['share']['cache'] = false;
+$conf['share']['driver'] = 'sql';
+$conf['cache']['default_lifetime'] = 86400;
+$conf['cache']['params']['sub'] = 0;
+$conf['cache']['driver'] = 'File';
+$conf['cache']['use_memorycache'] = '';
+$conf['cachejs'] = false;
+$conf['cachecss'] = false;
+$conf['lock']['params']['driverconfig'] = 'horde';
+$conf['lock']['driver'] = 'Sql';
+$conf['token']['driver'] = 'Null';
+$conf['mailer']['params']['host'] = 'prod.theupstairsroom.com';
+$conf['mailer']['params']['localhost'] = 'macbook';
+$conf['mailer']['params']['auth'] = true;
+$conf['mailer']['params']['username'] = 'mike';
+$conf['mailer']['params']['password'] = 'n329sp';
+$conf['mailer']['type'] = 'smtp';
+$conf['mailformat']['brokenrfc2231'] = false;
+$conf['vfs']['params']['vfsroot'] = '/private/var/www/vfs';
+$conf['vfs']['type'] = 'file';
+$conf['sessionhandler']['type'] = 'Builtin';
+$conf['sessionhandler']['memcache'] = false;
+$conf['spell']['driver'] = '';
+$conf['gnupg']['keyserver'] = array('pgp.mit.edu');
+$conf['gnupg']['timeout'] = 10;
+$conf['image']['convert'] = '/opt/local/bin/convert';
+$conf['image']['identify'] = '/opt/local/bin/identify';
+$conf['image']['driver'] = 'Im';
+$conf['exif']['params']['exiftool'] = '/usr/bin/exiftool';
+$conf['exif']['driver'] = 'Exiftool';
+$conf['problems']['email'] = 'webmaster@example.com';
+$conf['problems']['maildomain'] = 'example.com';
+$conf['problems']['tickets'] = false;
+$conf['problems']['attachments'] = true;
+$conf['menu']['apps'] = array('ansel', 'horde', 'kronolith', 'turba');
+$conf['menu']['always'] = false;
+$conf['menu']['links']['help'] = 'all';
+$conf['menu']['links']['options'] = 'authenticated';
+$conf['menu']['links']['problem'] = 'all';
+$conf['menu']['links']['login'] = 'all';
+$conf['menu']['links']['logout'] = 'authenticated';
+$conf['portal']['fixed_blocks'] = array();
+$conf['weatherdotcom']['partner_id'] = '1004348024';
+$conf['weatherdotcom']['license_key'] = '15f65ed83a72d390';
+$conf['accounts']['driver'] = 'null';
+$conf['user']['verify_from_addr'] = false;
+$conf['api']['googlemaps'] = 'ABQIAAAAeLpMkRs_mXYrgoYSYk-zjhQle6r-2n9p_aVW9HzTuTHtJvxrbBQga60uPmHeQchudKTUsj6BCUPFWw';
+$conf['facebook']['key'] = '5fe552bd96b094ba52bec1cb27034539';
+$conf['facebook']['secret'] = '3a17c63e7d55878ad3bd4d44aea2f59f';
+$conf['facebook']['enabled'] = true;
+$conf['twitter']['enabled'] = false;
+$conf['imsp']['enabled'] = false;
+$conf['kolab']['enabled'] = false;
+$conf['memcache']['enabled'] = false;
+$conf['activesync']['state']['params']['devicetable'] = 'horde_activesync_device';
+$conf['activesync']['state']['params']['statetable'] = 'horde_activesync_state';
+$conf['activesync']['state']['params']['maptable'] = 'horde_activesync_map';
+$conf['activesync']['state']['params']['userstable'] = 'horde_activesync_device_users';
+$conf['activesync']['state']['driver'] = 'history';
+$conf['activesync']['logging']['path'] = '/tmp/activesync.txt';
+$conf['activesync']['logging']['type'] = 'custom';
+$conf['activesync']['ping']['forcedheartbeat'] = 60;
+$conf['activesync']['ping']['deviceping'] = false;
+$conf['activesync']['ping']['waitinterval'] = 2;
+$conf['activesync']['securitypolicies']['provisioning'] = false;
+$conf['activesync']['enabled'] = true;
+/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */
select a driver here. This is used to speed up portions of Horde by storing
commonly processed objects.">file
<case name="Null" desc="Don't cache any objects"/>
- <case name="Apc" desc="Use the APC cache"/>
+ <case name="Apc" desc="Use the APC cache">
+ <configsection name="params">
+ <configstring name="prefix" required="false" desc="The prefix to use for
+ cache entries."/>
+ </configsection>
+ </case>
<case name="Eaccelerator" desc="Use the eAccelerator cache (up to version
0.9.5)">
<configdescription>
you want to use the eAccelerator cache driver, you need version 0.9.5 or
lower.
</configdescription>
+ <configsection name="params">
+ <configstring name="prefix" required="false" desc="The prefix to use for
+ cache entries."/>
+ </configsection>
</case>
<case name="File" desc="Store objects in filesystem">
<configsection name="params">
use for the cache files."/>
</configsection>
</case>
- <case name="Memcache" desc="Use a Memcache server"/>
+ <case name="Memcache" desc="Use a Memcache server">
+ <configsection name="params">
+ <configstring name="prefix" required="false" desc="The prefix to use for
+ cache entries."/>
+ </configsection>
+ </case>
<case name="Sql" desc="SQL-based cache storage">
<configsection name="params">
<configsql switchname="driverconfig">
</configsql>
</configsection>
</case>
- <case name="Xcache" desc="Use the xCache cache"/>
- <case name="Zps4" desc="Use the Zend Performance Suite output cache"/>
+ <case name="Xcache" desc="Use the xCache cache">
+ <configsection name="params">
+ <configstring name="prefix" required="false" desc="The prefix to use for
+ cache entries."/>
+ </configsection>
+ </case>
+ <case name="Zps4" desc="Use the Zend Performance Suite output cache">
+ <configsection name="params">
+ <configstring name="prefix" required="false" desc="The prefix to use for
+ cache entries."/>
+ </configsection>
+ </case>
</configswitch>
<configswitch name="use_memorycache" required="false" desc="Use a
separate memory cache driver to store data in memory? If data is not found