void GetCache(string sessionId, string key, out object value, string group, string subGroup, out Alachisoft.NCache.Web.Caching.Cache cache, bool isGet, ref LockHandle lockHandle, bool acquireLock) { value = null; //Implementation For Raiynair cookieless robots string sidPrefix = string.Empty; sidPrefix = sessionId.Substring(0, 4); if (!_settings.PrimaryCache.Contains(sidPrefix) && _isSessionCookieless) { _isSessionCookieless = false; cache = null; return; } _isSessionCookieless = false; cache = _caches[GetCache(sessionId)] as Alachisoft.NCache.Web.Caching.Cache; if (cache != null) { if (isGet) { value = cache.Get(key, Alachisoft.NCache.Web.Caching.Cache.NoLockExpiration, ref lockHandle, acquireLock); } } else { if (_currentSessionCache == null || _currentSessionCache == string.Empty) { IDictionaryEnumerator cacheDic = _caches.GetEnumerator(); do { /// This code will ensure that primary cache is used first to be lookedin. if (cache == null) { cache = _caches[_primaryCache] as Alachisoft.NCache.Web.Caching.Cache; } else { cache = (Alachisoft.NCache.Web.Caching.Cache)cacheDic.Value;// select the cache from enumerator. // primary cache is already traversed so no need to do it again. if (cache.ToString().Equals(_primaryCache)) { continue; } } if (isGet) { value = cache.Get(key, Alachisoft.NCache.Web.Caching.Cache.NoLockExpiration, ref lockHandle, acquireLock); } else { if (cache.Contains(key)) { value = new object(); break; } } } while (cacheDic.MoveNext() && value == null); if (value != null) // value was found from one of the caches. so use that cache for all further operations during this HTTP request. { _currentSessionCache = cache.ToString(); } else// value wasn't found from any of the caches. thus use hte primary cache for all further operations. { _currentSessionCache = _primaryCache; } } else { cache = _caches[_currentSessionCache] as Alachisoft.NCache.Web.Caching.Cache; if (isGet) { value = cache.Get(key, Alachisoft.NCache.Web.Caching.Cache.NoLockExpiration, ref lockHandle, acquireLock); } } } }