Class DirectConnectionDemandsCache


  • public class DirectConnectionDemandsCache
    extends Object
    This class caches all peers for a direct connection has been demanded. This cache deletes all entries automatically after the time specified in expireTime. This class thus can be used to track currently demanded direct connections.
    • Constructor Detail

      • DirectConnectionDemandsCache

        public DirectConnectionDemandsCache​(int maximumSize,
                                            Duration expireTime)
        Creates a new cache which automatically removes any entry after the duration specified in expireTime. The cache can contain maximum of maximumSize entries. Evicts oldest entries if limit is exceeded.
        Parameters:
        maximumSize - maximum number of entries cache can contain
        expireTime - time after newly added entries will be automatically removed
    • Method Detail

      • add

        public void add​(CompressedPublicKey publicKey)
        Adds publicKey to the cache.
        Parameters:
        publicKey - public key to be added
      • contains

        public boolean contains​(CompressedPublicKey publicKey)
        Parameters:
        publicKey - the public key to be checked
        Returns:
        true, if publicKey is contained in cache. Otherwise false is returned
      • clear

        public void clear()
        Clears the cache.