Module: Mongo::Auth::CredentialCache Private

Defined in:
build/ruby-driver-v2.19/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.

Since:

  • 2.0.0

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.storeObject (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.

Since:

  • 2.0.0



27
28
29
# File 'build/ruby-driver-v2.19/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.

Since:

  • 2.0.0



40
41
42
43
44
45
46
47
# File 'build/ruby-driver-v2.19/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

.clearObject

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.

Since:

  • 2.0.0



49
50
51
# File 'build/ruby-driver-v2.19/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.

Since:

  • 2.0.0



30
31
32
33
# File 'build/ruby-driver-v2.19/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.

Since:

  • 2.0.0



35
36
37
38
# File 'build/ruby-driver-v2.19/lib/mongo/auth/credential_cache.rb', line 35

module_function def set(key, value)
  @store ||= {}
  @store[key] = value
end