Class: Cerner::OAuth1a::Cache
- Inherits:
-
Object
- Object
- Cerner::OAuth1a::Cache
- Defined in:
- lib/cerner/oauth1a/cache.rb
Overview
Internal: A simple cache abstraction for use by AccessTokenAgent only.
Direct Known Subclasses
Defined Under Namespace
Classes: AccessTokenEntry, DefaultCache, KeysEntry
Constant Summary collapse
- ONE_HOUR =
3_600
- TWENTY_FOUR_HOURS =
24 * ONE_HOUR
Class Method Summary collapse
-
.instance ⇒ Object
Internal: Gets the singleton instance.
-
.instance=(cache_impl) ⇒ Object
Internal: Sets the singleton instance.
Instance Method Summary collapse
-
#full_key(namespace, key) ⇒ Object
Internal: Constructs a single, fully qualified key based on the namespace and key value passed.
-
#get(namespace, key) ⇒ Object
Internal: Retrieves the entry, if available, from the cache store.
-
#initialize ⇒ Cache
constructor
Internal: The base constructor for the interface.
-
#put(namespace, key, entry) ⇒ Object
Internal: The abstract operation for putting (storing) data in the cache.
Constructor Details
#initialize ⇒ Cache
Internal: The base constructor for the interface.
116 |
# File 'lib/cerner/oauth1a/cache.rb', line 116 def initialize; end |
Class Method Details
.instance ⇒ Object
Internal: Gets the singleton instance.
17 18 19 20 21 22 23 |
# File 'lib/cerner/oauth1a/cache.rb', line 17 def self.instance @cache_instance_lock.synchronize do return @cache_instance if instance_variable_defined?(:@cache_instance) && @cache_instance @cache_instance = DefaultCache.new(max: 50) end end |
.instance=(cache_impl) ⇒ Object
Internal: Sets the singleton instance.
10 11 12 13 14 |
# File 'lib/cerner/oauth1a/cache.rb', line 10 def self.instance=(cache_impl) raise ArgumentError, 'cache_impl must not be nil' unless cache_impl @cache_instance_lock.synchronize { @cache_instance = cache_impl } end |
Instance Method Details
#full_key(namespace, key) ⇒ Object
Internal: Constructs a single, fully qualified key based on the namespace and key value passed.
namespace - The namespace for the cache entries. key - The key for the cache entries.
136 137 138 |
# File 'lib/cerner/oauth1a/cache.rb', line 136 def full_key(namespace, key) "#{namespace}:#{key}" end |
#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.
129 |
# File 'lib/cerner/oauth1a/cache.rb', line 129 def get(namespace, key); end |
#put(namespace, key, entry) ⇒ Object
Internal: The abstract operation for putting (storing) data in the cache.
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.
123 |
# File 'lib/cerner/oauth1a/cache.rb', line 123 def put(namespace, key, entry); end |