阿里云Memcache

更新时间:2017-03-30 分类:电脑教程 浏览:537 来源:未知

阿里云Memcache

系统概要

  分布式缓存管理-Memcache 是ACE为开发者提供的分布式缓存服务,用来以共享的方式缓存用户的key-value形式的小数据,以加快数据响应,减轻后端存储的压力。

  分布式缓存管理-memcache模块主要提供以下功能:

1、 初始化memcache连接

2、?获取memcache数据

3、写入memcache数据

4、刷新memcache数据

使用指南

  实用接口:

  bool?Memcache::init?()
array?Memcache::get?( array?$keys?[, array?&$flags?] )
bool?Memcache::set?( string?$key?, mixed?$var?[, int?$flag?[, int?$expire?]] )
bool?add?( string?$key?, mixed?$var?[, int?$flag?[, int?$expire?]] )
bool?replace?( string?$key?, mixed?$var?[, int?$flag?[, int?$expire?]] )??
bool?decrement?( string?$key?[, int?$value?= 1?] )???
bool?increment?( string?$key?[, int?$value?= 1?] )????
bool?delete?( string?$key?[, int?$timeout?= 0?] )??????
bool?close?()

空接口:

亚博app应用下载  bool?addServer*?*(?string?$host?[,?int?$port?= 11211?[,?bool?$persistent?[,?int?$weight?[,?int?$timeout?[,?int?$retry_interval?[,?bool$status?[,?callback?$failure_callback?[,?int?$timeoutms?]]]]]]]] )
bool?connect*?*(?string?$host?[,?int?$port?[,?int?$timeout?]] )
bool?flush*?*(?void?)
bool*?*pconnect?(?string?$host?[,?int?$port?[,?int?$timeout?]] )
bool?setServerParams*?*(?string?$host?[,?int?$port?= 11211?[,?int?$timeout?[,?int?$retry_interval?= false?[,?bool?$status?[,?callback$failure_callback?]]]]] )

用例

  $mem = new Memcache;
$mem->init();
$mem->set('key6', 'hello', 0, 120);
$val = $mem->get('key6');
echo "Get key6 value:".$val."
";
$mem->add('key7', 'welcome you', 0, 120);
$val = $mem->get('key7');
echo "Get add key7 value:".$var."
";
$mem->set('key7', 'welcome', 0, 120);
$val = $mem->get('key7');
echo "Get key7 value:".$val."
";
$mem->set('key8', 'thanks', 0, 120);
$val = $mem->get('key8');
echo "Get key8 value:".$val."
";
$mem->replace('key8', 'thank you', false, 120);
$val = $mem->get('key8');
echo "Get replace key8 value:".$val."
";
$mem->delete('key6');
$val = $mem->get('key6');
echo "Get key6 value after delete:".$val."
";
$mem->close();
?>

本文标题:阿里云Memcache
本文链接:http://www.19haoxue.com/edu/147817.html
上 一 篇:云监控概述
下 一 篇:阿里云Cron服务说明
标  签:阿里云memcacheMemcache阿里云阿里memcache