php7.0扩展yac,php扩展之yac安装
git克隆
$ git clone https://github.com/laruence/yac.git
解壓安裝
注意這里的php-config可能不一樣
查看php-config位置
$whereis php
編譯安裝
$ cd yac
$ phpize
$ ./configure --with-php-config=/usr/bin/php-config
$ make
$ make install
修改php.ini,載入擴(kuò)展,重啟php-fpm
extension = yac.so
yac.enable = 1
yac.keys_memory_size = 4M
yac.values_memory_size = 64M
yac.compress_threshold = -1
yac.enable_cli = 0
# 重啟php-fpm
service php-fpm reload
檢查是否安裝成功
$ php -m
用法
實(shí)例化
use Yac
$yac = new Yac();
set
Yac::set($key, $value,$ttl])
Yac::set(array $kvs,$ttl])
$yac->set("foo", "bar");
$yac->set(
array(
"dummy" => "foo",
"dummy2" => "foo",
)
);
get
Yac::get(array|string $key)
$yac->get("dummy");
$yac->get(array("dummy", "dummy2"));
delete
delay表示延遲多少秒刪除
Removes a stored variable from the cache. If delay is specified, then the value will be deleted after $delay seconds.
$yac->delete(array|string $keys,$delay=0)
flush
Immediately invalidates all existing items. it doesn't actually free any resources, it only marks all the items as invalid.
$yac->flush()
info
查看chche信息
$yac->info()
我們不一樣
總結(jié)
以上是生活随笔為你收集整理的php7.0扩展yac,php扩展之yac安装的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java继承_java继承
- 下一篇: 苹果笔记本电脑好用吗_笔记本电脑市场格局