public async Task <IMachineHistoryStorage> GetForMachineAsync(string machineNameKey, CancellationToken token) { var machineRootKey = $"{StorageKeyPrefix}.{machineNameKey}"; var value = await _distributedCache.GetAsync(machineRootKey, token).ConfigureAwait(false); if (value is null) { await _distributedCache.SetStringAsync(machineRootKey, JsonConvert.SerializeObject(MachineHistoryPage.Empty(machineNameKey)), token) .ConfigureAwait(false); } return(new MachineHistoryStorage(machineRootKey, _distributedCache)); }
private async Task SavePageAsync(MachineHistoryPage page, CancellationToken token) { await _distributedCache.SetStringAsync(_machineRootKey, JsonConvert.SerializeObject(page), token).ConfigureAwait(false); }