Class CredentialsCache
java.lang.Object
io.prometheus.jmx.common.http.authenticator.CredentialsCache
Class to implement a Credentials cache that is size constrained
The cache will purge old entries to make size for a cacheable credential
A credential that exceeds maximumCacheSizeBytes is not cached
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(Credentials credentials) Method to add a Credentials to the cacheboolean
contains
(Credentials credentials) Method to return whether the cache contains the Credentialsint
Method to get the current cache size in bytesint
Method to get the maximum cache size in bytesboolean
remove
(Credentials credentials) Method to remove a Credentials from the cache
-
Constructor Details
-
CredentialsCache
Constructor- Parameters:
maximumCacheSizeBytes
- maximum cache size in bytes
-
-
Method Details
-
add
Method to add a Credentials to the cacheA credential that exceeds maximumCacheSizeBytes is not cached
- Parameters:
credentials
- credential
-
contains
Method to return whether the cache contains the Credentials- Parameters:
credentials
- credentials- Returns:
- true if the set contains the Credential, else false
-
remove
Method to remove a Credentials from the cache- Parameters:
credentials
- credentials- Returns:
- true if the Credentials existed and was removed, else false
-
getMaximumCacheSizeBytes
Method to get the maximum cache size in bytes- Returns:
- the maximum cache size in bytes
-
getCurrentCacheSizeBytes
Method to get the current cache size in bytes- Returns:
- the current cache size in bytes
-