coseyo / vercache
version cache base on redis
dev-master
2019-04-21 04:32 UTC
Requires
- php: >=5.4.0
- redis: *
This package is not auto-updated.
Last update: 2020-01-14 20:31:18 UTC
README
version cache by php
Example below
$cache = new Vercache([ 'host' => '127.0.0.1', 'port' => '11211', 'timeout' => 5, 'expire' => 900, 'prefix' => 'test', ]); $version = 'version'; $prefix = 'prefix'; $versionKey = $cache->getVersionKey([ 'user' => 'seyo', 'phone' => '1234', 'page' => 1, ], $version, ['user', 'phone']); $data = $cache->getCache($prefix, 'key_aa', $versionKey); if ($data) { var_dump('get cache'); var_dump($data); } else { var_dump('no cache'); $data = 'value_bb'; $cache->setCache($prefix, 'key_aa', $data, $versionKey); } var_dump('incrVersionNum'); $cache->incrVersionNum($prefix, $versionKey);