CachedInfluxRepo¶
Namespace: Database.Repository.InfluxRepo
Cached implementation of InfluxDB repository that buffers writes when InfluxDB is unavailable.
Decorates the base InfluxRepo with write-through caching for data resilience.
Inheritance Object → CachedInfluxRepo
Implements IInfluxRepo
Constructors¶
CachedInfluxRepo(IConfiguration, IMemoryCache, ILogger<CachedInfluxRepo>)¶
Constructor for the CachedInfluxRepo class.
public CachedInfluxRepo(IConfiguration configuration, IMemoryCache memoryCache, ILogger<CachedInfluxRepo> logger)
Parameters¶
configuration
IConfiguration
Configuration for InfluxDB connection
memoryCache
IMemoryCache
Memory cache for buffering failed writes
logger
ILogger<CachedInfluxRepo>
Logger instance
Exceptions¶
ArgumentException
Thrown when InfluxDB configuration is missing
Methods¶
GetCachedPoints()¶
Gets all cached PointData objects that failed to write to InfluxDB.
Used by background service for retry operations.
Returns¶
Dictionary of cache keys and their corresponding PointData objects
GetOutsideWeatherData(DateTime, DateTime, String)¶
public IAsyncEnumerable<PointDataValues> GetOutsideWeatherData(DateTime start, DateTime end, string place)
Parameters¶
start
DateTime
end
DateTime
place
String
Returns¶
IAsyncEnumerable<PointDataValues>
GetSensorWeatherData(DateTime, DateTime)¶
Parameters¶
start
DateTime
end
DateTime
Returns¶
IAsyncEnumerable<PointDataValues>
RemoveCachedPoint(Object)¶
Removes a cached point after successful retry.
Parameters¶
cacheKey
Object
The cache key to remove
WriteOutsideWeatherData(String, String, Double, DateTime, Int32)¶
public Task WriteOutsideWeatherData(string place, string website, double temperature, DateTime timestamp, int postalcode)
Parameters¶
place
String
website
String
temperature
Double
timestamp
DateTime
postalcode
Int32
Returns¶
WriteSensorData(Double, String, Int64, Int32)¶
Parameters¶
measurement
Double
sensor
String
timestamp
Int64
sequence
Int32