github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jmettraux / rufus-lru

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 6
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (1)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (1)
    • v1.0.3
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

LruHash class, a Hash with a max size, controlled by a LRU mechanism (ruby) — Read more

  cancel

http://rufus.rubyforge.org/rufus-lru

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

gemspec tiny update 
jmettraux (author)
Sat Jan 23 23:52:41 -0800 2010
commit  31f8d625be5278bd2e3be54807d5c242e6ce9719
tree    00de76b58cf8988292857d45a7db41a807db8830
parent  8e12695c2603dbee17a608ac8c6166e62c9a4c04
rufus-lru /
name age
history
message
file CHANGELOG.txt Sat Jan 23 23:50:10 -0800 2010 refresh [jmettraux]
file LICENSE.txt Sat Jan 23 23:42:31 -0800 2010 2010 [jmettraux]
file README.rdoc Sat Jan 23 23:50:10 -0800 2010 refresh [jmettraux]
file Rakefile Loading commit data...
directory doc/ Thu Mar 12 16:33:44 -0700 2009 moved to hanna rdoc template [jmettraux]
directory lib/ Sat Jan 23 23:50:10 -0800 2010 refresh [jmettraux]
file rufus-lru.gemspec Sat Jan 23 23:52:41 -0800 2010 gemspec tiny update [jmettraux]
directory test/ Sat Jan 23 23:42:31 -0800 2010 2010 [jmettraux]
README.rdoc

rufus-lru

LruHash class, a Hash with a max size, controlled by a LRU mechanism

getting it

  gem install rufus-lru

or at

rubyforge.org/frs/?group_id=4812

usage

It’s a regular hash, but you have to set a maxsize at instantiation.

Once the maxsize is reached, the hash will discard the element that was the least recently used (hence LRU).

  require 'rubygems'
  require 'rufus/lru'

  h = LruHash.new 3

  5.times { |i| h[i] = "a" * i }

  puts h.inspect # >> {2=>"aa", 3=>"aaa", 4=>"aaaa"}

  h[:newer] = "b"

  puts h.inspect # >> {:newer=>"b", 3=>"aaa", 4=>"aaaa"}

dependencies

None.

mailing list

On the rufus-ruby list :

  http://groups.google.com/group/rufus-ruby

issue tracker

github.com/jmettraux/rufus-lru/issues

irc

irc.freenode.net #ruote

source

github.com/jmettraux/rufus-lru

  git clone git://github.com/jmettraux/rufus-lru.git

author

John Mettraux, jmettraux@gmail.com jmettraux.wordpress.com

the rest of Rufus

rufus.rubyforge.org

license

MIT

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server