зеркало из https://github.com/github/memcached.git
Add binary cache
Also flush on teardown instead'
This commit is contained in:
Родитель
cae701439d
Коммит
8efa44489a
|
@ -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
|
||||||
|
|
Загрузка…
Ссылка в новой задаче