本文整理汇总了PHP中eaccelerator_put函数的典型用法代码示例。如果您正苦于以下问题:PHP eaccelerator_put函数的具体用法?PHP eaccelerator_put怎么用?PHP eaccelerator_put使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eaccelerator_put函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* Set a value based on an id. Optionally add tags.
*
* @param string id
* @param mixed data
* @param integer lifetime [Optional]
* @return boolean
*/
public function set($id, $data, $lifetime = NULL)
{
if (NULL === $lifetime) {
$lifetime = time() + $this->_default_expire;
}
return eaccelerator_put($this->sanitize_id($id), $data, $lifetime);
}
示例2: set
public function set($id, $data, array $tags = NULL, $lifetime)
{
if (!empty($tags)) {
Kohana::log('error', 'tags are unsupported by the eAccelerator driver');
}
return eaccelerator_put($id, $data, $lifetime);
}
示例3: set
/**
* Set cache
*
* @param string $key
* @param mixed $value
* @param int $ttl
* @return boolean
*/
public function set($key, $value, $ttl = null)
{
if (null === $ttl) {
$ttl = $this->_options['ttl'];
}
return eaccelerator_put($key, $value, $ttl);
}
示例4: put
/**
* Write an item to the cache.
*
* @param string The name of the cache
* @param mixed The data to write to the cache item
* @return boolean True on success, false on failure
*/
function put($name, $contents)
{
eaccelerator_lock($this->unique_id . "_" . $name);
$status = eaccelerator_put($this->unique_id . "_" . $name, serialize($contents));
eaccelerator_unlock($this->unique_id . "_" . $name);
return $status;
}
示例5: set
/**
* 写入缓存
* @access public
* @param string $name 缓存变量名
* @param mixed $value 存储数据
* @param integer $expire 有效时间(秒)
* @return boolen
*/
public function set($name, $value, $expire = null)
{
\think\Cache::$writeTimes++;
if (is_null($expire)) {
$expire = $this->options['expire'];
}
$name = $this->options['prefix'] . $name;
eaccelerator_lock($name);
if (eaccelerator_put($name, $value, $expire)) {
if ($this->options['length'] > 0) {
// 记录缓存队列
$queue = eaccelerator_get('__info__');
if (!$queue) {
$queue = [];
}
if (false === array_search($name, $queue)) {
array_push($queue, $name);
}
if (count($queue) > $this->options['length']) {
// 出列
$key = array_shift($queue);
// 删除缓存
eaccelerator_rm($key);
}
eaccelerator_put('__info__', $queue);
}
return true;
}
return false;
}
示例6: set
/**
* Set a value based on an id. Optionally add tags.
*
* @param string id
* @param mixed data
* @param integer lifetime [Optional]
* @return boolean
*/
public function set($id, $data, $lifetime = NULL)
{
if ($lifetime === NULL) {
$lifetime = time() + Arr::get($this->_config, 'default_expire', Cache::DEFAULT_EXPIRE);
}
return eaccelerator_put($this->_sanitize_id($id), $data, $lifetime);
}
示例7: getClassPath
function getClassPath()
{
static $classpath = array();
if (!empty($classpath)) {
return $classpath;
}
if (function_exists("apc_fetch")) {
$classpath = apc_fetch("fw:root:autoload:map:1397705849");
if ($classpath) {
return $classpath;
}
$classpath = getClassMapDef();
apc_store("fw:root:autoload:map:1397705849", $classpath);
} else {
if (function_exists("eaccelerator_get")) {
$classpath = eaccelerator_get("fw:root:autoload:map:1397705849");
if ($classpath) {
return $classpath;
}
$classpath = getClassMapDef();
eaccelerator_put("fw:root:autoload:map:1397705849", $classpath);
} else {
$classpath = getClassMapDef();
}
}
return $classpath;
}
示例8: set
/**
*/
public function set($key, $data, $lifetime = 0)
{
$key = $this->_params['prefix'] . $key;
if (eaccelerator_put($key . '_expire', time(), $lifetime)) {
eaccelerator_put($key, $data, $lifetime);
}
}
示例9: putInCache
/**
* Put data into remote cache store
*
* @param string Cache unique key
* @param string Cache value to add
* @param integer [Optional] Time to live
* @return @e boolean
*/
public function putInCache($key, $value, $ttl = 0)
{
eaccelerator_lock(md5($this->identifier . $key));
$check = eaccelerator_put(md5($this->identifier . $key), $value, intval($ttl));
eaccelerator_unlock(md5($this->identifier . $key));
return $check;
}
示例10: add
/**
* add
* @param string $key
* @param string|array|object $value
* @param int $ttl
* @param string $tableName
* @param resource $connectionResource
* @return boolean
*/
public function add($key, $value, $ttl = 0, $tableName = '', $connectionResource = null)
{
$connectionResource = null;
$value = serialize($value);
//eAccelerator doesn't serialize object
return eaccelerator_put($this->getRealKey($tableName, $key), $value, $ttl);
}
示例11: set
public function set($key, $value, $ttl)
{
$expires = $_SERVER['REQUEST_TIME'] + $ttl;
// prepend the application expiration time to the value and save
// the value to cache. the "real" timeout is far in the future.
eaccelerator_put($key, "{$expires}:{$value}", 3600);
// 1 hour
}
示例12: setMulti
public function setMulti($items, $ttl = 0)
{
$status = FALSE;
foreach ($items as $key => $value) {
$status = eaccelerator_put($key, $value, $ttl);
}
return $status;
}
示例13: set
/**
* 设置一个缓存变量
*
* @access public
*
* @param string $key 缓存Key
* @param mixed $value 缓存内容
* @param int $expire 缓存时间(秒)
*
* @return boolean
*/
public function set($key, $value, $expire = null)
{
//参数分析
if (!$key) {
return false;
}
$expire = is_null($expire) ? $this->_defaultOptions['expire'] : $expire;
return eaccelerator_put($key, $value, $expire);
}
示例14: put
function put($name, $data, $ttl = 604800)
{
$ttl = (int) $ttl ? (int) $ttl : 604800;
if (eaccelerator_lock($this->key . $name)) {
eaccelerator_put($this->key . $name, serialize($data), $ttl);
eaccelerator_unlock($this->key . $name);
}
$this->vars[$name] = $data;
}
示例15: set
public function set($key, $value, $type = '', $ttl = SESSION_EXPIRE)
{
$this->type = $type;
$name = $this->_key($key);
eaccelerator_lock($name);
if (eaccelerator_put($name, $value, $ttl)) {
return true;
}
return false;
}