public static void UnregisterRemoteCacheDependency(RemoteCacheKeyDependency dependency) { if (dependency != null) { try { RemoteCache remoteCache; bool found = s_cacheList.TryGetValue(dependency.RemoteCacheID, out remoteCache); if (found) { remoteCache.UnregisterRemoteCacheDependency(dependency.RemoteCacheKey); lock (s_lock_object) { if (remoteCache.GetCacheKeyCount() == 0) { s_cacheList.Remove(dependency.RemoteCacheID); remoteCache.Dispose(); } } } } catch (Exception ex) { } } }
public static bool HasExpired(RemoteCacheKeyDependency depndency) { if (depndency != null) { if (s_cacheList.ContainsKey(depndency.RemoteCacheID)) { RemoteCache remoteCache = s_cacheList[depndency.RemoteCacheID]; if (remoteCache != null) { return(remoteCache.CheckExpiration(depndency.RemoteCacheKey)); } return(false); } } return(false); }
public static bool RegisterRemoteCacheDependency(RemoteCacheKeyDependency dependency) { if (dependency != null) { try { RemoteCache remoteCache; lock (s_lock_object) { if (!s_cacheList.ContainsKey(dependency.RemoteCacheID)) { remoteCache = new RemoteCache(dependency.RemoteCacheID); if (remoteCache != null) { remoteCache.Intialize(); s_cacheList.Add(dependency.RemoteCacheID, remoteCache); } } else { remoteCache = s_cacheList[dependency.RemoteCacheID]; } } if (remoteCache != null) { remoteCache.RegisterRemoteCacheDependency(dependency.RemoteCacheKey); } return(true); } catch (Exception ex) { throw; } } return(false); }