public static PixelDataManager GetInstance(StudyStorageLocation storage) { string key = storage.Key.ToString(); lock (_cache) { PixelDataManager instance = _cache[key] as PixelDataManager; if (instance == null) { instance = new PixelDataManager(storage); _cache.Add(key, instance, null, Cache.NoAbsoluteExpiration, ImageStreamingServerSettings.Default.CacheRetentionWindow, CacheItemPriority.Default, UnloadPixelDataManager); } return instance; } }
public static PixelDataManager GetInstance(StudyStorageLocation storage) { string key = storage.Key.ToString(); lock (_cache) { PixelDataManager instance = _cache[key] as PixelDataManager; if (instance == null) { instance = new PixelDataManager(storage); _cache.Add(key, instance, null, Cache.NoAbsoluteExpiration, ImageStreamingServerSettings.Default.CacheRetentionWindow, CacheItemPriority.Default, UnloadPixelDataManager); } return(instance); } }
public static PixelDataManager GetInstance(StudyStorageLocation storage) { string key = storage.Key.ToString(); var instance = _cache[key] as PixelDataManager; if (instance != null) return instance; lock (_insertLock) { instance = _cache[key] as PixelDataManager; if (instance == null) { instance = new PixelDataManager(storage); _cache.Add(key, instance, null, Cache.NoAbsoluteExpiration, _cacheRetentionTime, CacheItemPriority.Default, null); } } return instance; }
public static PixelDataManager GetInstance(StudyStorageLocation storage) { string key = storage.Key.ToString(); var instance = _cache[key] as PixelDataManager; if (instance != null) { return(instance); } lock (_insertLock) { instance = _cache[key] as PixelDataManager; if (instance == null) { instance = new PixelDataManager(storage); _cache.Add(key, instance, null, Cache.NoAbsoluteExpiration, _cacheRetentionTime, CacheItemPriority.Default, null); } } return(instance); }
private static void UnloadPixelDataManager(string key, object value, CacheItemRemovedReason reason) { PixelDataManager instance = value as PixelDataManager; instance.Dispose(); }