2017 © Pedro Peláez
 

library limcache

Non-persistent cache manager with LRU and MRU algorithms

image

herroffizier/limcache

Non-persistent cache manager with LRU and MRU algorithms

  • Friday, February 20, 2015
  • by herroffizier
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,156 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 2 % Grown

The README.md

Limcache

Build Status Scrutinizer Code Quality Code Coverage Code Climate, (*1)

Limcache is a small non-persistent cache manager that supports LRU and MRU replacement algorithms. Also it has optional Judy support., (*2)

Requirements

  • PHP >= 5.4
  • Judy (optional)

Installation

You can install Limcache via Composer:, (*3)

composer require herroffizier/limcache:dev-master

Usage

At first, choose replacement algorithm:, (*4)

// Use LRU:
$strategy = new \Limcache\strategy\LRU(100); // 100 is max item count in cache

// Or MRU:
$strategy = new \Limcache\strategy\MRU(100);

After that you can create cache:, (*5)

$cache = new \Limcache\Cache($strategy);

Since \Limcache\Cache implements \ArrayAccess and \Countable interfaces you can use it as array in most cases:, (*6)

// Save item in cache:
$cache['key1'] = 'somedata';

// Get item value:
$cache['key1'];

// Try to get non-existent item:
$cache['key2']; // will return null

// Do some ordinary things:
count($cache);
isset($cache['key1']);
unset($cache['key1']);

In addition cache object has few useful methods which may help to determine cache efficiency:, (*7)

// Get cache hits:
$cache->getHits();

// Get cache misses:
$cache->getMisses();

The Versions

20/02 2015

dev-master

9999999-dev

Non-persistent cache manager with LRU and MRU algorithms

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Martin Stolz

cache judy lru mru