sanzodown/simple-php-cache

A simple cache library in php.

dev-master 2019-04-26 20:37 UTC

This package is not auto-updated.

Last update: 2024-09-23 08:13:58 UTC


README

A simple cache library for php. It implement both a file and a memory (APCu) cache back-ends.

Installation

As simple as :

composer require sanzodown/simple-php-cache

Usage

Both come with default configuration so if you don't bother, use it.

File cache:

$cache = new FileCache(
    'your/cache/path',
    'youNameFile'
);

Memory cache:

Note that you must have the extension APCu enabled.

$cache = new ApcCache(
    3600, // Time to live
);

Methods:

$cache->set('key', 'Your datas');

$cache->get('test'); // Your datas