Also flush on teardown instead'
This commit is contained in:
Arthur Neves 2016-03-11 17:38:49 -05:00
Родитель cae701439d
Коммит 8efa44489a
1 изменённых файлов: 17 добавлений и 2 удалений

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

@ -16,6 +16,12 @@ class BaseTest < Minitest::Test
@value = OpenStruct.new(a: 1, b: 2, c: self.class) @value = OpenStruct.new(a: 1, b: 2, c: self.class)
@marshalled_value = Marshal.dump(@value) @marshalled_value = Marshal.dump(@value)
@cache = nil @cache = nil
@binary_protocol_cache = nil
end
def teardown
@cache.flush if @cache
@binary_protocol_cache.flush if @binary_protocol_cache
end end
private private
@ -23,8 +29,17 @@ class BaseTest < Minitest::Test
def cache def cache
return @cache if @cache return @cache if @cache
@cache = Memcached::Client.new(@servers) #, @options) @cache = Memcached::Client.new(@servers) #, @options)
@cache.flush end
@cache
def binary_protocol_cache
return @binary_protocol_cache if @binary_protocol_cache
binary_protocol_options = {
# :prefix_key => @prefix_key,
:hash => :default,
:distribution => :modula,
:binary_protocol => true
}
@binary_protocol_cache = Memcached::Client.new(@servers, binary_protocol_options)
end end
def key def key