Yac 5.2+ 共享缓存
最后更新于:2022-04-02 02:24:58
[TOC]
> [鸟哥博客](http://www.laruence.com/2013/03/18/2846.html)
> [github](https://github.com/laruence/yac)
## 概述
- 支持 window
- 支持过期时间
## 安装
`sudo pecl install yac`
## ini
```
yac.enable = 1
yac.keys_memory_size = 4M ; 4M can get 30K key slots, 32M can get 100K key slots
yac.values_memory_size = 64M
yac.compress_threshold = -1
yac.enable_cli = 0 ; whether enable yac with cli, default 0
```
## demo
```
Yac {
/* 属性 */
protected $_prefix ;
/* 方法 */
public __construct ( string $prefix = "" )
public add ( string $keys , mixed $value , int $ttl = 0 ) : bool
public add ( array $key_vals ) : bool
public delete ( string|array $keys , int $ttl = ? ) : bool
public dump ( int $$num ) : mixed
public flush ( ) : bool
public get ( string|array $key , int &$cas = null ) : mixed
public __get ( string $key ) : mixed
public info ( ) : array
public set ( string $keys , mixed $value , int $ttl = 0 ) : bool
public add ( array $key_vals ) : bool
public __set ( string $keys , mixed $value ) : mixed
}
```
';