Package org.yamcs.parameter
Class ParameterCacheImpl
java.lang.Object
org.yamcs.parameter.ParameterCacheImpl
- All Implemented Interfaces:
ParameterCache
Used by the
ParameterRequestManager
to cache last values of parameters.
The cache will contain the parameters for a predefined time period but can exceed that period if space is available
in the CacheEntry.
A CacheEntry also has a maximum size to prevent it accumulating parameters ad infinitum (e.g. if there are bogus
parameters with the timestamp never changing)
We keep delivery consisting of lists of parameter values together such that
if two parameters have been acquired in the same delivery, they will be given from the same delivery to the clients.
if cacheAll is enabled, all parameters will be cached as they are received.
if cacheAll is disabled:
- a parameter will be put on the list to cache only if somebody has requested it.
- obviously first time when the parameter is requested, no value will be returned.
- however this will greatly reduce the cache size since only a few parameters are monitored in the displays-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Remove all the parameters from the cacheReturns all values from the cache for the parameter or null if there is no value cached The parameter are returned in descending order (newest parameter is returned first)getAllValues
(Parameter p, long start, long stop) Same as above but return all values that have the generation time in the (start, stop] intervalReturns last cached value for parameter or null if there is no value in the cacheReturns cached value for parameter or an empty list if there is no value in the cachevoid
update
(Collection<ParameterValue> pvs) update the parameters in the cache
-
Constructor Details
-
ParameterCacheImpl
-
-
Method Details
-
update
Description copied from interface:ParameterCache
update the parameters in the cache- Specified by:
update
in interfaceParameterCache
- Parameters:
pvs
- - parameter value list
-
getValues
Description copied from interface:ParameterCache
Returns cached value for parameter or an empty list if there is no value in the cache- Specified by:
getValues
in interfaceParameterCache
- Returns:
-
getLastValue
Description copied from interface:ParameterCache
Returns last cached value for parameter or null if there is no value in the cache- Specified by:
getLastValue
in interfaceParameterCache
- Parameters:
p
- - parameter for which the last value is returned- Returns:
-
getAllValues
Description copied from interface:ParameterCache
Returns all values from the cache for the parameter or null if there is no value cached The parameter are returned in descending order (newest parameter is returned first)- Specified by:
getAllValues
in interfaceParameterCache
- Parameters:
p
- - parameter for which all values are returned- Returns:
- all values from the cache for the parameter or null if there is no value cached
-
getAllValues
Description copied from interface:ParameterCache
Same as above but return all values that have the generation time in the (start, stop] interval- Specified by:
getAllValues
in interfaceParameterCache
- Returns:
-
clear
public void clear()Description copied from interface:ParameterCache
Remove all the parameters from the cache- Specified by:
clear
in interfaceParameterCache
-