public override void BeginRequest(object sender, EventArgs e)
        {
            var path        = _context.Context.Request.Path;
            var queryString = _context.Request.QueryString.ToString();

            if (_paths.Contains(path) && queryString != string.Empty)
            {
                DashCacheItem dashCacheItem = InMemoryDashCacheGateway.Find(InMemoryDashCacheGateway.GenerateKey(path, queryString));
                InMemoryDashCacheGateway.SetCurrentDashCacheItem(dashCacheItem);
            }
        }
Ejemplo n.º 2
0
        // GET: api/Student
        public object Get()
        {
            var dashCacheItem = InMemoryDashCacheGateway.GetCurrentDashCacheItem();

            if (dashCacheItem == null)
            {
                var students = _unitOfWork.Students.FindAll(s => s.StudentId <= 300);
                InMemoryDashCacheGateway.SetCurrentDashCacheItem(new DashCacheItem(students.ToList()));
                return(students);
            }
            else
            {
                return(dashCacheItem.GetCachedItem <List <Student> >());
            }
        }
Ejemplo n.º 3
0
        // GET api/values
        public object Get()
        {
            var dashCacheItem = InMemoryDashCacheGateway.GetCurrentDashCacheItem();

            if (dashCacheItem == null)
            {
                var values = new string[] { "value1", "value2", "value3" };
                InMemoryDashCacheGateway.SetCurrentDashCacheItem(new DashCacheItem(values));
                return(values);
            }
            else
            {
                return(dashCacheItem.GetCachedItem <string[]>());
            }
        }
Ejemplo n.º 4
0
        // GET: api/Course
        public object Get()
        {
            var dashCacheItem = InMemoryDashCacheGateway.GetCurrentDashCacheItem();

            if (dashCacheItem == null)
            {
                var courses = _unitOfWork.Courses.FindAll(c => c.CourseId <= 300);
                InMemoryDashCacheGateway.SetCurrentDashCacheItem(new DashCacheItem(courses.ToList()));
                return(courses);
            }
            else
            {
                return(dashCacheItem.GetCachedItem <List <Course> >());
            }
        }