示例#1
0
        internal bool PurgeExpiredLogs()
        {
            List <ModCache.LogKey> list = null;
            int num  = 0;
            int num2 = 0;

            foreach (KeyValuePair <ModCache.LogKey, ModCache.Log> keyValuePair in this.cache)
            {
                ModCache.LogKey key   = keyValuePair.Key;
                ModCache.Log    value = keyValuePair.Value;
                num += value.Mods.Count;
                if (value.LastUpdate + this.logExpiry < DateTime.UtcNow)
                {
                    if (list == null)
                    {
                        list = new List <ModCache.LogKey>(1);
                    }
                    list.Add(key);
                    num2 += value.Mods.Count;
                }
            }
            if (list != null)
            {
                foreach (ModCache.LogKey key2 in list)
                {
                    this.cache.Remove(key2);
                }
                ModCache.ModCacheTracer.TraceDebug <int, int, int>((long)this.nspiContext.ContextHandle, "ModCache.PurgeExpiredLogs: Purged {0} expired logs, total: {1}, removed: {2}", list.Count, num, num2);
            }
            return(num == num2);
        }
示例#2
0
 internal void RecordMods(int mid, PropTag propTag, IList <int> mids, bool isDeletion)
 {
     ModCache.ModCacheTracer.TraceDebug((long)this.nspiContext.ContextHandle, "ModCache.Log: mid='{0}', propTag={1}, mids.Count={2}, isDeletion={3}", new object[]
     {
         mid,
         propTag,
         mids.Count,
         isDeletion
     });
     ModCache.LogKey key = new ModCache.LogKey(mid, propTag);
     ModCache.Log    log;
     if (!this.cache.TryGetValue(key, out log))
     {
         log = new ModCache.Log(mids.Count);
         this.cache.Add(key, log);
     }
     foreach (int key2 in mids)
     {
         log.Mods[key2] = isDeletion;
     }
 }