예제 #1
0
        /// <summary>
        /// Clear any stored state for the specified item, both from memory
        /// as well as from the store.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        public void Clear <T>(LoadContext id) where T : new()
        {
            CacheEntry value;

            lock (_objectCache) {
                if (_objectCache.ContainsKey(typeof(T)) && _objectCache[typeof(T)].TryGetValue(id.UniqueKey, out value))
                {
                    value.Clear();
                    _objectCache[typeof(T)].Remove(id.UniqueKey);
                    StoreProvider.DeleteAll(id.UniqueKey);
                }
            }
        }