truongwp/php-static-cache

PHP caching class uses static variable to cache data during runtime

0.1.0 2017-08-28 02:43 UTC

This package is not auto-updated.

Last update: 2024-05-03 18:42:45 UTC


README

PHP caching class uses static variable to cache data during runtime

Installation

Use composer to include the library:

composer require truongwp/php-static-cache

Example

$static_cache = new \Truongwp\StaticCache();

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