选择语言 :

Driver_Cache_Driver_Redis
    └ Module_Cache_Driver

Redis缓存驱动器

API - Driver_Cache_Driver_Redis

继承自父类的方法和变量
author
呼吸二氧化碳 jonwang@myqee.com
category
Module
package
Cache
copyright
Copyright © 2008-2013 myqee.com
license
http://www.myqee.com/license.html

$this->__construct( $config_name = 'default')

Redis缓存驱动器

参数列表

参数 类型 描述 默认值
$config_name $config_name 配置名或数组 string(7) "default"

$this->__destruct( )


$this->_connect( )

连接服务器


$this->close_connect( )

关闭连接


$this->get( $key )

取得数据,支持批量取

参数列表

参数 类型 描述 默认值
$key string/array $key
返回值
  • mixed

$this->set( $key , $value = null, $lifetime = 3600)

存数据,支持多存

参数列表

参数 类型 描述 默认值
$key string/array $key
$value $data Value 多存时此项可空 null
$lifetime $lifetime 有效期,默认3600,即1小时,0表示最大值30天(2592000) integer 3600
返回值
  • boolean

$this->delete( $key )

删除指定key的缓存,若$key===true则表示删除全部

参数列表

参数 类型 描述 默认值
$key string $key

$this->delete_all( )

删除全部


$this->delete_expired( )

过期数据会自动清除


$this->decrement( $key , $offset = 1, $lifetime = 60)

递减 与原始decrement方法区别的是若不存指定KEY时返回false,这个会自动递减

参数列表

参数 类型 描述 默认值
$key string $key
$offset int $offset integer 1
$lifetime unknown integer 60

$this->increment( $key , $offset = 1, $lifetime = 60)

递增 与原始increment方法区别的是若不存指定KEY时返回false,这个会自动递增

参数列表

参数 类型 描述 默认值
$key string $key
$offset int $offset integer 1
$lifetime unknown integer 60

$this->__call( )


Cache_Driver_Redis::close_all_connect( )

关闭所有链接


$this->set_prefix( $prefix )

设置前缀

参数列表

参数 类型 描述 默认值
$prefix string $prefix
返回值
  • $this