DataCacheTKey, TValue provides caching functionality for objects of different types, see list below.
Since the size of the stored objects need to be known to be able to trim the cache size, only a selected subset of types are allowed to be stored.
Objects can be removed from the cache in one of the following situations:
- An object is explicitly removed through a call to Remove(TKey).
- An object has not been fetched within a certain time period. This time period is controlled through a setting.
- The system is running low on memory and therefore the cache is reduced in size.
The owner of the cache is responsible for providing unique keys for each object to store in the cache.
Objects can be removed from the cache in one of the following situations:
- An object is explicitly removed through a call to Remove(TKey).
- An object has not been fetched within a certain time period. This time period is controlled through a setting.
- The system is running low on memory and therefore the cache is reduced in size.
The owner of the cache is responsible for providing unique keys for each object to store in the cache.
Inheritance Hierarchy
Spotfire.Dxp.Data.CollectionsDataCacheTKey, TValue
Namespace: Spotfire.Dxp.Data.Collections
Assembly: Spotfire.Dxp.Data (in Spotfire.Dxp.Data.dll) Version: 65.0.19510.3242 (65.0.19510.3242)
Syntax
C#
public sealed class DataCache<TKey, TValue> : IDisposable
Type Parameters
- TKey
- The type of the key.
- TValue
- The type of the data to store.
The following types are allowed to use:
PageableList<T>. Note that an object of type PageableList<T> must be in read-only state to be stored in the cache.
int
decimal
double
string
DateTime
BinaryLargeObject
TimeSpan. This is new in 3.1.0.
bool. This is new in 3.1.0.
float. This is new in 3.1.0.
long. This is new in 3.1.0.
DataValue<int>
DataValue<decimal>
DataValue<double>
DataValue<string>
DataValue<DateTime>
DataValue<BinaryLargeObject>
DataValue<TimeSpan>. This is new in 3.1.0.
DataValue<bool>. This is new in 3.1.0.
DataValue<float>. This is new in 3.1.0.
DataValue<long>. This is new in 3.1.0.
The DataCacheTKey, TValue type exposes the following members.
Constructors
Name | Description | |
---|---|---|
DataCacheTKey, TValue |
Initializes a new instance of the DataCacheTKey, TValue class that is empty.
|
Properties
Name | Description | |
---|---|---|
Count |
Gets the count of objects currently in the cache.
|
Methods
Name | Description | |
---|---|---|
Clear |
Removes all keys and values from the DataCacheTKey, TValue.
| |
Dispose |
Clears all items from the cache.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Remove |
Removes the value with the specified key from the DataCacheTKey, TValue.
| |
Set |
Sets a value for a certain key. If the key already exists in this cache the corresponding value is replaced.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
TryGetValue |
Tries to get a value for a certain key.
|
Version Information
Supported in: 14.3, 14.2, 14.1, 14.0, 12.5, 12.4, 12.3, 12.2, 12.1, 12.0, 11.8
See Also