示例#1
0
        public void SyncCache()
        {
            Trace.Call();

            if (!IsCaching)
            {
                return;
            }

            var start = DateTime.UtcNow;
            var conf  = _Config.GetAll();
            var cache = new Hashtable(conf.Count);

            foreach (var entry in conf)
            {
                cache.Add(entry.Key, entry.Value);
            }
            var stop = DateTime.UtcNow;

#if LOG4NET
            _Logger.Debug(
                String.Format(
                    "SyncCache(): syncing config took: {0:0.00} ms",
                    (stop - start).TotalMilliseconds
                    )
                );
#endif
            _Cache = cache;
        }
示例#2
0
        public void SyncCache()
        {
            Trace.Call();

            if (!IsCaching)
            {
                return;
            }

            var start = DateTime.UtcNow;
            var conf  = _Config.GetAll();
            var cache = new Hashtable(conf.Count);

            foreach (var entry in conf)
            {
                if (!entry.Key.StartsWith(_UserPrefix))
                {
                    // no need to cache values of other users
                    continue;
                }
                // remove user prefix from key
                var userKey = entry.Key.Substring(_UserPrefix.Length);
                cache.Add(userKey, entry.Value);
            }
            var stop = DateTime.UtcNow;

#if LOG4NET
            _Logger.Debug(
                String.Format(
                    "SyncCache(): syncing config took: {0:0.00} ms",
                    (stop - start).TotalMilliseconds
                    )
                );
#endif
            _Cache = cache;
        }