lru_redux 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cc0a735826e07e6de5cc53e431c4fd87ff32413
4
- data.tar.gz: 28446a234e46a8b91a57e56b1677b2d4b16ac68f
3
+ metadata.gz: 44f9731a90a6a4021eec3488c38c5a82399f7089
4
+ data.tar.gz: cd4f27cc1d9eca928e1a1e8c9b75507a4c06a81d
5
5
  SHA512:
6
- metadata.gz: bc3d02a4d7b2f4f3db8189e1e4c5c1515c2e3c713d58ce2e84ba46296aec74312400c11e60f31cebfc8fd757210c347c5beb0ea13375501164a847a12326bebb
7
- data.tar.gz: 4c46517993f671162baa8aa946ad201d8ce00f662b1b61f8583463041752f73da2ee57ff802e130448ae427cc12064a32eb4d4e815d3ed96e941e7d2db69593b
6
+ metadata.gz: e5b6832027fc7e09a7e319981ef2acc9399b11fdce5015c7c24354f6e50dbc8794b056cc995733387dbc9b658e67bc610b92a55dc905905f53b7d8e1f8a50398
7
+ data.tar.gz: ac925de76a377ffd499c20c626f4eb650232b4deb888cd7958452a24c425ce0a64fe6a8e62373d6c8e8e2a1bc3bd0f14f4aeb54475fb70edb1cf6bea2ae061a4
data/README.md CHANGED
@@ -95,6 +95,10 @@ lru_redux thread safe 2.530000 0.000000 2.530000 ( 2.532061)
95
95
 
96
96
  ## Changlog
97
97
 
98
+ ###version 0.8.4 - 20-Feb-2014
99
+
100
+ - Fix: regression of ThreadSafeCache under JRuby 1.7 @Sevrius
101
+
98
102
  ###version 0.8.3 - 20-Feb-2014
99
103
 
100
104
  - Perf: improve ThreadSafeCache performance @Sevrius
@@ -12,3 +12,5 @@ else
12
12
  require "lru_redux/cache"
13
13
  end
14
14
  require "lru_redux/thread_safe_cache"
15
+ require "lru_redux/thread_safe_cache_jruby" if
16
+ RUBY_PLATFORM == 'java' && JRUBY_VERSION < '9.0'
@@ -89,25 +89,16 @@ class LruRedux::Cache
89
89
 
90
90
  def delete(key)
91
91
  node = @data.delete(key)
92
+
92
93
  return unless node
93
94
 
94
- if node[3].nil?
95
- @head = @head[0]
96
- if @head.nil?
97
- @tail = nil
98
- else
99
- @head[3] = nil
100
- end
101
- elsif node[0].nil?
102
- @tail = @tail[3]
103
- @tail[0] = nil
104
- else
105
- prev = node[0]
106
- nex = node[3]
95
+ prev = node[0]
96
+ nex = node[3]
107
97
 
108
- prev[3] = nex if prev
109
- nex[0] = prev if nex
110
- end
98
+ nex ? nex[0] = prev : @head = prev
99
+ prev ? prev[3] = nex : @tail = nex
100
+
101
+ node[2]
111
102
  end
112
103
 
113
104
  def clear
@@ -0,0 +1,13 @@
1
+ class LruRedux::ThreadSafeCache
2
+ def getset(key, &block)
3
+ synchronize do
4
+ super(key, &block)
5
+ end
6
+ end
7
+
8
+ def fetch(key, &block)
9
+ synchronize do
10
+ super(key, &block)
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module LruRedux
2
- VERSION = "0.8.3"
2
+ VERSION = "0.8.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lru_redux
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-20 00:00:00.000000000 Z
11
+ date: 2015-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,6 +112,7 @@ files:
112
112
  - lib/lru_redux/cache.rb
113
113
  - lib/lru_redux/cache19.rb
114
114
  - lib/lru_redux/thread_safe_cache.rb
115
+ - lib/lru_redux/thread_safe_cache_jruby.rb
115
116
  - lib/lru_redux/version.rb
116
117
  - lru_redux.gemspec
117
118
  - test/cache_test.rb