Package io.jenkins.plugins.restlistparam
Class ValueCache
java.lang.Object
io.jenkins.plugins.restlistparam.ValueCache
The processed entries of successful fetches (all pages, after extraction, filter and order), kept in memory for
each parameter's cache time, whatever caching headers the endpoint sent.
Entries are kept per job, parameter name and value-source configuration, so jobs with different credentials never share entries and a changed configuration makes earlier entries unreachable. The number of cached parameters is bounded; the least recently used one is evicted first. Nothing is written to disk.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classIdentifies one parameter's entries: the job's full name (""outside any job), the parameter name and the fingerprint of its value-source configuration. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final StringSystem property overridingDEFAULT_MAX_ENTRIES. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes the entries of all parameters.static voidStarts every Jenkins instance with an empty cache, also when one JVM runs several instances one after another.static ValueCacheget()getFresh(ValueCache.Key key, int cacheTimeMinutes) static ValueCache.KeykeyFor(AbstractRestListParameterDefinition definition, Item context) voidput(ValueCache.Key key, List<ValueItem> values) Stores the entries of a successful fetch, fetched now, replacing earlier entries of the same key.intsize()
-
Field Details
-
MAX_ENTRIES_PROPERTY
System property overridingDEFAULT_MAX_ENTRIES. -
DEFAULT_MAX_ENTRIES
public static final int DEFAULT_MAX_ENTRIES- See Also:
-
-
Method Details
-
get
-
clearOnStartup
Starts every Jenkins instance with an empty cache, also when one JVM runs several instances one after another. -
getFresh
- Parameters:
key- The parameter's keycacheTimeMinutes- The parameter's cache time; 0 or less means nothing is fresh- Returns:
- The cached entries if they were fetched less than
cacheTimeMinutesago, otherwisenull
-
put
Stores the entries of a successful fetch, fetched now, replacing earlier entries of the same key. -
clear
public void clear()Removes the entries of all parameters. -
size
public int size()- Returns:
- How many parameters have entries cached, fresh or not
-
keyFor
- Parameters:
definition- The parametercontext- The job the entries are fetched for, ornulloutside any job- Returns:
- The key of
definition's entries incontext
-