Class: CachedCounter::CacheStore::DalliCacheStore

Inherits:
Base
  • Object
show all
Defined in:
lib/cached_counter.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dalli_client) ⇒ DalliCacheStore

Returns a new instance of DalliCacheStore.

Parameters:

  • dalli_client (Dalli::Client)


279
280
281
# File 'lib/cached_counter.rb', line 279

def initialize(dalli_client)
  @dalli_client = dalli_client
end

Class Method Details

.create(options = {}) ⇒ Object



283
284
285
286
287
# File 'lib/cached_counter.rb', line 283

def self.create(options={})
  opts = options.dup
  hosts = opts.delete(:hosts)
  new(Dalli::Client.new(hosts, opts))
end

Instance Method Details

#add(key, value) ⇒ Object



297
298
299
# File 'lib/cached_counter.rb', line 297

def add(key, value)
  @dalli_client.add(key, value, 0, raw: true)
end

#decr(key) ⇒ Object



293
294
295
# File 'lib/cached_counter.rb', line 293

def decr(key)
  @dalli_client.decr(key)
end

#delete(key) ⇒ Object



305
306
307
# File 'lib/cached_counter.rb', line 305

def delete(key)
  @dalli_client.delete(key)
end

#error_classObject



309
310
311
# File 'lib/cached_counter.rb', line 309

def error_class
  Dalli::RingError
end

#get(key) ⇒ Object



301
302
303
# File 'lib/cached_counter.rb', line 301

def get(key)
  @dalli_client.get(key)
end

#incr(key) ⇒ Object



289
290
291
# File 'lib/cached_counter.rb', line 289

def incr(key)
  @dalli_client.incr(key)
end