thruster/data-cacher

Thruster DataCacher Component

1.0.0 2015-12-06 15:09 UTC

This package is auto-updated.

Last update: 2024-11-14 03:05:46 UTC


README

[Latest Version] (https://github.com/ThrusterIO/data-cacher/releases) [Software License] (LICENSE) [Build Status] (https://travis-ci.org/ThrusterIO/data-cacher) [Code Coverage] (https://scrutinizer-ci.com/g/ThrusterIO/data-cacher) [Quality Score] (https://scrutinizer-ci.com/g/ThrusterIO/data-cacher) [Total Downloads] (https://packagist.org/packages/thruster/data-cacher)

[Email] (mailto:team@thruster.io)

The Thruster DataCacher Component.

Install

Via Composer

$ composer require thruster/data-cacher

Usage

$someCacher = new class extends BaseDataCacher
{
    public static function getName() : string
    {
        return 'some_cacher';
    }
    
    public function getKey($keyData) : array
    {
        return ['some', $keyData];
    }
    
    public function getTTL() : int
    {
        return 60 * 60 * 24 * 7
    }
};

$dataCacher = new DataCacher($driver, $someCacher);

$dataCacher->cache($object->getId(), $object);
$dataCacher->get(101);

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

License

Please see License File for more information.