memcache-client 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.rdoc +6 -1
- data/Rakefile +1 -1
- data/lib/memcache.rb +18 -18
- metadata +2 -2
data/History.rdoc
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
= 1.7.
|
1
|
+
= 1.7.2 (2009-04-12)
|
2
|
+
|
3
|
+
* Rollback socket timeout optimization. It does not work on all operating systems
|
4
|
+
and was a support headache.
|
5
|
+
|
6
|
+
= 1.7.1 (2009-03-28)
|
2
7
|
|
3
8
|
* Performance optimizations:
|
4
9
|
* Rely on higher performance operating system socket timeouts for low-level socket
|
data/Rakefile
CHANGED
data/lib/memcache.rb
CHANGED
@@ -33,7 +33,7 @@ class MemCache
|
|
33
33
|
##
|
34
34
|
# The version of MemCache you are using.
|
35
35
|
|
36
|
-
VERSION = '1.7.
|
36
|
+
VERSION = '1.7.2'
|
37
37
|
|
38
38
|
##
|
39
39
|
# Default options for the cache object.
|
@@ -1015,30 +1015,30 @@ class MemCache
|
|
1015
1015
|
end
|
1016
1016
|
|
1017
1017
|
def connect_to(host, port, timeout=nil)
|
1018
|
-
|
1019
|
-
sock = Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0)
|
1020
|
-
|
1018
|
+
s = TCPSocket.new(host, port, 0)
|
1021
1019
|
if timeout
|
1022
|
-
|
1023
|
-
usecs = Integer((timeout - secs) * 1_000_000)
|
1024
|
-
optval = [secs, usecs].pack("l_2")
|
1025
|
-
sock.setsockopt Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, optval
|
1026
|
-
sock.setsockopt Socket::SOL_SOCKET, Socket::SO_SNDTIMEO, optval
|
1027
|
-
|
1028
|
-
# Socket timeouts don't work for more complex IO operations
|
1029
|
-
# like gets which lay on top of read. We need to fall back to
|
1030
|
-
# the standard Timeout mechanism.
|
1031
|
-
sock.instance_eval <<-EOR
|
1020
|
+
s.instance_eval <<-EOR
|
1032
1021
|
alias :blocking_gets :gets
|
1033
|
-
def gets
|
1022
|
+
def gets(*args)
|
1023
|
+
MemCacheTimer.timeout(#{timeout}) do
|
1024
|
+
self.blocking_gets(*args)
|
1025
|
+
end
|
1026
|
+
end
|
1027
|
+
alias :blocking_read :read
|
1028
|
+
def read(*args)
|
1029
|
+
MemCacheTimer.timeout(#{timeout}) do
|
1030
|
+
self.blocking_read(*args)
|
1031
|
+
end
|
1032
|
+
end
|
1033
|
+
alias :blocking_write :write
|
1034
|
+
def write(*args)
|
1034
1035
|
MemCacheTimer.timeout(#{timeout}) do
|
1035
|
-
self.
|
1036
|
+
self.blocking_write(*args)
|
1036
1037
|
end
|
1037
1038
|
end
|
1038
1039
|
EOR
|
1039
1040
|
end
|
1040
|
-
|
1041
|
-
sock
|
1041
|
+
s
|
1042
1042
|
end
|
1043
1043
|
|
1044
1044
|
##
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memcache-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Hodel
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-
|
14
|
+
date: 2009-04-12 00:00:00 -05:00
|
15
15
|
default_executable:
|
16
16
|
dependencies: []
|
17
17
|
|