2017 © Pedro Peláez
 

library pop-cache

Pop Cache Component for Pop PHP Framework

image

popphp/pop-cache

Pop Cache Component for Pop PHP Framework

  • Wednesday, February 7, 2018
  • by nicksagona
  • Repository
  • 1 Watchers
  • 3 Stars
  • 1,069 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 14 Versions
  • 5 % Grown

The README.md

pop-cache

Build Status Coverage Status, (*1)

Join the chat at https://discord.gg/TZjgT74U7E, (*2)

Overview

pop-cache provides the ability to cache frequently accessed content via several different adapters. The adapters all share the same interface and are interchangeable. Depending on the server environment and what's available, an application can use one of the following cache adapters:, (*3)

  • Apc (caching service)
  • Memcached (caching service)
  • Redis (caching service)
  • File (directory on disk)
  • Database (database caching)
  • Session (short-term caching in session)

pop-cache is a component of the Pop PHP Framework., (*4)

Top, (*5)

Install

Install pop-cache using Composer., (*6)

composer require popphp/pop-cache

Or, require it in your composer.json file, (*7)

"require": {
    "popphp/pop-cache" : "^4.0.2"
}

Top, (*8)

Quickstart

Here is a basic example to create a cache object and then save and retrieve some data from it. The adapter can be passed a "time-to-live" value in seconds (TTL). If set to 0, then the cached items will never expire:, (*9)

use Pop\Cache\Cache;
use Pop\Cache\Adapter\File;

// Passing the file adapter the location on disk and the TTL
$cache = new Cache(new Adapter\File('/path/to/my/cache/dir', 300));

$cache->saveItem('foo', $data);

$data = $cache->getItem('foo');

Check if the cache has an item

if $cache->hasItem('foo') { } // Return bool

Delete item

$cache->deleteItem('foo');

Delete items

$cache->deleteItems(['foo', 'bar']);

Clear all items out of the cache

$cache->clear();

Top, (*10)

APC

Using the APC adapter requires APC to be correctly set up in the environment., (*11)

use Pop\Cache\Cache;
use Pop\Cache\Adapter\Apc;

$cache = new Cache(new Apc(300));

Top, (*12)

Memcached

Using the Memcached adapter requires Memcached to be correctly set up in the environment., (*13)

use Pop\Cache\Cache;
use Pop\Cache\Adapter\Memcached;

$cache = new Cache(new Memcached(300, 'localhost', 11211));

Top, (*14)

Redis

Using the Redis adapter requires Redis to be correctly set up in the environment., (*15)

use Pop\Cache\Cache;
use Pop\Cache\Adapter\Redis;

$cache = new Cache(new Redis(300, 'localhost', 6379));

Top, (*16)

File

Using the file adapter will simply store the cache data on the local disk., (*17)

use Pop\Cache\Cache;
use Pop\Cache\Adapter\File;

$cache = new Cache(new Adapter\File('/path/to/my/cache/dir', 300));

Top, (*18)

Database

Using the database adapter will require the database to be set up correctly and the use of the pop-db component., (*19)

use Pop\Cache\Cache;
use Pop\Cache\Adapter\Database;
use Pop\Db\Db;

$cache = new Cache(
    new Database(Db::sqliteConnect(['database' => __DIR__ . '/tmp/cache.sqlite']), 300)
);

Top, (*20)

Session

Using the session adapter will store the cached data in session, (*21)

use Pop\Cache\Cache;
use Pop\Cache\Adapter\Session;

$cache = new Cache(new Session(300));

Top, (*22)

The Versions

07/02 2018

dev-master

9999999-dev http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

BSD-3-Clause New BSD

The Requires

  • php >=5.6.0

 

The Development Requires

cache php memcache apc caching pop pop php

07/02 2018

dev-v3-dev

dev-v3-dev http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

BSD-3-Clause New BSD

The Requires

  • php >=5.6.0

 

The Development Requires

cache php memcache apc caching pop pop php

07/02 2018

3.2.2

3.2.2.0 http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.6.0

 

The Development Requires

cache php memcache apc caching pop pop php

29/01 2018

3.2.1

3.2.1.0 http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.6.0

 

The Development Requires

cache php memcache apc caching pop pop php

10/09 2017

3.2.0

3.2.0.0 http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.6.0

 

The Development Requires

cache php memcache apc caching pop pop php

21/06 2017

3.1.1

3.1.1.0 http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.6.0

 

The Development Requires

cache php memcache apc caching pop pop php

22/02 2017

3.1.0

3.1.0.0 http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.6.0

 

The Development Requires

cache php memcache apc caching pop pop php

10/07 2016

3.0.0

3.0.0.0 http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

cache php memcache apc caching pop pop php

01/07 2016

2.1.0

2.1.0.0 http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

cache php memcache apc caching pop pop php

10/05 2016

2.0.1p2

2.0.1.0-patch2 http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

cache php memcache apc caching pop pop php

19/02 2016

2.0.1p1

2.0.1.0-patch1 http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

cache php memcache apc caching pop pop php

16/02 2016

2.0.1

2.0.1.0 http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

cache php memcache apc caching pop pop php

02/09 2015

2.0.0p1

2.0.0.0-patch1 http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

cache php memcache apc caching pop pop php

16/07 2015

2.0.0

2.0.0.0 http://www.popphp.org/

Pop Cache Component for Pop PHP Framework

  Sources   Download

New BSD

The Requires

  • php >=5.4.0

 

The Development Requires

cache php memcache apc caching pop pop php