Permalink
Browse files

Add ability to get multiple memcached keys at the same time (via MemC…

…acheStore#read_multi).

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent 3e2f080 commit 29550cc91f8dcbfe3e4020986d719c77ddd2f14d @joevandyk joevandyk committed with jeremy Feb 3, 2009
@@ -43,6 +43,11 @@ def initialize(*addresses)
extend Strategy::LocalCache
end
+ # Reads multiple keys from the cache.
+ def read_multi(*keys)
+ @data.get_multi keys
+ end
+
def read(key, options = nil) # :nodoc:
super
@data.get(key, raw?(options))
@@ -251,6 +251,15 @@ def test_exist_with_nulls_cached_locally
end
end
+ def test_multi_get
+ @cache.with_local_cache do
+ @cache.write('foo', 1)
+ @cache.write('goo', 2)
+ result = @cache.read_multi('foo', 'goo')
+ assert_equal({'foo' => 1, 'goo' => 2}, result)
+ end
+ end
+
def test_middleware
app = lambda { |env|
result = @cache.write('foo', 'bar')

2 comments on commit 29550cc

@Manfred

Is the empty diff file added by mistake?

@joevandyk

Looks like it

Please sign in to comment.