Package discord4j.core.shard
Class JdkKeyStore<K extends Comparable<K>>
- java.lang.Object
-
- discord4j.core.shard.JdkKeyStore<K>
-
- Type Parameters:
K
- the type of the keys tracked
- All Implemented Interfaces:
KeyStore<K>
public class JdkKeyStore<K extends Comparable<K>> extends Object implements KeyStore<K>
A repository for the entity keys tracked by each shard.
-
-
Constructor Summary
Constructors Constructor Description JdkKeyStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int shardId, K key)
Add the given key under a shard index.void
clear(int shardId)
Removes all keys stored under a given shard index.Set<K>
keys(int shardId)
Return an unmodifiableSet
of keys for the given shard index.void
remove(int shardId, K key)
Remove the given key from a shard index.
-
-
-
Method Detail
-
add
public void add(int shardId, K key)
Description copied from interface:KeyStore
Add the given key under a shard index.- Specified by:
add
in interfaceKeyStore<K extends Comparable<K>>
- Parameters:
shardId
- the shard index a key will be associated underkey
- the actual key to store
-
remove
public void remove(int shardId, K key)
Description copied from interface:KeyStore
Remove the given key from a shard index.- Specified by:
remove
in interfaceKeyStore<K extends Comparable<K>>
- Parameters:
shardId
- the shard index a key will be removed fromkey
- the actual key to remove
-
clear
public void clear(int shardId)
Description copied from interface:KeyStore
Removes all keys stored under a given shard index.- Specified by:
clear
in interfaceKeyStore<K extends Comparable<K>>
- Parameters:
shardId
- the shard index to remove all keys from
-
-