Module: Mongo::Auth::CredentialCache Private
- Defined in:
- lib/mongo/auth/credential_cache.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Cache store for computed SCRAM credentials.
Class Attribute Summary collapse
- .store ⇒ Object readonly private
Class Method Summary collapse
- .cache(key) ⇒ Object private
- .clear ⇒ Object private
- .get(key) ⇒ Object private
- .set(key, value) ⇒ Object private
Class Attribute Details
.store ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/mongo/auth/credential_cache.rb', line 24 def store @store end |
Class Method Details
.cache(key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 41 42 43 44 |
# File 'lib/mongo/auth/credential_cache.rb', line 37 module_function def cache(key) value = get(key) if value.nil? value = yield set(key, value) end value end |
.clear ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/mongo/auth/credential_cache.rb', line 46 module_function def clear @store = {} end |
.get(key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 |
# File 'lib/mongo/auth/credential_cache.rb', line 27 module_function def get(key) @store ||= {} @store[key] end |
.set(key, value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 35 |
# File 'lib/mongo/auth/credential_cache.rb', line 32 module_function def set(key, value) @store ||= {} @store[key] = value end |