rufus-lru 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +1 -1
- data/lib/rufus/lru.rb +20 -1
- metadata +2 -2
data/README.txt
CHANGED
data/lib/rufus/lru.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
|
-
# Copyright (c) 2008, John Mettraux, jmettraux@gmail.com
|
3
|
+
# Copyright (c) 2007-2008, John Mettraux, jmettraux@gmail.com
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -36,15 +36,34 @@
|
|
36
36
|
# least recently used entries (LRU hence), will be discared to make
|
37
37
|
# room for the new entries.
|
38
38
|
#
|
39
|
+
# require 'rubygems'
|
40
|
+
# require 'rufus/lru'
|
41
|
+
#
|
42
|
+
# h = LruHash.new 3
|
43
|
+
#
|
44
|
+
# 5.times { |i| h[i] = "a" * i }
|
45
|
+
#
|
46
|
+
# puts h.inspect # >> {2=>"aa", 3=>"aaa", 4=>"aaaa"}
|
47
|
+
#
|
48
|
+
# h[:newer] = "b"
|
49
|
+
#
|
50
|
+
# puts h.inspect # >> {:newer=>"b", 3=>"aaa", 4=>"aaaa"}
|
51
|
+
#
|
52
|
+
#
|
39
53
|
class LruHash < Hash
|
40
54
|
|
55
|
+
#--
|
41
56
|
#include MonitorMixin
|
42
57
|
#
|
43
58
|
# seems not necessary for now, and it collides with expool's
|
44
59
|
# @monitors own sync
|
60
|
+
#++
|
45
61
|
|
46
62
|
attr_reader :maxsize
|
47
63
|
|
64
|
+
#
|
65
|
+
# Initializes a LruHash with a given maxsize.
|
66
|
+
#
|
48
67
|
def initialize (maxsize)
|
49
68
|
|
50
69
|
super()
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-lru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
@@ -14,7 +14,7 @@ default_executable:
|
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description:
|
17
|
-
email:
|
17
|
+
email: jmettraux@gmail.com
|
18
18
|
executables: []
|
19
19
|
|
20
20
|
extensions: []
|