$ git clone https://github.com/laruence/yac.git
注意这里的php-config可能不一样
$whereis php
$ cd yac
$ phpize
$ ./configure --with-php-config=/usr/bin/php-config
$ make
$ make install
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
use Yac
$yac = new Yac();
Yac::set($key, $value,$ttl])
Yac::set(array $kvs,$ttl])
<?php
$yac->set("foo", "bar");
$yac->set(
array(
"dummy" => "foo",
"dummy2" => "foo",
)
);
Yac::get(array|string $key)
<?php
$yac->get("dummy");
$yac->get(array("dummy", "dummy2"));
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)
Immediately invalidates all existing items. it doesn't actually free any resources, it only marks all the items as invalid.
$yac->flush()
查看chche信息
$yac->info()
我们不一样