Class RequestPeerInformationCache
java.lang.Object
org.drasyl.peer.connection.direct.RequestPeerInformationCache
This class caches all peers for which information has been requested. This cache deletes all
 entries automatically after the time specified in 
expireTime. This class thus
 ensures that the same peer is not asked for information too frequently.- 
Constructor Summary
ConstructorsConstructorDescriptionRequestPeerInformationCache(int maximumSize, Duration expireTime) Creates a new cache which automatically removes any entry after the duration specified inexpireTime. - 
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(CompressedPublicKey publicKey) AddspublicKeyto the cache if it is not already cached. 
- 
Constructor Details
- 
RequestPeerInformationCache
Creates a new cache which automatically removes any entry after the duration specified inexpireTime. The cache can contain maximum ofmaximumSizeentries. Evicts oldest entries if limit is exceeded.- Parameters:
 maximumSize- maximum number of entries cache can containexpireTime- time after newly added entries will be automatically removed
 
 - 
 - 
Method Details
- 
add
AddspublicKeyto the cache if it is not already cached.- Parameters:
 publicKey- the public key that should be added- Returns:
 trueif the key was not already cached, otherwisefalseis returned
 
 -