private MemCacheSession(MemCache cache, string sessionId, bool readOnly) { Contract.Requires(cache != null); Cache = cache; m_sessionId = sessionId; m_readOnly = readOnly; m_pinnedToCas = new ConcurrentDictionary <CasHash, int>(); // No-item is always already here (no special pinning required) m_pinnedToCas.TryAdd(CasHash.NoItem, 0); SessionEntries = (!readOnly && !string.IsNullOrEmpty(sessionId)) ? new ConcurrentDictionary <StrongFingerprint, int>() : null; }
// Sessions that may be read-only can never have an ID internal MemCacheSession(MemCache cache, bool readOnly) : this(cache, null, readOnly) { }
// Sessions with an ID are never read-only internal MemCacheSession(MemCache cache, string sessionId) : this(cache, sessionId, false) { Contract.Requires(!string.IsNullOrEmpty(sessionId)); }