Class: CacheStoreApi::TestCache

Inherits:
Object
  • Object
show all
Defined in:
lib/cache-store-api/test_cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTestCache

Returns a new instance of TestCache.



4
5
6
# File 'lib/cache-store-api/test_cache.rb', line 4

def initialize
  @data = {}
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/cache-store-api/test_cache.rb', line 3

def data
  @data
end

Instance Method Details

#delete(key, options = nil) ⇒ Object



16
17
18
# File 'lib/cache-store-api/test_cache.rb', line 16

def delete(key, options = nil)
  data.delete key
end

#exist?(key, options = nil) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/cache-store-api/test_cache.rb', line 20

def exist?(key, options = nil)
  data.has_key? key
end

#read(key, options = nil) ⇒ Object



12
13
14
# File 'lib/cache-store-api/test_cache.rb', line 12

def read(key, options = nil)
  data[key]
end

#write(key, value, options = nil) ⇒ Object



8
9
10
# File 'lib/cache-store-api/test_cache.rb', line 8

def write(key, value, options = nil)
  data[key] = value
end