public ContributionTsdb( IOptions <ContributionTsDbConfig> tsConfig, ILogger <ContributionTsdb> logger ) { _config = tsConfig; _logger = logger; _xStorageAccount = CloudStorageAccount.Parse(_config.Value.AzStorageConnectionString); _xTableClient = _xStorageAccount.CreateCloudTableClient(new TableClientConfiguration()); var tsTable = _xTableClient.GetTableReference(_config.Value.AzStorageTable); tsTable.CreateIfNotExists(); _bypassLocalCache = string.IsNullOrEmpty(_config.Value.LocalPreAggCachePath); if (!_bypassLocalCache) { var options = new DbOptions().SetCreateIfMissing(true); // 1.5 hours are a bit far exceed the time span but should be okay _preAggDatabase = RocksDb.OpenWithTtl(options, Path.Combine(_config.Value.LocalPreAggCachePath, "PreAggDb"), (int)TimeSpan.FromHours(1.3).TotalSeconds); _formatter = new BinaryFormatter(); } }
public PageRepository(IOptions <CachingConfig> cachingConfig, ILogger <CachingConfig> logger) { _cachingConfig = cachingConfig; _logger = logger; var options = new DbOptions() .SetCreateIfMissing(true); _dbInstance = RocksDb.OpenWithTtl(options, Path.Combine(_cachingConfig.Value.Path, "PageCache.db"), _cachingConfig.Value.CacheTimeToLive); _formatter = new BinaryFormatter(); }