easyswoole / fast-cache
An efficient swoole framework
Installs: 28 881
Dependents: 4
Suggesters: 0
Security: 0
Stars: 11
Watchers: 2
Forks: 6
Open Issues: 3
Requires
- php: >=7.1.0
- easyswoole/component: ^2.0
- easyswoole/spl: ^1.1
Requires (Dev)
- easyswoole/phpunit: ^1.0
- easyswoole/swoole-ide-helper: ^1.2
README
EasySwoole FastCache组件通过新开进程,使用SplArray存储,unix sock 高速通信方式,实现了多进程共享数据.
示例代码
use EasySwoole\FastCache\Cache; require 'vendor/autoload.php'; $http = new swoole_http_server("127.0.0.1", 9501); Cache::getInstance()->attachToServer($http); $http->on("request", function ($request, $response) { $res = Cache::getInstance()->set('easyswoole', 'easyswoole'); var_dump($res); $res = Cache::getInstance()->get('easyswoole'); $response->end($res); }); $http->start();
内存问题
数据分散在进程内,一个进程可能需要占用很大的内存,因此请根据实际业务量配置内存大小。
单元测试
服务启动
php example.php
执行测试用例
php vendor/bin/co-phpunit tests