pilsetnieks/key-value-api
最新稳定版本:0.3.1
Composer 安装命令:
composer require pilsetnieks/key-value-api
包简介
Simple key-value cache API to abstract the underlying key-value store.
README 文档
README
Simple key-value cache API to abstract the underlying key-value store. Currently implements APC and memcache
Usage example
$KV = new kv(
array('Enabled' => false),
array('Enabled' => true, 'Servers' => $Servers)
);
// Object style
$KV['Value1'] = 'asdf';
echo $KV['Value1']; // Outputs "asdf"
echo '<hr />';
// Static class style
echo kv::get('Value1'); // Outputs "asdf";
echo '<hr />';
kv::set('Value1', 'qwerty');
echo kv::get('Value1'); // Outputs "qwerty";
echo '<hr />';
kv::clear_all();
echo kv::get('Value1'); // Outputs "";
echo '<hr />';
kv::set('TestNumber', 42);
echo $KV['TestNumber'];
echo '<hr />';
kv::inc('TestNumber', 2);
echo $KV['TestNumber'];
Servers for memcache can be specified in multiple ways:
$Servers = [
['localhost', 11211],
['127.0.0.1']
];
$Servers = ['localhost:11211', '127.0.0.1'];
$Servers = 'localhost11211;127.0.0.1';
$KV = new kv(
array('Enabled' => false),
array('Enabled' => true, 'Servers' => $Servers)
);
统计信息
- 总下载量: 1.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-11