Class: Lti2Commons::Cache
- Inherits:
-
Object
- Object
- Lti2Commons::Cache
- Defined in:
- 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.
15 16 17 |
# File 'lib/lti2_commons/cache.rb', line 15 def initialize() @cache = LRUCache.new end |
Instance Method Details
#clear ⇒ Object
19 20 21 |
# File 'lib/lti2_commons/cache.rb', line 19 def clear @cache.clear end |
#fetch(name) ⇒ Object
23 24 25 |
# File 'lib/lti2_commons/cache.rb', line 23 def fetch(name) @cache.fetch(name) end |
#store(name, value) ⇒ Object
27 28 29 |
# File 'lib/lti2_commons/cache.rb', line 27 def store(name, value) @cache.store(name, value) end |