Class: Cerner::OAuth1a::RailsCache
- Defined in:
- lib/cerner/oauth1a/cache_rails.rb
Overview
Internal: An implementation of the Cerner::OAuth1a::Cache interface that utilizes ::Rails.cache.
Constant Summary
Constants inherited from Cache
Cache::ONE_HOUR, Cache::TWENTY_FOUR_HOURS
Instance Method Summary collapse
-
#get(namespace, key) ⇒ Object
Internal: Retrieves the entry, if available, from the cache store.
-
#initialize(rails_cache) ⇒ RailsCache
constructor
Internal: Constructs an instance with a instance of ActiveSupport::Cache::Store, which is generally ::Rails.cache.
-
#put(namespace, key, entry) ⇒ Object
Internal: Writes the entry to the cache store.
Methods inherited from Cache
#full_key, instance, instance=
Constructor Details
#initialize(rails_cache) ⇒ RailsCache
Internal: Constructs an instance with a instance of ActiveSupport::Cache::Store, which is generally ::Rails.cache.
rails_cache - An instance of ActiveSupport::Cache::Store.
21 22 23 24 |
# File 'lib/cerner/oauth1a/cache_rails.rb', line 21 def initialize(rails_cache) super() @cache = rails_cache end |
Instance Method Details
#get(namespace, key) ⇒ Object
Internal: Retrieves the entry, if available, from the cache store.
namespace - The namespace for the cache entries. key - The key for the cache entries.
39 40 41 |
# File 'lib/cerner/oauth1a/cache_rails.rb', line 39 def get(namespace, key) @cache.read(key, namespace: namespace) end |
#put(namespace, key, entry) ⇒ Object
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.
31 32 33 |
# 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 |