Example #1
0
        public void Add(IEntity obj)
        {
            if (obj == null)
            {
                return;
            }

            String key = CacheKey.getObject(obj.GetType(), obj.Id);

            addToContext(key, obj);
            CacheTime.updateObject(obj);   // 加入缓存的时候,设置最新 timestamp
        }
Example #2
0
        private static void addList(String key, IList objList)
        {
            if (objList == null)
            {
                return;
            }

            foreach (IEntity obj in objList)
            {
                addToApplication(CacheKey.getObject(obj.GetType(), obj.Id), obj);
                CacheTime.updateObject(obj);   // 加入缓存的时候,设置最新 timestamp
            }

            List <int> ids = new List <int>();

            foreach (IEntity obj in objList)
            {
                ids.Add(obj.Id);
            }
            addToApplication(key, ids);
            CacheTime.updateList(key);
        }