2017 © Pedro PelĂĄez
 

library lrucache

PHP LRU Cache implementation

image

justin-robinson/lrucache

PHP LRU Cache implementation

  • Monday, June 6, 2016
  • by justin-robinson
  • Repository
  • 1 Watchers
  • 0 Stars
  • 236 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 10 Forks
  • 0 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

Build Status Coverage Status, (*1)

PHP LRU Cache implementation

Forked from https://github.com/rogeriopvl/php-lrucache, (*2)

Changes * Reduce cost of inserting to cache from O(n) to O(1) * Make cache iterable * Fix phpunit tests, (*3)

Intro

What is a LRU Cache?

LRU stands for Least Recently Used. It's a type of cache that usually has a fixed capacity and discards the oldest entries. This is specially useful if you have the need to control the cache memory usage., (*4)

If you want more details about LRU Cache, you can read [this article]0 that explains it pretty well. Also if you want more interesting info, you can read this great paper on LRU algorithms., (*5)

Implementation

This code is in it's early stages. I need to write more tests to find out the possible naive code parts in order to achieve some performance, if any is possible with PHP :P, (*6)

This implementation is similar to a LinkedHashMap. Right now I'm just messing around with the code and decided to keep it simple, using a simple associative array as a naive hashmap., (*7)

Install (composer)

Add the package into your composer.json file:, (*8)

"require": {
    "justin-robinson/lrucache": "dev-master"
}

Then run the command:, (*9)

composer install

Usage

Usage is pretty simple:, (*10)

require_once('vendor/autoload.php'); // composer autoader

$cache = new \LRUCache\LRUCache(1000);

$cache->put('mykey', 'arrow to the knee');

echo $cache->get('mykey');

You can use the tests to try things like load testing etc., (*11)

The Versions

06/06 2016

dev-master

9999999-dev https://github.com/justin-robinson/php-lrucache

PHP LRU Cache implementation

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

cache php lru

03/06 2016

v1.1.0

1.1.0.0 https://github.com/justin-robinson/php-lrucache

PHP LRU Cache implementation

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

cache php lru

17/05 2016

v1.0.0

1.0.0.0 https://github.com/justin-robinson/php-lrucache

PHP LRU Cache implementation

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

The Development Requires

cache php lru

16/05 2016

v0.6.0

0.6.0.0 https://github.com/justin-robinson/php-lrucache

PHP LRU Cache implementation

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

The Development Requires

cache php lru

16/05 2016

v0.5.4

0.5.4.0 https://github.com/justin-robinson/php-lrucache

PHP LRU Cache implementation

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

The Development Requires

cache php lru

15/05 2016

v0.5.3

0.5.3.0 https://github.com/justin-robinson/php-lrucache

PHP LRU Cache implementation

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

The Development Requires

cache php lru

05/05 2016

v0.5.2

0.5.2.0 https://github.com/justin-robinson/php-lrucache

PHP LRU Cache implementation

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

The Development Requires

cache php lru

04/05 2016

v0.5.1

0.5.1.0 https://github.com/justin-robinson/php-lrucache

PHP LRU Cache implementation

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

The Development Requires

cache php lru

23/03 2016

v0.5

0.5.0.0 https://github.com/justin-robinson/php-lrucache

PHP LRU Cache implementation

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

The Development Requires

cache php lru

15/02 2016

v0.4.0

0.4.0.0 https://github.com/justin-robinson/php-lrucache

PHP LRU Cache implementation

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

cache php lru

07/12 2014
24/07 2013

v0.2.1

0.2.1.0 https://github.com/rogeriopvl/php-lrucache

PHP LRU Cache implementation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

cache php lru

24/07 2013

dev-develop

dev-develop https://github.com/rogeriopvl/php-lrucache

PHP LRU Cache implementation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

cache php lru

10/03 2013

v0.1.3

0.1.3.0 https://github.com/rogeriopvl/php-lrucache

PHP LRU Cache implementation

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

cache php lru