php-platform / json-cache
Installs: 2 734
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3
Requires (Dev)
- phpunit/phpunit: ~4.8
This package is not auto-updated.
Last update: 2024-12-22 02:37:33 UTC
README
Whole PHP Platform is built by using Meta Data in JSON Format. This package provides caching for JSON Metadata
Usage
- to read from cache
PhpPlatform\JSONCache\Cache::getInstance()->getData($key);
where $key
is string representaion of json path for required cached value
- to store in cache
PhpPlatform\JSONCache\Cache::getInstance()->setData($data);
where $data
is an array
to be stored in the cache
- to reset cache
PhpPlatform\JSONCache\Cache::getInstance()->reset();
Extending the cache
PhpPlatform\JSONCache\Cache
can be extended to create user defined caches
class NewCache extends PhpPlatform\JSONCache\Cache{ private static $cacheObj = null; protected $cacheFileName = "newcachefile"; // new cache filename public static function getInstance(){ if(self::$cacheObj == null){ self::$cacheObj = new NewCache(); } return self::$cacheObj; } }
Example
Please see the test TestCache for more examples