2017 © Pedro Peláez
 

library cache-drivers

Cache all data using different drivers

image

maartengdev/cache-drivers

Cache all data using different drivers

  • Monday, February 20, 2017
  • by MaartenGDev
  • Repository
  • 1 Watchers
  • 0 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Build Status Coverage Status Total Downloads Latest Stable Version License, (*1)

Cache Drivers

An easy to use php caching library., (*2)

Usage

Basic Usage
$dir = $_SERVER['DOCUMENT_ROOT'] .'/cache/';
$expireTime = 30;

$driver = new LocalDriver($dir);
$cache = new Cache($driver, $expireTime);

$key = 'HelloWorld';

// Check if cache entry exists
$cacheHasKey = $cache->has($key);

// Create new cache entry
$cache->store($key, 'Hello World Cache Drivers');

// Get cache entry
$cacheEntry = $cache->get($key);
// result: "Hello World Cache Drivers"
Check for cache entry with closure
$dir = $_SERVER['DOCUMENT_ROOT'] .'/cache/';
$drive = new LocalDriver($dir);
$cache = new Cache($drive,30);

function myFunction(Cache $cache){
    $key = 'HelloWorld';

    $cacheEntry = $cache->has($key, function ($cache) use ($key) {
        return $cache->get($key);
    });

    if ($cacheEntry) {
        return $cacheEntry;
    }

    $cache->store($key, 'Hello World!');

    return $cache->get($key);
}
myFunction($cache);

// result: "Hello World!"

Licence

MIT, (*3)

The Versions

20/02 2017

dev-master

9999999-dev

Cache all data using different drivers

  Sources   Download

MIT

The Requires

 

22/10 2016

1.2

1.2.0.0

Cache all data using different drivers

  Sources   Download

MIT

The Requires

 

01/10 2016

1.1

1.1.0.0

Cache all data using different drivers

  Sources   Download

MIT

The Requires

 

08/09 2016

1.0

1.0.0.0

Cache all data using different drivers

  Sources   Download

MIT

The Requires