Class: Lti2Commons::Cache
- Inherits:
-
Object
- Object
- Lti2Commons::Cache
- 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
- #clear ⇒ Object
- #fetch(name) ⇒ Object
-
#initialize(options) ⇒ Cache
constructor
create cache.
- #store(name, value) ⇒ Object
Constructor Details
#initialize(options) ⇒ Cache
create cache.
13 14 15 |
# File 'lib/lti2_commons/lib/lti2_commons/cache.rb', line 13 def initialize() @cache = LRUCache.new end |
Instance Method Details
#clear ⇒ Object
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 |