数据缓存
数据缓存, (*1)
include './vendor/autoload.php'; $config = array( 'default' => array( 'type' => 'File', 'path' => '/var/www/test/cache/', 'prefix' => '', ), 'redis' => array( 'type' => 'Redis', 'host' => '127.0.0.1', 'port' => '6379', 'password' => '123456', 'prefix' => 'web.', ), ); $cache = new HuTong\Cache\Storage($config); $val = $cache->store()->increment('getVal'); var_dump($val); $val = $cache->store('redis')->increment('getVal'); var_dump($val); 输出: int(1) int(1)
$val = $cache->store()->set('getVal','33'); $val = $cache->store()->get('getVal'); 3分钟过期 $val = $cache->store()->expire('getVal',33); 33秒钟过期 $val = $cache->store()->expire('getVal',33,1); $val = $cache->store()->del('getVal'); $val = $cache->store()->increment('getVal'); $val = $cache->store()->decrement('getVal'); $val = $cache->store()->flush();
630730920, (*2)