public CacheObject( Func <Task <T> > loadFun, TimeSpan timeSpan) { _loadFun = loadFun; _expiresAfterFq = StopWatchThreadSafe.MillsToFrequency((long)timeSpan.TotalMilliseconds); }
public void SimpleTest() { var watch = new StopWatchThreadSafe(); Thread.Sleep(5); Assert.AreEqual(StopWatchThreadSafe.MillsToFrequency(5), watch.Elapsed(), 500000); }
public ConnectionNode( string connectionId, Guid userId) { this.ConnectionId = connectionId; this.UserId = userId; this.LastSeen = new StopWatchThreadSafe(); }
public StateMachineMonadStore( IStateMachinePersistedCtxStore <TKey, TState, TEvent, TParam, TCtx, TUserId> stateMachinePersistedCtxStore, IStateMachineMonadSettings settings) { this.stateMachinePersistedCtxStore = stateMachinePersistedCtxStore; this.expiresAfter = StopWatchThreadSafe.MillsToFrequency(settings.TimeOutMs); this.cleanAfter = StopWatchThreadSafe.MillsToFrequency(settings.CleanAfterMs); }
public ConnectionNode( Guid connectionId, TExternalConnection externalConnection, Guid userId) { this.ConnectionId = connectionId; this.ExternalConnection = externalConnection; this.LastSeen = new StopWatchThreadSafe(); this.userId = userId; }
public AgentStore( uint queueSize, TimeSpan timeout, TimeSpan cleanInterval, IAgentContextStore <TContext> agentContextStore) { this.queueSize = queueSize; this.cleanInterval = cleanInterval; this.runners = new ConcurrentDictionary <long, AgentLocalRunner <TContext> >( 5, 1000); this.agentContextStore = agentContextStore; this.timeOutAfterFreq = StopWatchThreadSafe.MillsToFrequency((long)timeout.TotalMilliseconds); this.cleanInFrequency = StopWatchThreadSafe.MillsToFrequency((int)cleanInterval.TotalMilliseconds); }
public MessageBuilder( int total, MessageIdentifier messageIdentifier, MessageType messageType, TPayloadType payloadType, Guid userId, IBodyReconstructor <TBodyType> bodyReconstructor) { this.LastTouched = new StopWatchThreadSafe(); this.Total = total; this.BodyReconstructor = bodyReconstructor; this.MessageIdentifier = messageIdentifier; this.PayloadType = payloadType; this.UserId = userId; this.MessageType = messageType; this.Completed = false; }
public ContextNode(TCtx context) { this.LastUsed = new StopWatchThreadSafe(); this.Context = context; this.currentState = 0; }