2017 © Pedro Peláez
 

library cache-manager

SlabPHP Cache Manager Library

image

slabphp/cache-manager

SlabPHP Cache Manager Library

  • Thursday, February 15, 2018
  • by ericsalerno
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

SlabPHP Cache Manager

The SlabPHP Cache Management Driver Library wraps several different types of cache providers and gives a single interface to them., (*1)

This library is deprecated but since it's still part of the SlabPHP monorepo it's being open sourced as well. There are better alternatives that adopt PSR standards that you should use. The author of this library doesn't even consider wrapping all these different libraries together as a good pattern for cache. Please see the main SlabPHP documentation for more information about this and the other SlabPHP repositories., (*2)

Installation and Setup

First include this with composer:, (*3)

composer require slabphp/cache-manager

Then create your provider object:, (*4)

$provider = new \Slab\Cache\Providers\Predis();
$provider
    ->setHost('locallhost', 6379);

$driver = new \Slab\Cache\Driver();
$driver
    ->setProvider($provider);

Usage

Using a Request Object

The Request object is designed to wrap the getting and setting of cache in one basic step., (*5)

$request = new \Slab\Cache\Request();

$request
    ->setCacheKey('my-key')
    ->setCacheTTL(3600)
    ->setCallback($someObject, 'someCallBackFunction', ['value1'])
    ->setForceRefresh(!empty($_GET['cacheRefresh']));

$output = $driver->execute($request);

What this does is first check the set cache provider for a value with the key 'my-key'. If it exists, it will return it. Otherwise, it will execute $someObject->someCallBackFunction('value1'), save the value with key 'my-key' and a ttl of 3600 seconds, and then return it., (*6)

Other ways

You can do get(), set(), and delete() on the driver and they will pass through to the provider. You can also do ->getProvider() on the driver to perform any provider specific actions., (*7)

The Versions

15/02 2018

dev-master

9999999-dev https://www.salernolabs.com/slab

SlabPHP Cache Manager Library

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

15/02 2018

v0.1.0

0.1.0.0 https://www.salernolabs.com/slab

SlabPHP Cache Manager Library

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

15/02 2018

v0.1.1

0.1.1.0 https://www.salernolabs.com/slab

SlabPHP Cache Manager Library

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires