Sha256: 85320c82101e24a9d894c7bef7bb1e36c144c79a9306334dc17f02b083b946bd
Contents?: true
Size: 980 Bytes
Versions: 1
Compression:
Stored size: 980 Bytes
Contents
= Efficient LRU Cache in Ruby This class implements an LRU Cache where all operations are implemented in constant time. This is in contract to other classes, e.g. ruby-cache, whose operations complete in Order(n) time. The primary implementation details for this class include: - Simple API. We do not provide a complete Hash API, but do provide enumerable and common shortcuts. - True linked list underlying the LRU. Ruby-cache uses a ruby array and traverses ALL elements for key operations (like get). - No aggressive cache flushing. Items are expired only once the cache reaches the capacity you configured. There is no garbage collection or other process that can delay operations. Every access to the cache occurs in constant time. == Usage require 'lru' cache = Cache::LRU.new(:max_elements => 5) cache.put(:a, 1) cache[:a] = 2 cache.get(:b) { 1 } cache[:b] == Authors Michael Bryzek mbryzek<at>alum.mit.edu Phong Nguyen phong<at>gilt.com
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lru-0.1.0 | README.txt |