public void RemoveCache(string catalogCacheName) { lock (this) { CatalogCache cache = (CatalogCache)_caches[catalogCacheName]; if (cache != null) { _caches.Remove(catalogCacheName); } } }
public void RemoveSession(RemoteServerSession session) { lock (this) { CatalogCache cache = (CatalogCache)_caches[session.CatalogCacheName]; if (cache != null) { cache.Sessions.Remove(session); } } }
public void AddSession(RemoteServerSession session) { lock (this) { CatalogCache cache = (CatalogCache)_caches[session.CatalogCacheName]; if (cache == null) { cache = new CatalogCache(session.CatalogCacheName, session.Server.CacheTimeStamp, _defaultCachedObjects); _caches.Add(cache.CacheName, cache); } cache.Sessions.Add(session); } }
public void RemovePlanDescriptor(RemoteServerSession session, string catalogObjectName) { CatalogCache cache = (CatalogCache)_caches[session.CatalogCacheName]; if (cache != null) { lock (cache) { int index = cache.CachedObjects.IndexOfName(catalogObjectName); if (index >= 0) { cache.CachedObjects.RemoveAt(index); } } } }
public string[] GetRequiredObjects(RemoteServerSession session, Schema.Catalog catalog, long cacheTimeStamp, out long clientCacheTimeStamp) { List <string> requiredObjects = new List <string>(); CatalogCache cache = (CatalogCache)_caches[session.CatalogCacheName]; lock (cache) { bool cacheChanged = cache.EnsureConsistent(cacheTimeStamp, _defaultCachedObjects); foreach (Schema.Object objectValue in catalog) { if (!cache.CachedObjects.ContainsName(objectValue.Name)) { if (!((objectValue is Schema.DerivedTableVar) && (objectValue.Name == ((Schema.DerivedTableVar)objectValue).SessionObjectName))) { cache.CachedObjects.Add(objectValue); } requiredObjects.Add(objectValue.Name); } } if (!cacheChanged) { cache.UpdateTimeStamp(); } clientCacheTimeStamp = cache.TimeStamp; } string[] result = new string[requiredObjects.Count]; requiredObjects.CopyTo(result, 0); #if LOGCACHEEVENTS ASession.Server.LogMessage(String.Format("Session {0} cache timestamp updated to {1} with required objects: {2}", ASession.SessionID.ToString(), AClientCacheTimeStamp.ToString(), ExceptionUtility.StringsToCommaList(requiredObjects))); #endif return(result); }