2017 © Pedro PelĂĄez
 

library lrucache

PHP LRU Cache implementation

image

lrucache/lrucache

PHP LRU Cache implementation

  • Sunday, December 7, 2014
  • by rogeriopvl
  • Repository
  • 4 Watchers
  • 25 Stars
  • 20,883 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 9 Forks
  • 0 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

Build Status, (*1)

PHP LRU Cache implementation

Intro

WTF 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., (*2)

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., (*3)

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, (*4)

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., (*5)

Install (composer)

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

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

Then run the command:, (*7)

composer install

Usage

Usage is pretty simple:, (*8)

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., (*9)

The Versions

07/12 2014

dev-master

9999999-dev 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

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