public GridDataResult GetResultAndCache(List <T> dataset, string cacheKey, int cacheForSeconds)
        {
            List <gridProcessedObject <T> > processedDataset = processDataset(dataset);

            if (!String.IsNullOrEmpty(cacheKey) && cacheForSeconds > 0)
            {
                System.Web.HttpContext.Current.Cache.Add(cacheKey,
                                                         processedDataset,
                                                         null,
                                                         DateTime.Now.AddSeconds(cacheForSeconds),
                                                         Cache.NoSlidingExpiration,
                                                         CacheItemPriority.High,
                                                         null);
            }

            processedDataset = processSearch(processedDataset);
            processedDataset = processSort(processedDataset);

            GridDataResult res = new GridDataResult();

            if (length > 0)
            {
                res.data = processedDataset.Select(x => x.processed).Skip(start).Take(length).ToList();
            }
            else
            {
                res.data = processedDataset.Select(x => x.processed).ToList();
            }
            res.draw            = draw;
            res.recordsTotal    = dataset.Count;
            res.recordsFiltered = processedDataset.Count;
            return(res);
        }
        public GridDataResult GetResultFromCache()
        {
            if (cachedProcessedDataset == null)
            {
                throw new Exception("No cached dataset has been loaded via \"HasCache(cacheKey)\"");
            }
            GridDataResult res = new GridDataResult();

            res.recordsTotal = cachedProcessedDataset.Count;
            List <gridProcessedObject <T> > processedDataset = cachedProcessedDataset;

            processedDataset = processSearch(processedDataset);
            processedDataset = processSort(processedDataset);

            res.data = processedDataset.Select(x => x.processed).Skip(start).Take(length).ToList();

            res.draw            = draw;
            res.recordsFiltered = processedDataset.Count;
            res.fromcache       = true;
            return(res);
        }