This commit is contained in:
Evan Weaver 2008-01-20 01:25:05 +00:00
Родитель f97c1e2433
Коммит 3f08a94202
4 изменённых файлов: 36 добавлений и 6 удалений

Просмотреть файл

@ -1,12 +1,16 @@
if `which swig` !~ /no swig/ require 'mkmf'
if ENV['SWIG']
puts "running SWIG" puts "running SWIG"
$stdout.write `swig -I/opt/local/include -ruby -autorename libmemcached.i` $stdout.write `swig -I/opt/local/include -ruby -autorename libmemcached.i`
end end
require 'mkmf' if ENV['DEBUG']
# $CFLAGS << " -ggdb -DHAVE_DEBUG" puts "setting debug flags"
# find_header 'libmemcached/memcached.h' $CFLAGS << " -ggdb -DHAVE_DEBUG"
end
dir_config 'libmemcached' dir_config 'libmemcached'
find_library 'memcached', 'memcached_server_add' find_library 'memcached', 'memcached_server_add'
create_makefile 'libmemcached' create_makefile 'libmemcached'

Просмотреть файл

@ -97,5 +97,15 @@ class Memcached
return true if int == 0 return true if int == 0
raise @@exceptions[int] raise @@exceptions[int]
end end
# def free
# Libmemcached.memcached_free(@struct)
# class << self
# (self.instance_methods - Object.instance_methods).each do |method|
# remove_method :method
# end
# end
# @struct = nil
# end
end end

Просмотреть файл

@ -1,9 +1,14 @@
# Start memcached # Start memcached
HERE = File.dirname(__FILE__)
`ps awx`.split("\n").grep(/4304[1-3]/).map do |process| `ps awx`.split("\n").grep(/4304[1-3]/).map do |process|
system("kill -9 #{process.to_i}") system("kill -9 #{process.to_i}")
end end
system "memcached -p 43042 &" log = "#{HERE}/log/memcached.log"
system "memcached -p 43043 &" system "touch #{log}"
system "memcached -vv -p 43042 >> #{log} 2>&1 &"
system "memcached -vv -p 43043 >> #{log} 2>&1 &"

Просмотреть файл

@ -13,6 +13,10 @@ class ClassTest < Test::Unit::TestCase
@value = OpenStruct.new(:a => 1, :b => 2, :c => GenericClass) @value = OpenStruct.new(:a => 1, :b => 2, :c => GenericClass)
@marshalled_value = Marshal.dump(@value) @marshalled_value = Marshal.dump(@value)
end end
# def teardown
# @cache.send(:free)
# end
def test_initialize def test_initialize
cache = Memcached.new ['127.0.0.1:43042', '127.0.0.1:43043'], :namespace => 'test' cache = Memcached.new ['127.0.0.1:43042', '127.0.0.1:43043'], :namespace => 'test'
@ -189,6 +193,13 @@ class ClassTest < Test::Unit::TestCase
def test_stats def test_stats
end end
# def test_freed_struct_cannot_be_used
# @cache.send(:free)
# assert_raise(NoMethodError) do
# @cache.get 'test_freed_struct_cannot_be_used'
# end
# end
def test_thread_contention def test_thread_contention
end end