class Lti2Commons::Cache

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.

Public Class Methods

new(options) click to toggle source

create cache. @params options [Hash] Should include ttl: <expiry_time>

# File lib/lti2_commons/lib/lti2_commons/cache.rb, line 13
def initialize(options)
  @cache = LRUCache.new options
end

Public Instance Methods

clear() click to toggle source
# File lib/lti2_commons/lib/lti2_commons/cache.rb, line 17
def clear
  @cache.clear
end
fetch(name) click to toggle source
# File lib/lti2_commons/lib/lti2_commons/cache.rb, line 21
def fetch(name)
  @cache.fetch(name)
end
store(name, value) click to toggle source
# File lib/lti2_commons/lib/lti2_commons/cache.rb, line 25
def store(name, value)
  @cache.store(name, value)
end