Interface IDataCache
- Namespace
- Datafication.Core.Caching
- Assembly
- Datafication.Core.dll
Provides an interface for connectors that support data caching.
public interface IDataCache
Properties
ErrorHandler
Gets or sets an optional error handler that will be called when exceptions occur during cache operations. If not set, exceptions will be handled internally by the cache implementation.
Action<Exception>? ErrorHandler { get; set; }
Property Value
- Action<Exception>
ExpirationInterval
Gets the interval after which the cached data will expire, represented in ISO 8601 duration format. For example, "PT10M" represents a duration of 10 minutes.
string ExpirationInterval { get; }
Property Value
- string
The expiration interval for cached data in ISO 8601 format.
Methods
ClearCache(bool)
Clears data from the cache.
Task ClearCache(bool removeOnlyExpired)
Parameters
removeOnlyExpiredboolIf true, only expired entries are removed; otherwise, all entries are removed.
Returns
- Task
A task that represents the asynchronous operation.
GetCachedData(string)
Retrieves cached data associated with a specific ID.
Task<DataBlock> GetCachedData(string id)
Parameters
idstringThe unique identifier for the data to retrieve.
Returns
- Task<DataBlock>
A task that represents the asynchronous operation. The task result contains the cached data associated with the given ID, or null if the data is not found or has expired.
SetCachedData(string, DataBlock)
Stores data in the cache associated with a specific ID.
Task SetCachedData(string id, DataBlock data)
Parameters
idstringThe unique identifier for the data to store.
dataDataBlockThe data records to store in the cache.
Returns
- Task
A task that represents the asynchronous operation.