truongwp/php-static-cache

PHP缓存类使用静态变量在运行时缓存数据

0.1.0 2017-08-28 02:43 UTC

This package is not auto-updated.

Last update: 2024-09-20 20:16:11 UTC


README

PHP缓存类使用静态变量在运行时缓存数据

安装

使用composer包含库

composer require truongwp/php-static-cache

示例

$static_cache = new \Truongwp\StaticCache();

if ( $static_cache->has( 'key' ) ) {
	$value = $static_cache->get( 'key' );
} else {
	$value = do_something();
	$static_cache->set( 'key', $value );
}