CredentialCache — Documentation by YARD 0.9.37 (original) (raw)
Module: Mongo::Auth::CredentialCachePrivate
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.
Constant Summarycollapse
MUTEX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Mutex.new
Class Attribute Summary collapse
- .store ⇒ Object readonly private
Class Method Summarycollapse
- .cache(key) ⇒ Object private
- .clear ⇒ Object private
- .get(key) ⇒ Object private
- .set(key, value) ⇒ Object private
Class Attribute Details
.store ⇒ 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.
26 27 28 | # File 'lib/mongo/auth/credential_cache.rb', line 26 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.
45 46 47 48 49 50 51 52 | # File 'lib/mongo/auth/credential_cache.rb', line 45 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.
54 55 56 57 58 | # File 'lib/mongo/auth/credential_cache.rb', line 54 module_function def clear MUTEX.synchronize do @store = {} end 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.
| 31 32 33 34 35 36 | # File 'lib/mongo/auth/credential_cache.rb', line 31 module_function def get(key) MUTEX.synchronize do @store ||= {} @store[key] end 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.
| 38 39 40 41 42 43 | # File 'lib/mongo/auth/credential_cache.rb', line 38 module_function def set(key, value) MUTEX.synchronize do @store ||= {} @store[key] = value end end | | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |