Ejemplo n.º 1
0
        public override void CreateUninitializedItem(HttpContext context, string id, int timeout)
        {
            string key = this.CreateSessionStateCacheKey(id);

            CheckIdLength(id, true);
            InProcSessionState state = new InProcSessionState(null, null, timeout);

            HttpRuntime.Cache.Add(key, state, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, timeout, 0), CacheItemPriority.NotRemovable, this._callback);
        }
Ejemplo n.º 2
0
        public void OnCacheItemRemoved(string key, object value, CacheItemRemovedReason reason)
        {
            InProcSessionState state = (InProcSessionState)value;

            if (this._expireCallback != null)
            {
                string id = key.Substring(CACHEKEYPREFIXLENGTH);
                this._expireCallback(id, CreateLegitStoreData(null, state._sessionItems, state._staticObjects, state._timeout));
            }
        }
Ejemplo n.º 3
0
        public override void RemoveItem(HttpContext context, string id, object lockId, SessionStateStoreData item)
        {
            string key = this.CreateSessionStateCacheKey(id);

            CheckIdLength(id, true);
            InProcSessionState state = (InProcSessionState)HttpRuntime.Cache.Get(key);

            if (state != null)
            {
                HttpRuntime.Cache.Remove(key);
            }
        }
Ejemplo n.º 4
0
        private SessionStateStoreData DoGet(HttpContext context, string id, bool exclusive, out bool locked, out TimeSpan lockAge, out object lockId, out SessionStateActions actionFlags)
        {
            string key = this.CreateSessionStateCacheKey(id);

            locked      = false;
            lockId      = null;
            lockAge     = TimeSpan.Zero;
            actionFlags = SessionStateActions.None;

            CheckIdLength(id, true);
            InProcSessionState state = (InProcSessionState)HttpRuntime.Cache.Get(key);

            if (state == null)
            {
                return(null);
            }

            return(CreateLegitStoreData(context, state._sessionItems, state._staticObjects, state._timeout));
        }
Ejemplo n.º 5
0
        public override void SetAndReleaseItemExclusive(HttpContext context, string id, SessionStateStoreData item, object lockId, bool newItem)
        {
            string key = this.CreateSessionStateCacheKey(id);

            ISessionStateItemCollection sessionItems  = null;
            HttpStaticObjectsCollection staticObjects = null;

            CheckIdLength(id, true);
            if (item.Items.Count > 0)
            {
                sessionItems = item.Items;
            }
            if (!item.StaticObjects.NeverAccessed)
            {
                staticObjects = item.StaticObjects;
            }

            InProcSessionState state2 = new InProcSessionState(sessionItems, staticObjects, item.Timeout);

            HttpRuntime.Cache.Insert(key, state2, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, state2._timeout, 0), CacheItemPriority.NotRemovable, this._callback);
        }