Class: RemoteLock::Adapters::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/remote_lock/adapters/base.rb

Direct Known Subclasses

Memcached, Redis

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Base

Returns a new instance of Base.



6
7
8
# File 'lib/remote_lock/adapters/base.rb', line 6

def initialize(connection)
  @connection = connection
end

Class Method Details

.valid?(adapter) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
# File 'lib/remote_lock/adapters/base.rb', line 22

def self.valid?(adapter)
  adapter.respond_to?(:store) &&
    adapter.respond_to?(:has_key?) &&
    adapter.respond_to?(:delete)
end

Instance Method Details

#delete(key) ⇒ Object

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/remote_lock/adapters/base.rb', line 18

def delete(key)
  raise NotImplementedError
end

#has_key?(key, options = {}) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/remote_lock/adapters/base.rb', line 14

def has_key?(key, options = {})
  raise NotImplementedError
end

#store(key, options = {}) ⇒ Object

Raises:

  • (NotImplementedError)


10
11
12
# File 'lib/remote_lock/adapters/base.rb', line 10

def store(key, options = {})
  raise NotImplementedError
end