public CrossRateCalcInfosService(ISettingsRootService settingsRootService, IDependentCrossRatesService dependentCrossRatesService) { _settingsRootService = settingsRootService; _dependentCrossRatesService = dependentCrossRatesService; _dependentAssetPairs = DependentAssetPairsCache(); }
public AssetPairsInfoService(ISystem system, IAssetsService assetsService, IConvertService convertService) { _system = system; _assetsService = assetsService; _convertService = convertService; _assetPairs = GetAssetPairsCache(); }
public void Remove(string assetPairId) { _readerWriterLockSlim.EnterWriteLock(); try { if (_assetPairs.ContainsKey(assetPairId)) { _assetPairs.Remove(assetPairId); _assetPairsByAssets = GetAssetPairsByAssetsCache(); _assetPairsIds = Calculate.Cached(() => _assetPairs, CacheChangedCondition, p => p.Keys.ToImmutableHashSet()); } } finally { _readerWriterLockSlim.ExitWriteLock(); } }
/// <summary> /// Adds new item item if does not exist, otherwise updates /// </summary> /// <param name="assetPair"></param> /// <returns>true if added, false if updated</returns> public bool AddOrUpdate(IAssetPair assetPair) { _readerWriterLockSlim.EnterWriteLock(); var itemExists = _assetPairs.ContainsKey(assetPair.Id); try { if (itemExists) { _assetPairs.Remove(assetPair.Id); } _assetPairs.Add(assetPair.Id, assetPair); _assetPairsByAssets = GetAssetPairsByAssetsCache(); _assetPairsIds = Calculate.Cached(() => _assetPairs, CacheChangedCondition, p => p.Keys.ToImmutableHashSet()); return(!itemExists); } finally { _readerWriterLockSlim.ExitWriteLock(); } }
public AssetPairsCache() { _assetPairsByAssets = GetAssetPairsByAssetsCache(); _assetPairsIds = Calculate.Cached(() => _assetPairs, ReferenceEquals, p => p.Keys.ToImmutableHashSet()); }
public AssetPairsCache() { _assetPairsByAssets = GetAssetPairsByAssetsCache(); _assetPairsIds = Calculate.Cached(() => _assetPairs, CacheChangedCondition, p => p.Keys.ToImmutableHashSet()); }
public DayOffSettingsService(IDayOffSettingsRepository dayOffSettingsRepository, IAssetPairsCache assetPairsCache) { _dayOffSettingsRepository = dayOffSettingsRepository; _assetPairsCache = assetPairsCache; _exclusionsByAssetPairId = GetExclusionsByAssetPairIdCache(); }