Class SaeKV
SAE KV 服务 API
<?php $kv = new SaeKV(); // 初始化SaeKV对象 $ret = $kv->init("accesskey"); //访问授权应用的数据 var_dump($ret); // 增加key-value $ret = $kv->add('abc', 'aaaaaa'); var_dump($ret); // 更新key-value $ret = $kv->set('abc', 'bbbbbb'); var_dump($ret); // 替换key-value $ret = $kv->replace('abc', 'cccccc'); var_dump($ret); // 获得key-value $ret = $kv->get('abc'); var_dump($ret); // 删除key-value $ret = $kv->delete('abc'); var_dump($ret); // 一次获取多个key-values $keys = array(); array_push($keys, 'abc1'); array_push($keys, 'abc2'); array_push($keys, 'abc3'); $ret = $kv->mget($keys); var_dump($ret); // 前缀范围查找key-values $ret = $kv->pkrget('abc', 3); var_dump($ret); // 循环获取所有key-values $ret = $kv->pkrget('', 100); while (true) { var_dump($ret); end($ret); $start_key = key($ret); $i = count($ret); if ($i < 100) break; $ret = $kv->pkrget('', 100, $start_key); } // 获取选项信息 $opts = $kv->get_options(); print_r($opts); // 设置选项信息 (关闭默认urlencode key选项) $opts = array('encodekey' => 0); $ret = $kv->set_options($opts); var_dump($ret);
错误代码及错误提示消息: - 0 "Success" - 10 "AccessKey Error" - 20 "Failed to connect to KV Router Server" - 21 "Get Info Error From KV Router Server" - 22 "Invalid Info From KV Router Server" - 30 "KV Router Server Internal Error" - 31 "KVDB Server is uninited" - 32 "KVDB Server is not ready" - 33 "App is banned" - 34 "KVDB Server is closed" - 35 "Unknown KV status" - 40 "Invalid Parameters" - 41 "Interaction Error (%d) With KV DB Server" - 42 "ResultSet Generation Error" - 43 "Out Of Memory" - 44 "SaeKV constructor was not called" - 45 "Key does not exist"
public
|
|
public
boolean
|
|
public
string|boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
array|boolean
|
|
public
array|boolean
|
|
public
integer
|
|
public
string
|
|
public
array
|
|
public
boolean
|
string |
EMPTY_PREFIXKEY
空KEY前缀 |
#
''
|
integer |
MAX_MGET_SIZE
mget获取的最大KEY个数 |
#
32
|
integer |
MAX_PKRGET_SIZE
pkrget获取的最大KEY个数 |
#
100
|
integer |
MAX_KEY_LENGTH
KEY的最大长度 |
#
200
|
integer |
MAX_VALUE_LENGTH
VALUE的最大长度 (4 * 1024 * 1024) |
#
4194304
|