KellyMahan-memcachedb-client 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/lib/memcache_db.rb +11 -6
- metadata +2 -2
data/History.txt
CHANGED
data/lib/memcache_db.rb
CHANGED
@@ -28,12 +28,14 @@ end
|
|
28
28
|
# A Ruby client library for memcachedb.
|
29
29
|
#
|
30
30
|
|
31
|
+
|
32
|
+
|
31
33
|
class MemCacheDb
|
32
34
|
|
33
35
|
|
34
36
|
# The version of MemCacheDb you are using.
|
35
37
|
|
36
|
-
VERSION = '1.1.
|
38
|
+
VERSION = '1.1.4'
|
37
39
|
##
|
38
40
|
# Default options for the cache object.
|
39
41
|
|
@@ -240,14 +242,14 @@ class MemCacheDb
|
|
240
242
|
# Note that get_multi assumes the values are marshalled.
|
241
243
|
|
242
244
|
|
243
|
-
def get_range(key1, key2, limit=100)
|
245
|
+
def get_range(key1, key2, start_exclude=0, end_exclude=0, limit=100)
|
244
246
|
raise MemCacheDbError, 'No active servers' unless active?
|
245
247
|
|
246
248
|
results = {}
|
247
249
|
|
248
250
|
begin
|
249
|
-
servers.each do |server|
|
250
|
-
values = cache_rget(server, key1, key2, limit)
|
251
|
+
@servers.each do |server|
|
252
|
+
values = cache_rget(server, key1, key2, limit, start_exclude, end_exclude)
|
251
253
|
values.each do |key, value|
|
252
254
|
results[key.gsub(/#{@namespace}\:/,'')] = Marshal.load value
|
253
255
|
end
|
@@ -615,7 +617,7 @@ class MemCacheDb
|
|
615
617
|
end
|
616
618
|
end
|
617
619
|
|
618
|
-
def cache_rget(server, start_key, end_key, max=100)
|
620
|
+
def cache_rget(server, start_key, end_key, max=100, start_exclude=0, end_exclude=0)
|
619
621
|
|
620
622
|
# rget <start key> <end key> <left openness flag> <right openness flag> <max items>\r\n
|
621
623
|
#
|
@@ -648,10 +650,13 @@ class MemCacheDb
|
|
648
650
|
# - <data block> is the data for this item.
|
649
651
|
#
|
650
652
|
# Notice: all keys in MemcacheDB is sorted alphabetically, so is the return of query result.
|
653
|
+
if max > 100
|
654
|
+
max = 100
|
655
|
+
end
|
651
656
|
|
652
657
|
with_socket_management(server) do |socket|
|
653
658
|
values = {}
|
654
|
-
socket.write "rget #{start_key} #{end_key}
|
659
|
+
socket.write "rget #{start_key} #{end_key} #{start_exclude} #{end_exclude} #{max}\r\n"
|
655
660
|
|
656
661
|
while keyline = socket.gets do
|
657
662
|
return values if keyline == "END\r\n"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: KellyMahan-memcachedb-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Mahan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-08 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|