コード例 #1
0
 internal void Nullify(ulong actionId)
 {
     lock (_lock)
     {
         _cache[actionId] = new ActivityCacheItem();
     }
 }
コード例 #2
0
        public Activity Get(ulong actionId)
        {
            lock (_lock)
            {
                if (_cache.TryGetValue(actionId, out ActivityCacheItem item))
                {
                    item.LastAccess = DateTime.Now;
                    return(item.Activity);
                }
            }
            //else
            var newitem = new ActivityCacheItem();
            var action  = ActivityActions.GetById((uint)actionId);

            if (action != null)
            {
                newitem.Activity = new Activity(action);
            }
            lock (_lock)
            {
                _cache[actionId] = newitem;
            }
            return(newitem.Activity);
        }