There is no license information available for the latest version (0.0.2) of this package.

Cache Data To Disk

0.0.2 2019-02-16 18:34 UTC

This package is auto-updated.

Last update: 2021-10-27 17:42:16 UTC


A PHP Class to cache frequently accessed Data to a file.

This is intended to be used to cache larger datasets such as database reports to prevent repetative and time / resource consuming data queries.


$file = "my-cache-file"; // File to Use for Cache
$time = "300"; // Seconds to Cache For

$cache = new DataCache($file, $time);
$data = $cache->read();

// Output Cached Version if present
if ($data) {

// Write to Cache and Output of not present
$data = rand(1,15);