Ad-Hoc Cache Provider
Last updated
Last updated
IAdhocCacheService
in assembly SanteDB.Core.Api version 3.0.1980.0
Defines a service which can store commonly used objects in a transient cache
The ad-hoc cache service differs from the data cache in that the ad-hoc cache can be used to store any data with any key and value within the caching technology implementation. The cache is commonly used to store repeat or commonly fetched data (for example policy decision outcomes, keys, reference term lookups, etc.).
The cache can be used to save fetching and querying data to/from the persistence layer.
Note to Implementers: Your implementation of this interface should not be a persistent cache (if possible to enforce). The callers of this interface typically assume a short lifecycle of data within the cache, and transient, rapid access should be prioritized over durability.
Operation | Response/Return | Input/Parameter | Description |
---|---|---|---|
An implementation of IAdhocCacheService which uses the in-process memory cache
This implementation of the adhoc caching service uses in-process memory to store unstructured data which is commonly used in the application.
An implementation of the IAdhocCacheService which uses REDIS as the cache provider
This implementation of the REDIS ad-hoc cache provider serializes any data passed via TimeSpan})) to a JSON representation, then compresses (optional) the data and stores it in REDIS as a simple string
The data is stored in database 3 of the REDIS server
Add
void
String key T value Nullable<TimeSpan> timeout
Add the specified object to the cache
Get
T
String key
Gets the specified object from the cache
TryGet
Boolean
String key T& value
Try to fetch from the cache
Remove
Boolean
String key
Removes the specified object from the adhoc
RemoveAll
void
String patternKey
Remove all keys matching
Exists
Boolean
String key
Returns true if exists in the cache