/// <summary> /// /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { if (disposing) { _containerKey = null; _cachePool = null; _container = null; } base.Dispose(disposing); }
internal EntityContainer(BaseCachePool cachePool, Func <bool, bool> loadFactory, Func <string, bool, bool> loadItemFactory) { _cachePool = cachePool; _loadFactory = loadFactory; _loadItemFactory = loadItemFactory; _containerKey = typeof(T).FullName; if (_cachePool != null && !_cachePool.TryGetValue(_containerKey, out _container)) { Initialize(); _cachePool.TryGetValue(_containerKey, out _container); } }
/// <summary> /// Initialize cache. /// </summary> /// <param name="dbTransponder">db trans object</param> /// <param name="redisTransponder">redis trans object</param> /// <param name="setting">setting.</param> /// <param name="serializer"></param> public static void Initialize(ITransponder dbTransponder, ITransponder redisTransponder, CacheSetting setting, ICacheSerializer serializer) { _readonlyPools = new CachePool(dbTransponder, redisTransponder, true, serializer); _writePools = new CachePool(dbTransponder, redisTransponder, false, serializer) { Setting = setting }; EntitySchemaSet.InitSchema(typeof(EntityHistory)); DataSyncQueueManager.Start(setting, serializer); InitListener("__CachePoolListener", setting.ExpiredInterval, "__CachePoolUpdateListener", setting.UpdateInterval); if (setting.AutoRunEvent) { StartListener(); } }
/// <summary> /// Initialize cache. /// </summary> /// <param name="dbTransponder">db trans object</param> /// <param name="redisTransponder">redis trans object</param> /// <param name="setting">setting.</param> public static void Initialize(ITransponder dbTransponder, ITransponder redisTransponder, CacheSetting setting) { _readonlyPools = new CachePool(dbTransponder, redisTransponder, true); _writePools = new CachePool(dbTransponder, redisTransponder, false) { Setting = setting }; RedisConnectionPool.Initialize(); EntitySchemaSet.InitSchema(typeof(EntityHistory)); _entitySync.Start(); InitListener("__CachePoolListener", setting.ExpiredInterval, "__CachePoolUpdateListener", setting.UpdateInterval); if (setting.AutoRunEvent) { StartListener(); } }
internal EntityContainer(BaseCachePool cachePool, Func <bool, bool> loadFactory, Func <string, bool, bool> loadItemFactory) { _cachePool = cachePool; _loadFactory = loadFactory; _loadItemFactory = loadItemFactory; _containerKey = typeof(T).FullName; if (_cachePool != null && !_cachePool.TryGetValue(_containerKey, out _container)) { Initialize(); _cachePool.TryGetValue(_containerKey, out _container); } if (_container == null) { TraceLog.WriteError("加载{0}-EntityContainer失败,未能获取_container", _containerKey); } else if (_container.Collection == null) { TraceLog.WriteError("加载{0}-EntityContainer失败,未能获取Collection", _containerKey); } }
/// <summary> /// Reset. /// </summary> public static void Reset() { _momoryPools = new CachePool(null, null, false, new ProtobufCacheSerializer()); }
static MemoryCacheStruct() { _momoryPools = new CachePool(null, null, false); }
/// <summary> /// Reset. /// </summary> public static void Reset() { _momoryPools = new CachePool(null, null, false); }