Daily + GLPriceCache optimizations
Some checks failed
Build .NET Project / build (push) Has been cancelled
Some checks failed
Build .NET Project / build (push) Has been cancelled
This commit is contained in:
@@ -17,9 +17,25 @@ namespace MarketData.Cache
|
||||
private static GLPriceCache instance = null;
|
||||
// -- Disposal -------------------------------------------------------------
|
||||
private volatile bool disposed = false;
|
||||
|
||||
private int refreshInProgress = 0;
|
||||
|
||||
// -- State ----------------------------------------------------------------
|
||||
private readonly Dictionary<string, PricesByDate> priceCache = new Dictionary<string, PricesByDate>();
|
||||
private readonly ConcurrentDictionary<string, object> symbolFetchLocks = new ConcurrentDictionary<string, object>();
|
||||
private readonly object cacheLock = new object();
|
||||
private DateTime latestDate = Utility.Epoch;
|
||||
|
||||
// -- Background refresh ---------------------------------------------------
|
||||
private readonly TimeSpan cacheCycle = TimeSpan.FromMinutes(5);
|
||||
private Timer refreshTimer = null;
|
||||
private int tickCount = 0;
|
||||
// private const int evictionTickInterval = 12; // every 12 ticks x 5 min = 1 hour
|
||||
private const int evictionTickInterval = 144; // every 144 ticks x 5 min interval length = 12 hour. (144 intervals *5 minutes )/60 minutes = 12 hours
|
||||
|
||||
// -- Parallelism ----------------------------------------------------------
|
||||
private static readonly int maxParallelDbCalls = ResolveMaxParallelDbCalls();
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -33,21 +49,6 @@ namespace MarketData.Cache
|
||||
}
|
||||
}
|
||||
|
||||
// -- State ----------------------------------------------------------------
|
||||
private readonly Dictionary<string, PricesByDate> priceCache = new Dictionary<string, PricesByDate>();
|
||||
private readonly ConcurrentDictionary<string, object> symbolFetchLocks = new ConcurrentDictionary<string, object>();
|
||||
private readonly object cacheLock = new object();
|
||||
private DateTime latestDate = Utility.Epoch;
|
||||
|
||||
// -- Background refresh ---------------------------------------------------
|
||||
private readonly TimeSpan cacheCycle = TimeSpan.FromMinutes(5);
|
||||
private Timer refreshTimer = null;
|
||||
private int tickCount = 0;
|
||||
private const int evictionTickInterval = 12; // every 12 ticks x 5 min = 1 hour
|
||||
|
||||
// -- Parallelism ----------------------------------------------------------
|
||||
private static readonly int maxParallelDbCalls = ResolveMaxParallelDbCalls();
|
||||
|
||||
private static int ResolveMaxParallelDbCalls()
|
||||
{
|
||||
return Math.Min(Math.Max(1, Environment.ProcessorCount) * 3, 32);
|
||||
|
||||
Reference in New Issue
Block a user