memcached-seanl 0.19.5.5 → 0.19.5.6
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/CHANGELOG +2 -0
- data/Rakefile +1 -1
- data/ext/extconf.rb +10 -4
- data/lib/memcached/memcached.rb +10 -5
- data/lib/memcached/rails.rb +41 -1
- data/memcached-seanl.gemspec +2 -2
- data/test/profile/valgrind.rb +2 -0
- metadata +4 -4
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -23,7 +23,7 @@ task :exceptions do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
task :valgrind do
|
26
|
-
exec("valgrind --tool=memcheck --leak-check=
|
26
|
+
exec("valgrind --tool=memcheck --leak-check=full --show-reachable=no --num-callers=15 --track-fds=yes --workaround-gcc296-bugs=yes --max-stackframe=7304328 --dsymutil=yes --track-origins=yes ruby #{File.dirname(__FILE__)}/test/profile/valgrind.rb")
|
27
27
|
end
|
28
28
|
|
29
29
|
task :profile do
|
data/ext/extconf.rb
CHANGED
@@ -5,7 +5,11 @@ HERE = File.expand_path(File.dirname(__FILE__))
|
|
5
5
|
BUNDLE = Dir.glob("libmemcached-*.tar.gz").first
|
6
6
|
BUNDLE_PATH = BUNDLE.sub(".tar.gz", "")
|
7
7
|
|
8
|
+
SOLARIS_32 = RbConfig::CONFIG['target'] == "i386-pc-solaris2.10"
|
9
|
+
|
8
10
|
$CFLAGS = "#{RbConfig::CONFIG['CFLAGS']} #{$CFLAGS}".gsub("$(cflags)", "").gsub("-fno-common", "")
|
11
|
+
$CFLAGS << " -std=gnu99" if SOLARIS_32
|
12
|
+
$EXTRA_CONF = " --disable-64bit" if SOLARIS_32
|
9
13
|
$LDFLAGS = "#{RbConfig::CONFIG['LDFLAGS']} #{$LDFLAGS}".gsub("$(ldflags)", "").gsub("-fno-common", "")
|
10
14
|
$CXXFLAGS = " -std=gnu++98 #{$CFLAGS}"
|
11
15
|
$CPPFLAGS = $ARCH_FLAG = $DLDFLAGS = ""
|
@@ -25,12 +29,14 @@ def check_libmemcached
|
|
25
29
|
$CFLAGS = "#{$includes} #{$libraries} #{$CFLAGS}"
|
26
30
|
$LDFLAGS = "#{$libraries} #{$LDFLAGS}"
|
27
31
|
$LIBPATH = ["#{HERE}/lib"]
|
28
|
-
$DEFLIBPATH = []
|
32
|
+
$DEFLIBPATH = [] unless SOLARIS_32
|
29
33
|
|
30
34
|
Dir.chdir(HERE) do
|
31
35
|
if File.exist?("lib")
|
32
36
|
puts "Libmemcached already built; run 'rake clean' first if you need to rebuild."
|
33
37
|
else
|
38
|
+
tar = SOLARIS_32 ? 'gtar' : 'tar'
|
39
|
+
patch = SOLARIS_32 ? 'gpatch' : 'patch'
|
34
40
|
|
35
41
|
# have_sasl check may fail on OSX, skip it
|
36
42
|
# unless RUBY_PLATFORM =~ /darwin/ or have_library('sasl2')
|
@@ -38,15 +44,15 @@ def check_libmemcached
|
|
38
44
|
# end
|
39
45
|
|
40
46
|
puts "Building libmemcached."
|
41
|
-
puts(cmd = "tar xzf #{BUNDLE} 2>&1")
|
47
|
+
puts(cmd = "#{tar} xzf #{BUNDLE} 2>&1")
|
42
48
|
raise "'#{cmd}' failed" unless system(cmd)
|
43
49
|
|
44
50
|
puts "Patching libmemcached source."
|
45
|
-
puts(cmd = "patch -p1 -Z < libmemcached.patch")
|
51
|
+
puts(cmd = "#{patch} -p1 -Z < libmemcached.patch")
|
46
52
|
raise "'#{cmd}' failed" unless system(cmd)
|
47
53
|
|
48
54
|
puts "Patching libmemcached with SASL support."
|
49
|
-
puts(cmd = "patch -p1 -Z < sasl.patch")
|
55
|
+
puts(cmd = "#{patch} -p1 -Z < sasl.patch")
|
50
56
|
raise "'#{cmd}' failed" unless system(cmd)
|
51
57
|
|
52
58
|
puts "Touching aclocal.m4 in libmemcached."
|
data/lib/memcached/memcached.rb
CHANGED
@@ -160,6 +160,9 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
|
|
160
160
|
# Set the server list.
|
161
161
|
# FIXME Does not necessarily free any existing server structs.
|
162
162
|
def set_servers(servers)
|
163
|
+
server_structs.each do |server|
|
164
|
+
Lib.memcached_server_remove(server)
|
165
|
+
end
|
163
166
|
Array(servers).each_with_index do |server, index|
|
164
167
|
# Socket
|
165
168
|
check_return_code(
|
@@ -588,12 +591,14 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
|
|
588
591
|
message = "Key #{inspect_keys(key, (detect_failure if ret == Lib::MEMCACHED_SERVER_MARKED_DEAD)).inspect}"
|
589
592
|
if key.is_a?(String)
|
590
593
|
if ret == Lib::MEMCACHED_ERRNO
|
591
|
-
server = Lib.memcached_server_by_key(@struct, key)
|
592
|
-
|
593
|
-
|
594
|
+
if (server = Lib.memcached_server_by_key(@struct, key)).is_a?(Array)
|
595
|
+
errno = server.first.cached_errno
|
596
|
+
message = "Errno #{errno}: #{ERRNO_HASH[errno].inspect}. #{message}"
|
597
|
+
end
|
594
598
|
elsif ret == Lib::MEMCACHED_SERVER_ERROR
|
595
|
-
server = Lib.memcached_server_by_key(@struct, key)
|
596
|
-
|
599
|
+
if (server = Lib.memcached_server_by_key(@struct, key)).is_a?(Array)
|
600
|
+
message = "\"#{server.first.cached_server_error}\". #{message}."
|
601
|
+
end
|
597
602
|
end
|
598
603
|
end
|
599
604
|
raise EXCEPTIONS[ret], message
|
data/lib/memcached/rails.rb
CHANGED
@@ -26,6 +26,12 @@ class Memcached
|
|
26
26
|
super(servers, opts)
|
27
27
|
end
|
28
28
|
|
29
|
+
def servers
|
30
|
+
server_structs.map do |server|
|
31
|
+
Server.new server
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
29
35
|
def logger=(logger)
|
30
36
|
@logger = logger
|
31
37
|
end
|
@@ -116,4 +122,38 @@ class Memcached
|
|
116
122
|
alias :"[]=" :set
|
117
123
|
|
118
124
|
end
|
119
|
-
|
125
|
+
|
126
|
+
class Server
|
127
|
+
def initialize(struct)
|
128
|
+
@struct = struct
|
129
|
+
end
|
130
|
+
|
131
|
+
def host
|
132
|
+
@struct.hostname
|
133
|
+
end
|
134
|
+
|
135
|
+
def port
|
136
|
+
@struct.port
|
137
|
+
end
|
138
|
+
|
139
|
+
def weight
|
140
|
+
@struct.weight
|
141
|
+
end
|
142
|
+
|
143
|
+
def multithreaded
|
144
|
+
true
|
145
|
+
end
|
146
|
+
|
147
|
+
def status
|
148
|
+
alive? ? 'CONNECTED' : 'NOT CONNECTED'
|
149
|
+
end
|
150
|
+
|
151
|
+
def inspect
|
152
|
+
"<Memcached::Rails::Server: %s:%d [%d] (%s)>" % [host, port, weight, status]
|
153
|
+
end
|
154
|
+
|
155
|
+
def alive?
|
156
|
+
@struct.fd != -1 || @struct.next_retry <= Time.now
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
data/memcached-seanl.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{memcached-seanl}
|
5
|
-
s.version = "0.19.5.
|
5
|
+
s.version = "0.19.5.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Sean Lynch"]
|
9
|
-
s.date = %q{2010-05-
|
9
|
+
s.date = %q{2010-05-25}
|
10
10
|
s.description = %q{An interface to the libmemcached C client.}
|
11
11
|
s.email = %q{}
|
12
12
|
s.extensions = ["ext/extconf.rb"]
|
data/test/profile/valgrind.rb
CHANGED
@@ -5,6 +5,8 @@ $LOAD_PATH << "#{File.dirname(__FILE__)}/../../lib/"
|
|
5
5
|
require 'memcached'
|
6
6
|
require 'rubygems'
|
7
7
|
|
8
|
+
GC.copy_on_write_friendly = true if GC.respond_to?("copy_on_write_friendly=")
|
9
|
+
|
8
10
|
class Worker
|
9
11
|
def initialize(method_name, iterations)
|
10
12
|
@method = method_name || 'mixed'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memcached-seanl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 207
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 19
|
9
9
|
- 5
|
10
|
-
-
|
11
|
-
version: 0.19.5.
|
10
|
+
- 6
|
11
|
+
version: 0.19.5.6
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Sean Lynch
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-05-
|
19
|
+
date: 2010-05-25 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|