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: 2020-03-27 13:58:31 UTC


README

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.

Usage

$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) {
    die($data);
}

// Write to Cache and Output of not present
$data = rand(1,15);
$cache->write($data);
die($data);