public override void SetAndReleaseItemExclusive(HttpContext context, string id, SessionStateStoreData item, object lockId, bool newItem)
        {
            ISessionStateItemCollection sessionItems = null;
            HttpStaticObjectsCollection staticObjects = null;

            if (item.Items.Count > 0)
                sessionItems = item.Items;
            if (!item.StaticObjects.NeverAccessed)
                staticObjects = item.StaticObjects;

            RedisSessionState state2 = new RedisSessionState(sessionItems, staticObjects, item.Timeout);
            RedisHelper.Set<string>(id, state2.ToJson(), DateTime.Now.AddHours(1));
        }
Пример #2
0
        public override void SetAndReleaseItemExclusive(HttpContext context, string id, SessionStateStoreData item, object lockId, bool newItem)
        {
            ISessionStateItemCollection sessionItems  = null;
            HttpStaticObjectsCollection staticObjects = null;

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

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

            RedisHelper.Set <string>(id, state2.ToJson(), DateTime.Now.AddHours(1));
        }
Пример #3
0
        private SessionStateStoreData DoGet(HttpContext context, string id, bool exclusive, out bool locked, out TimeSpan lockAge, out object lockId, out SessionStateActions actionFlags)
        {
            locked      = false;
            lockId      = null;
            lockAge     = TimeSpan.Zero;
            actionFlags = SessionStateActions.None;

            string getJson = "";

            getJson = RedisHelper.Get <string>(id);

            RedisSessionState state = RedisSessionState.FromJson(getJson);

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

            RedisHelper.ExpireEntryIn(id, state._timeout);

            return(CreateLegitStoreData(context, state._sessionItems, state._staticObjects, state._timeout));
        }
 public override void CreateUninitializedItem(HttpContext context, string id, int timeout)
 {
     RedisSessionState state = new RedisSessionState(null, null, timeout);
     RedisHelper.Set<string>(id, state.ToJson(), DateTime.Now.AddHours(1));
 }
Пример #5
0
        public override void CreateUninitializedItem(HttpContext context, string id, int timeout)
        {
            RedisSessionState state = new RedisSessionState(null, null, timeout);

            RedisHelper.Set <string>(id, state.ToJson(), DateTime.Now.AddHours(1));
        }