public void IncrementElementData(Guid elementId, string key, double changeAmount, double?expirationTimer = null) { PerformanceTracker pt = new PerformanceTracker("IncrementElementData"); string lockKey = elementId.ToString() + key; locks.TryAdd(lockKey, new ReaderWriterLockSlim()); var thisLock = locks[lockKey]; thisLock.EnterWriteLock(); var data = GenericData.GetPlaceData(elementId, key); double val = 0; Double.TryParse(data.ToString(), out val); val += changeAmount; GenericData.SetPlaceData(elementId, key, val.ToString(), expirationTimer); thisLock.ExitWriteLock(); if (thisLock.WaitingWriteCount == 0) { locks.TryRemove(lockKey, out thisLock); } pt.Stop(); }
public bool SetStoredElementData(Guid elementId, string key, string value, double?expiresIn = null) { return(GenericData.SetPlaceData(elementId, key, value, expiresIn)); }