Class: Lti2Commons::Cache

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

Overview

Cache adapter. This adapter wraps a simple LRUCache gem. A more scalable and cluster-friendly cache solution such as Redis or Memcache # would probably be suitable in a production environment. This class is used to document the interface. In this particular case the interface exactly matches the protocol of the supplied implementation. Consequently, this adapter is not really required.

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Cache

create cache.



13
14
15
# File 'lib/lti2_commons/lib/lti2_commons/cache.rb', line 13

def initialize(options)
  @cache = LRUCache.new options
end

Instance Method Details

#clearObject



17
18
19
# File 'lib/lti2_commons/lib/lti2_commons/cache.rb', line 17

def clear
  @cache.clear
end

#fetch(name) ⇒ Object



21
22
23
# File 'lib/lti2_commons/lib/lti2_commons/cache.rb', line 21

def fetch(name)
  @cache.fetch(name)
end

#store(name, value) ⇒ Object



25
26
27
# File 'lib/lti2_commons/lib/lti2_commons/cache.rb', line 25

def store(name, value)
  @cache.store(name, value)
end