Package jetbrains.buildServer.util
Class UptodateValue<T>
- java.lang.Object
-
- jetbrains.buildServer.util.UptodateValue<T>
-
public class UptodateValue<T> extends Object
This class operates as a time-based cache for a calculable value.- Author:
- Pavel.Sher Date: 23.09.2008
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceUptodateValue.TimeToLiveProvider<T>static interfaceUptodateValue.UpdateCallback<T>static interfaceUptodateValue.ValueProvider<T>
-
Constructor Summary
Constructors Constructor Description UptodateValue(long timeToLiveMillis)This form is supposed to be used withfetchValue(ValueProvider)methodUptodateValue(UptodateValue.ValueProvider<T> provider, long timeToLiveMillis)The default form that suits most of the casesUptodateValue(UptodateValue.ValueProvider<T> provider, long ttl, TimeService timeService)Allows to use customTimeServiceUptodateValue(UptodateValue.ValueProvider<T> provider, long timeToLiveMillis, TimeService timeService, UptodateValue.UpdateCallback<T> onUpdate)This form adds the callback to be called when the value gets updated.UptodateValue(UptodateValue.ValueProvider<T> provider, long timeToLiveMillis, UptodateValue.UpdateCallback<T> onUpdate)This form adds the callback to be called when the value gets updated.UptodateValue(UptodateValue.ValueProvider<T> provider, UptodateValue.TimeToLiveProvider<T> ttlProvider, TimeService timeService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TfetchValue(UptodateValue.ValueProvider<T> explicitProvider)TgetValue()voidreset()
-
-
-
Constructor Detail
-
UptodateValue
public UptodateValue(long timeToLiveMillis)
This form is supposed to be used withfetchValue(ValueProvider)method- Parameters:
timeToLiveMillis- TTL of cached value in milliseconds- Since:
- 10.0
-
UptodateValue
public UptodateValue(@NotNull UptodateValue.ValueProvider<T> provider, long timeToLiveMillis)The default form that suits most of the cases- Parameters:
provider-UptodateValue.ValueProviderproviding new valuestimeToLiveMillis- TTL of cached value in milliseconds
-
UptodateValue
public UptodateValue(@NotNull UptodateValue.ValueProvider<T> provider, long timeToLiveMillis, @NotNull UptodateValue.UpdateCallback<T> onUpdate)This form adds the callback to be called when the value gets updated. The callback is only called when the value has actually changed according to Object.equals- Parameters:
provider-UptodateValue.ValueProviderproviding new valuestimeToLiveMillis- ttl Value TTL in millisecondsonUpdate- callback to be called when value gets updated- Since:
- 2019.2.1
-
UptodateValue
public UptodateValue(@NotNull UptodateValue.ValueProvider<T> provider, long timeToLiveMillis, @NotNull TimeService timeService, @NotNull UptodateValue.UpdateCallback<T> onUpdate)This form adds the callback to be called when the value gets updated. The callback is only called when the value has actually changed according to Object.equals Also supports custom TimeService- Parameters:
provider-UptodateValue.ValueProviderproviding new valuestimeToLiveMillis- ttl Value TTL in millisecondsonUpdate- callback to be called when value gets updated- Since:
- 2020.2
-
UptodateValue
public UptodateValue(UptodateValue.ValueProvider<T> provider, long ttl, TimeService timeService)
Allows to use customTimeService- Parameters:
provider-UptodateValue.ValueProviderproviding new valuesttl- TTL of cached value in millisecondstimeService- customTimeService
-
UptodateValue
@TestOnly public UptodateValue(UptodateValue.ValueProvider<T> provider, @NotNull UptodateValue.TimeToLiveProvider<T> ttlProvider, TimeService timeService)
-
-
Method Detail
-
getValue
public T getValue()
-
fetchValue
public T fetchValue(UptodateValue.ValueProvider<T> explicitProvider)
- Parameters:
explicitProvider- value provider- Returns:
- cached or updated value; data update occurs using explicitProvider
- Since:
- 10.0
-
reset
public void reset()
-
-