PHP的51个Memcached方法(32-41)

来源:互联网 发布:cisco 配置多个端口 编辑:程序博客网 时间:2024/06/06 13:00
  1. public array getVersion ( void )
    返回一个Memcached版本号数组,数组的每个元素对应一个服务器,key是IP:端口,value是版本号,对应于客户端的服务器列表中维护的服务器。
    格式为:

    array([服务器1的IP:服务器1的端口]=>服务器1的Memcached版本号,
    [服务器2的IP:服务器2的端口]=>服务器2的Memcached版本号
    ...)
  2. public int increment ( string $key [, int $offset = 1 [, int $initial_value = 0 [, int $expiry = 0 ]]] )
    与decrement相反,将服务器端Memcached中key是$key的数据取出,其值加上offset后得到该数据的新值再设置回去,如果没找到相关数据,则执行add($key,$initial_value,$expiry)

  3. public int incrementByKey ( string $server_key , string $key [, int $offset = 1 [, int $initial_value = 0 [, int $expiry = 0 ]]] )
    与increment()相同,操作在$server_key对应的服务器上进行,要求待带操作的key是$key的数据是使用$server_key存入的。

  4. public bool isPersistent ( void )
    判断当前Memcached对象使用的与服务器端的连接是持久的还是一次性的,如果对象创建的时候设置了$persistent_id参数,则是持久的,否则不是。持久的连接可以跨请求(脚本),不持久的连接在脚本结束时被销毁。

  5. public bool isPristine ( void )
    判断当前Memcached对象使用的与服务器的连接是否是新建的,如果对象创建的时候没有设置$persistent_id参数或者是第一个使用该$persistent_id的对象,则返回TRUE,否则为FALSE.

  6. public bool prepend ( string $key , string $value )
    从服务器的Memcached中取出key是$key的数据,在其值的末尾追加$value形成新的值,并将新值写回Memcached.

  7. public bool prependByKey ( string $server_key , string $key , string $value )
    同prepend(),但仅在$server_key对应服务器上进行操作。

  8. public bool quit ( void )
    主动通知服务器关闭所当前Memcached对象使用的所有连接。

  9. public bool replace ( string $key , mixed $value [, int $expiration ] )
    替换服务器上Memcached中key是$key的数据的值为$value,如果没有key是$key的数据则操作失败。
    如果设置了$expiration则更新数据的存活时间,相关说明同set().

  10. public bool replaceByKey ( string $server_key , string $key , mixed $value [, int $expiration ] )
    同replace,但仅在$server_key对应服务器上进行操作。

0 0
原创粉丝点击