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)
@marshalled_value = Marshal.dump(@value)
@cache = nil
@binary_protocol_cache = nil
end
def teardown
@cache.flush if @cache
@binary_protocol_cache.flush if @binary_protocol_cache
end
private
@ -23,8 +29,17 @@ class BaseTest < Minitest::Test
def cache
return @cache if @cache
@cache = Memcached::Client.new(@servers) #, @options)
@cache.flush
@cache
end
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
def key