Package me.lucko.luckperms.common.cache
Class BufferedRequest<T>
java.lang.Object
me.lucko.luckperms.common.cache.BufferedRequest<T>
- Type Parameters:
T- the return type
- Direct Known Subclasses:
SyncTask.Buffer
Thread-safe request buffer.
Waits for the buffer time to pass before performing the operation.
If the request is called again in that time, the buffer time is reset.
-
Constructor Summary
ConstructorsConstructorDescriptionBufferedRequest(long bufferTime, TimeUnit unit, SchedulerAdapter schedulerAdapter) Creates a new buffer with the given timeout millis -
Method Summary
-
Constructor Details
-
BufferedRequest
Creates a new buffer with the given timeout millis- Parameters:
bufferTime- the timeoutunit- the unit of the timeout
-
-
Method Details
-
request
Makes a request to the buffer- Returns:
- the future
-
isEnqueued
public boolean isEnqueued()Gets if the request buffer has been enqueued- Returns:
- if the buffer is enqueued
-
requestDirectly
Requests the value, bypassing the buffer- Returns:
- the value
-
perform
Performs the buffered task- Returns:
- the result
-