rodrigoalviani/php-simple-cache

PHP class to cache dynamic pages in file and reduce Database overload.

v0.1.0 2014-12-22 17:18 UTC

This package is not auto-updated.

Last update: 2024-09-24 03:38:53 UTC


README

PHP class to cache dynamic pages in file and reduce Database overload

Install

Install via composer:

{
    "require": {
        "rodrigoalviani/php-simple-cache": "~0.1"
    }
}

Run composer install then use as normal:

require 'vendor/autoload.php';
$cache = new Rodrigoalviani\Cache\Cache($label);

Usage

A very basic usage example:

$cache = new Rodrigoalviani\Cache\Cache($_SERVER['REQUEST_URI']);
$cache->cacheInit();

// your page here

$cache->cacheEnd();

A more advanced example:

$cache = new Rodrigoalviani\Cache\Cache($_SERVER['REQUEST_URI']);
$cache->set_filePath('tmp/');
$cache->set_cacheMaxAge(84600);
$cache->set_cacheExtension('.tmp');
$cache->cacheInit();

// your page here

$cache->cacheEnd();

Credits

PHP Simple Cache was created by Rodrigo Alviani. Released under the MIT license.