Exemple #1
0
        public TData <string> GetDetail([FromQuery] CacheListParam param)
        {
            var obj = new TData <string>();

            obj.Tag = 1;

            if (param == null || param.Key.IsEmpty())
            {
                return(obj);
            }

            obj.Data = _cache.Get <object>(param.Key).ToJson();
            return(obj);
        }
Exemple #2
0
        public TData <IEnumerable <object> > GetPageListJson([FromQuery] CacheListParam param,
                                                             [FromQuery] Pagination pagination)
        {
            var obj  = new TData <IEnumerable <object> >();
            var list = _cache.GetAllKey();

            if (param != null)
            {
                if (!param.Key.IsEmpty())
                {
                    list = list.Where(a => a.Contains(param.Key)).ToList();
                }
            }

            obj.Total = list.Count();
            obj.Tag   = 1;
            obj.Data  = list.Skip(pagination.PageSize * (pagination.PageIndex - 1)).Take(pagination.PageSize)
                        .Select(a => new { Key = a });

            return(obj);
        }