Beispiel #1
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            //See if this request has cached data
            MemCachedD_Value cache = MemCacheD.Get_BSO <dynamic>("PxStat.Data", "Cube_API", "ReadCollection", DTO);

            Navigation_ADO adoNav = new Navigation_ADO(Ado);
            //If we're cacheing, we only want the cache to live until the next scheduled release goes live
            //Also, if there is a next release before the scheduled cache expiry time, then we won't trust the cache
            var      nextRelease     = adoNav.ReadNextLiveDate(DateTime.Now);
            DateTime nextReleaseDate = default;

            if (nextRelease.hasData)
            {
                if (!nextRelease.data[0].NextRelease.Equals(DBNull.Value))
                {
                    nextReleaseDate = Convert.ToDateTime(nextRelease.data[0].NextRelease);
                }
            }

            if (cache.hasData && nextReleaseDate >= cache.expiresAt)
            {
                Response.data = cache.data;
                return(true);
            }


            Cube_BSO cBso = new Cube_BSO();

            // cache store is done in the following function
            Response.data = cBso.ExecuteReadCollection(Ado, DTO);


            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            //so that caches don't get mixed up..
            DTO.meta = _meta;

            //See if this request has cached data
            MemCachedD_Value cache = MemCacheD.Get_BSO <dynamic>("PxStat.Data", "Cube_API", "ReadCollection", DTO);



            if (cache.hasData)
            {
                Response.data = cache.data;
                return(true);
            }


            if (Throttle_BSO.IsThrottled(Ado, HttpContext.Current.Request, Request, SamAccountName))
            {
                Log.Instance.Debug("Request throttled");
                Response.error = Label.Get("error.throttled");
            }

            Cube_BSO cBso = new Cube_BSO();

            // cache store is done in the following function
            Response.data = cBso.ExecuteReadCollection(Ado, DTO, _meta);


            return(true);
        }