Interface OracleConfigurationCachableProvider

  • All Superinterfaces:
    OracleConfigurationProvider

    public interface OracleConfigurationCachableProvider
    extends OracleConfigurationProvider

    The Cachable interface provides methods for caching objects. It extends the OracleConfigurationProvider interface, inheriting its behaviors.

    If any external provider requires caching, consider using OracleConfigurationCachableProvider interface instead of OracleConfigurationProvider. Utilizing OracleConfigurationCachableProvider lets the driver control when the cache entry should be purged. For example, the driver calls removeProperties(String) to remove the cache entry when an "ORA-1017 Invalid Username/Password" error occurs.

    The driver provides OracleConfigurationCache, which is a thread-safe LRU cache that can be used to store the configuration from the remote location. The built-in providers that implement OracleConfigurationCachableProvider interface ( OracleConfigurationJsonFileProvider, OracleConfigurationJsonHttpsProvider and the providers that extend OracleConfigurationJsonProvider) use OracleConfigurationCache to cache configuration.

    The state of a cache entry can be "valid", "softly expired" or "hardly expired". A valid cache entry becomes softly expired after its config_time_to_live value expires, and can still be used for additional 30 minutes until it becomes hardly expired. During these 30 minutes, the cache attempts to refresh the configuration by reaching out to the remote location where the configuration stores. An entry becomes valid again once it is refreshed. Otherwise, it is considered as hardly expired if the remote location is not reachable.

    The config_time_to_live value is 86400 in seconds (24 hours) by default and it can be configured by specifying the "config_time_to_live" field in the configuration. Here is an example of the configuration which has a config_time_to_live value of 10 seconds in JSON format:

      {
        "connect_descriptor": "(description=(address_list=(address=(protocol=tcp)
            (host=myhost)(port=5521)))(connect_data=(service_name=myservice)))",
        "user": "scott",
        "password": {
          "type": "base64",
          "value": "dGlnZXI="
        },
        "wallet_location": {
          "type": "base64",
          "value": "bXl3YWxsZXRiaW5hcnlmaWxlCg=="
        },
        "jdbc": {
          "autoCommit": "true"
        },
        "config_time_to_live": 10
      }
      

    • Method Detail

      • removeProperties

        java.util.Properties removeProperties​(java.lang.String location)
        Remove the properties from cache
        Parameters:
        location - the key of the properties to be removed from the cache
        Returns:
        Properties if the removal succeeds, otherwise, return null