Class: Blix::Rest::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/blix/rest/cache.rb

Overview

cache server responses

Direct Known Subclasses

MemoryCache, RedisCache

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Cache

Returns a new instance of Cache.



8
9
10
# File 'lib/blix/rest/cache.rb', line 8

def initialize(params={})
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



6
7
8
# File 'lib/blix/rest/cache.rb', line 6

def params
  @params
end

Instance Method Details

#[](key) ⇒ Object



12
13
14
# File 'lib/blix/rest/cache.rb', line 12

def [](key)
  get(key)
end

#[]=(key, data) ⇒ Object



16
17
18
# File 'lib/blix/rest/cache.rb', line 16

def []=(key,data)
  set(key, data)
end

#clearObject

clear all data from the cache



23
24
25
# File 'lib/blix/rest/cache.rb', line 23

def clear

end

#delete(key) ⇒ Object



42
43
44
# File 'lib/blix/rest/cache.rb', line 42

def delete(key)

end

#get(key) ⇒ Object

retrieve data from the cache



28
29
30
# File 'lib/blix/rest/cache.rb', line 28

def get(key)

end

#key?(key) ⇒ Boolean

is key present in the cache

Returns:

  • (Boolean)


38
39
40
# File 'lib/blix/rest/cache.rb', line 38

def key?(key)

end

#set(key, data) ⇒ Object

set data in the cache



33
34
35
# File 'lib/blix/rest/cache.rb', line 33

def set(key, data)

end