Package com.pingidentity.sdk.util
Class ConfigCache<ConfigType>
- java.lang.Object
-
- com.pingidentity.sdk.util.ConfigCache<ConfigType>
-
- Type Parameters:
ConfigType- The type of the configuration object that is cached.
public class ConfigCache<ConfigType> extends Object
This class allows plugins to create a configuration cache that is automatically reloaded when a replication event occurs. During replication, a fresh instance of the cached configuration is created in the background, without impacting runtime requests. When replication completes, the new cache becomes the active cache for runtime requests.
A typical use case is if a plugin needs to register a single endpoint for all instances of the plugin. The endpoint may rely on a configuration cache which is built from all instances of the plugin. If building the configuration cache may be time-consuming, this class allows the cache to be built in the background, without impacting runtime requests. A limitation is that, in standalone mode, if an instance of the plugin is saved or deleted, the configuration cache will not be automatically refreshed.- Since:
- 10.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceConfigCache.ConfigHolder<ConfigType>
-
Constructor Summary
Constructors Constructor Description ConfigCache(Supplier<ConfigType> configSupplier)Create an instance with the specified supplier.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the cached configuration object.ConfigTypeget()Get the cached configuration object.
-
-
-
Constructor Detail
-
ConfigCache
public ConfigCache(Supplier<ConfigType> configSupplier)
Create an instance with the specified supplier.- Parameters:
configSupplier- The function used to create the cached configuration object.
-
-
Method Detail
-
get
public ConfigType get()
Get the cached configuration object.- Returns:
- The cached configuration object.
-
clear
public void clear()
Clear the cached configuration object.
-
-