class Cerner::OAuth1a::RailsCache
Internal: An implementation of the Cerner::OAuth1a::Cache
interface that utilizes ::Rails.cache.
Public Class Methods
new(rails_cache)
click to toggle source
Internal: Constructs an instance with a instance of ActiveSupport::Cache::Store, which is generally ::Rails.cache.
rails_cache - An instance of ActiveSupport::Cache::Store.
Calls superclass method
Cerner::OAuth1a::Cache::new
# File lib/cerner/oauth1a/cache_rails.rb, line 21 def initialize(rails_cache) super() @cache = rails_cache end
Public Instance Methods
get(namespace, key)
click to toggle source
Internal: Retrieves the entry, if available, from the cache store.
namespace - The namespace for the cache entries. key - The key for the cache entries.
# File lib/cerner/oauth1a/cache_rails.rb, line 39 def get(namespace, key) @cache.read(key, namespace: namespace) end
put(namespace, key, entry)
click to toggle source
Internal: Writes the entry to the cache store.
namespace - The namespace for the cache entries. key - The key for the cache entries, which is qualified by namespace. entry - The entry to be stored in the cache.
# File lib/cerner/oauth1a/cache_rails.rb, line 31 def put(namespace, key, entry) @cache.write(key, entry, namespace: namespace, expires_in: entry.expires_in, race_condition_ttl: 5) end