Class: Suo::Client::Memcached

Inherits:
Base
  • Object
show all
Defined in:
lib/suo/client/memcached.rb

Constant Summary

Constants inherited from Base

Base::BLANK_STR, Base::DEFAULT_OPTIONS

Instance Attribute Summary

Attributes inherited from Base

#client, #key, #options, #resources

Instance Method Summary collapse

Methods inherited from Base

#lock, #locked?, #locks, #refresh, #unlock

Constructor Details

#initialize(key, options = {}) ⇒ Memcached

Returns a new instance of Memcached.



4
5
6
7
# File 'lib/suo/client/memcached.rb', line 4

def initialize(key, options = {})
  options[:client] ||= Dalli::Client.new(options[:connection] || ENV["MEMCACHE_SERVERS"] || "127.0.0.1:11211")
  super
end

Instance Method Details

#clearObject



9
10
11
# File 'lib/suo/client/memcached.rb', line 9

def clear
  @client.with { |client| client.delete(@key) }
end