Class: Idempo::MemoryBackend::Store

Inherits:
Struct
  • Object
show all
Defined in:
lib/idempo/memory_backend.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



9
10
11
# File 'lib/idempo/memory_backend.rb', line 9

def key
  @key
end

#response_storeObject

Returns the value of attribute response_store

Returns:

  • (Object)

    the current value of response_store



9
10
11
# File 'lib/idempo/memory_backend.rb', line 9

def response_store
  @response_store
end

#store_mutexObject

Returns the value of attribute store_mutex

Returns:

  • (Object)

    the current value of store_mutex



9
10
11
# File 'lib/idempo/memory_backend.rb', line 9

def store_mutex
  @store_mutex
end

Instance Method Details

#lookupObject



10
11
12
13
14
# File 'lib/idempo/memory_backend.rb', line 10

def lookup
  store_mutex.synchronize do
    response_store.lookup(key)
  end
end

#store(data:, ttl:) ⇒ Object



16
17
18
19
20
# File 'lib/idempo/memory_backend.rb', line 16

def store(data:, ttl:)
  store_mutex.synchronize do
    response_store.save(key, data, ttl)
  end
end