class Hoodoo::TransientStore::Memcached
Hoodoo::TransientStore
plugin for Memcached. The Dalli gem is used for server communication.
Attributes
Overrideable access to this object’s Dalli::Client instance. It is inadvisable to couple calling code directly into this interface as it is a Hoodoo::TransientStore::Memcached
specialisation, but if deemed absolutely necessary the Dalli client can be override with a customised version.
Public Class Methods
See Hoodoo::TransientStore::Base::new
for details.
Do not instantiate this class directly. Use Hoodoo::TransientStore::new
.
The Dalli gem is used to talk to Memcached and accepts connection UIRs of simple, terse forms such as 'localhost:11211'
. Connections are configured with JSON serialisation, compression off and a forced namespace of nz_co_loyalty_hoodoo_transient_store_
to avoid collision of data stored with this object and other data that may be in the Memcached
instance identified by storage_host_uri
.
Hoodoo::TransientStore::Base::new
# File lib/hoodoo/transient_store/transient_store/memcached.rb, line 45 def initialize( storage_host_uri:, namespace: ) super # Pass all arguments through -> *not* 'super()' @client = connect_to_memcached( storage_host_uri, namespace ) end
Public Instance Methods
See Hoodoo::TransientStore::Base#close
for details.
# File lib/hoodoo/transient_store/transient_store/memcached.rb, line 72 def close @client.close() end
See Hoodoo::TransientStore::Base#delete
for details.
# File lib/hoodoo/transient_store/transient_store/memcached.rb, line 65 def delete( key: ) @client.delete( key ) true end
See Hoodoo::TransientStore::Base#get
for details.
# File lib/hoodoo/transient_store/transient_store/memcached.rb, line 59 def get( key: ) @client.get( key ) end
See Hoodoo::TransientStore::Base#set
for details.
# File lib/hoodoo/transient_store/transient_store/memcached.rb, line 52 def set( key:, payload:, maximum_lifespan: ) @client.set( key, payload, maximum_lifespan ) true end