2017 © Pedro Peláez
 

library psr-cache

File cache implementation using PSR6

image

overdesign/psr-cache

File cache implementation using PSR6

  • Thursday, March 29, 2018
  • by override2k
  • Repository
  • 2 Watchers
  • 2 Stars
  • 33 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 6 % Grown

The README.md

Build Status codecov Scrutinizer Code Quality, (*1)

PSR-6 Compilant File Cache

This is a basic PSR-6 implementation of cache using the filesystem, (*2)

Installation

Install using composer, (*3)

composer require overdesign/psr-cache

Usage

Basic example, (*4)

<?php
use Overdesign\PsrCache\FileCacheDriver;

$cacheDir = __DIR__ . '/cache';

$cache = new FileCacheDriver($cacheDir);

$item = $cache->getItem('myItem');

if ($item->isHit()) {
    echo 'Item found in cache';
    var_dump($item->get());
} else {
    $item->set('my data');
    $item->expiresAfter(120); // Expire in 2 min

    $cache->save($item);
}

Garbage collector

The drivers only deletes expired files when you try to recover them explicitly., (*5)

In order to clean the cache files you have three methods., (*6)

clear() Deletes all the items in the current pool, (*7)

clearExpired() Deletes all the expired items in the pool, (*8)

gc() Acts as a garbage collector, (*9)

It's not recommended to call the gc() method within the normal user flow operation as it can be a high time consuming operation. The ideal option is to set a cron to call the gc() method., (*10)

You can pass various options to the method, see the phpdoc to know more about that options., (*11)

TODO

The Versions

29/03 2018

dev-master

9999999-dev

File cache implementation using PSR6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fernando Robledo

28/12 2017

1.1.2

1.1.2.0

File cache implementation using PSR6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fernando Robledo

16/12 2017

dev-add-license-1

dev-add-license-1

File cache implementation using PSR6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fernando Robledo

09/12 2017

1.1.1

1.1.1.0

File cache implementation using PSR6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fernando Robledo

08/12 2017

1.1.0

1.1.0.0

File cache implementation using PSR6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fernando Robledo

26/11 2017

1.0.6

1.0.6.0

File cache implementation using PSR6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fernando Robledo

23/11 2017

1.0.5

1.0.5.0

File cache implementation using PSR6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fernando Robledo

23/11 2017

1.0.4

1.0.4.0

File cache implementation using PSR6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fernando Robledo

23/11 2017

1.0.3

1.0.3.0

File cache implementation using PSR6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fernando Robledo

16/11 2017

1.0.2

1.0.2.0

File cache implementation using PSR6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fernando Robledo

13/11 2017

1.0.1

1.0.1.0

File cache implementation using PSR6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fernando Robledo

10/11 2017

1.0.0

1.0.0.0

PSR-6 compatible cache library implementation using file system

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fernando Robledo