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.
27 28 29 |
# File 'lib/mongo/auth/credential_cache.rb', line 27 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.
40 41 42 43 44 45 46 47 |
# File 'lib/mongo/auth/credential_cache.rb', line 40 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.
49 50 51 |
# File 'lib/mongo/auth/credential_cache.rb', line 49 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.
30 31 32 33 |
# File 'lib/mongo/auth/credential_cache.rb', line 30 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.
35 36 37 38 |
# File 'lib/mongo/auth/credential_cache.rb', line 35 module_function def set(key, value) @store ||= {} @store[key] = value end |