2017 © Pedro Peláez
 

library cache

Simple Cache.

image

amber/cache

Simple Cache.

  • Wednesday, July 25, 2018
  • by systemson
  • Repository
  • 0 Watchers
  • 0 Stars
  • 149 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 645 % Grown

The README.md

GitHub last commit Latest Stable Version Latest Beta Version PHP from Packagist Build Status Coverage Status Total Downloads GitHub, (*1)

Amber/Cache

Simple and fast cache system implementing PSR-16: interface for caching libraries, (*2)

Getting started

Installation

With Composer, (*3)

$ composer require amber/cache

API Usage

use Amber\Cache\Cache;

$cache = Cache::getInstance();

Drivers

Alternatively you can set the driver before geting the instance of the cache., (*4)

use Amber\Cache\Cache;

$cache = Cache::driver('file');

You can choose from these drivers:, (*5)

$drivers = [
    'file'  => 'Amber\Cache\Driver\SimpleCache',
    'json'  => 'Amber\Cache\Driver\JsonCache',
    'array' => 'Amber\Cache\Driver\ArrayCache',
    'apcu'  => 'Amber\Cache\Driver\ApcuCache',
];

Or you could set the driver class:, (*6)

$cache = Cache::driver(Amber\Cache\Driver\SimpleCache::class);

Finally you could instantiate the driver by yourself:, (*7)

$cache = new \Amber\Cache\Driver\SimpleCache();

get()

Fetches a value from the cache., (*8)

$cache->get($key, $default = null);

set()

Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time., (*9)

$cache->set($key, $value, $ttl = null);

delete()

Delete an item from the cache by its unique key., (*10)

$cache->delete($key);

clear()

Wipes clean the entire cache's keys., (*11)

$cache->clear();

has()

Determines whether an item is present in the cache., (*12)

$cache->has($key);

Multiple actions

getMultiple()

Obtains multiple cache items by their unique keys., (*13)

$cache->getMultiple($keys, $default = null);

setMultiple()

Persists a set of key => value pairs in the cache, with an optional TTL., (*14)

$cache->setMultiple($values, $ttl = null);

deleteMultiple()

Deletes multiple cache items in a single operation., (*15)

$cache->deleteMultiple($keys);

Static Usage

You can use all the method from the Cache class statically, like this:, (*16)

use Amber\Cache\Cache;

Cache::set('key', 'value');

Cache::has('key'); // Returns true

Cache::get('key'); // Returns "value"

Cache::delete('key');

// Set the driver and then call the desired method.
Cache::driver('json')->set('key', 'value');

The Versions

25/07 2018

dev-master

9999999-dev

Simple Cache.

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

by Deivi Peña

22/05 2018

v0.1.0-beta

0.1.0.0-beta

Simple Cache.

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

by Deivi Peña