Exemple #1
0
        /// <summary>
        /// Configures a stored TimedQueue by its key.<para/>
        /// Note: if the queue does not exists, it will be created.
        /// </summary>
        /// <param name="key">The TimedQueue associated key.</param>
        /// <param name="timerStep">The interval between OnExecution calls by the internal timer thread.</param>
        /// <param name="action">The OnExecution action fired for every timer step.</param>
        /// <returns></returns>
        public static TimedQueue <T> Configure(string key, TimeSpan timerStep, Action <IEnumerable <T> > action)
        {
            TimedQueue <T> q = Get(key);

            q.TimerStep   = timerStep;
            q.OnExecution = action;
            return(q);
        }
Exemple #2
0
        /// <summary>
        /// Gets a stored TimedQueue by its key.<para/>
        /// Note: if the queue does not exists, it will be created.
        /// </summary>
        /// <param name="key">The TimedQueue associated key.</param>
        public static TimedQueue <T> Get(string key)
        {
            TimedQueue <T> q;

            if (!m_map.TryGetValue(key, out q))
            {
                q          = new TimedQueue <T> ();
                m_map[key] = q;
            }
            return(q);
        }