Class CachedEncryptionKeyProvider

java.lang.Object
de.otto.kafka.messaging.e2ee.vault.CachedEncryptionKeyProvider
All Implemented Interfaces:
EncryptionKeyProvider

public final class CachedEncryptionKeyProvider extends Object implements EncryptionKeyProvider
This class is intended to be used as a 2nd-Level-Cache for the vault access. Meaning the results of all method calls should be cached with a 1st-Level-Cache.
  • Constructor Details

    • CachedEncryptionKeyProvider

      public CachedEncryptionKeyProvider(EncryptionKeyProvider realEncryptionKeyProvider, SecondLevelCacheStorage cacheStorage, Duration cachingDuration)
      Parameters:
      realEncryptionKeyProvider - the VaultEncryptionKeyProvider
      cacheStorage - the 2nd-level cache storage
      cachingDuration - the cache duration for the encryption keys. The decryption keys will never expire.
    • CachedEncryptionKeyProvider

      public CachedEncryptionKeyProvider(EncryptionKeyProvider realEncryptionKeyProvider, SecondLevelCacheStorage cacheStorage, Clock clock, Duration cachingDuration)
      Parameters:
      realEncryptionKeyProvider - the VaultEncryptionKeyProvider
      cacheStorage - the 2nd-level cache storage
      clock - a clock (used in unit tests)
      cachingDuration - the cache duration for the encryption keys. The decryption keys will never expire.
  • Method Details