Beispiel #1
0
        protected object GetInternal(string key, bool slide = true, bool slideAsync = true)
        {
            var data   = HttpContext.Current.GetCacheItem(key);
            var result = data;

            if (slide)
            {
                var expire = UnlockedExtensions.GetNextTimeout(configuration.SessionTimeout);
                var prefix = GetSessionItemPrefix();
                SlideInternal(prefix, (int)expire.TotalSeconds, slideAsync);
            }
            return(result);
        }
        //public override void OnActionExecuted(ActionExecutedContext filterContext)
        //{
        //	base.OnActionExecuted(filterContext);
        //}

        //public override void OnResultExecuting(ResultExecutingContext filterContext)
        //{
        //	base.OnResultExecuting(filterContext);
        //}

        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            if (UnlockedStateStoreConfiguration.Instance.Disabled)
            {
                return;
            }
            if (Usage == UnlockedStateUsage.ReadWrite)
            {
                //var session = filterContext.HttpContext.GetContextItem(UNLOCKED_STATE_OBJECT_KEY);
                if (UnlockedStateStore.Items.Count > 0)
                {
                    //filterContext.StartSessionIfNew();
                    //var store = (IUnlockedStateStore)filterContext.GetContextItem(UNLOCKED_STATE_STORE_KEY);
                    // store.UpdateContext();
                    var expire = UnlockedExtensions.GetNextTimeout(UnlockedStateStore.Configuration.SessionTimeout);
                    UnlockedStateStore.Set(UnlockedExtensions.UNLOCKED_STATE_STORE_KEY, UnlockedStateStore.Items, expire,
                                           RunAsync);
                }
            }
            base.OnResultExecuted(filterContext);
            //UnlockedStateStore.Dispose();
        }