zoukankan      html  css  js  c++  java
  • netcore webCache缓存

    NetCoreCacheService.dll

     public IActionResult Index()
            {
                //存入字符串
                MemoryCacheService.SetChacheValue("sname", "刘琪琪");
                //获取字符串缓存
                ViewBag.sbname = MemoryCacheService.GetCacheValue("sname");
                //存入泛型列表
                List<TsetModel> list = new List<TsetModel>();
                for (int i = 0; i < 100; i++)
                {
                    TsetModel model = new TsetModel();
                    model.Id = i;
                    model.Name = "刘奇" + i;
                    list.Add(model);
                }
                MemoryCacheService.SetChacheValue("ulist", list);
                //获取list缓存
                var newList = MemoryCacheService.GetList<TsetModel>("ulist");
                return View(newList);
            }
    
            public IActionResult About()
            {
                TsetModel m = new TsetModel();
                m.Id = 100;
                m.Name = "刘奇";
                //存入model
                MemoryCacheService.SetChacheValue("um", m);
                //获取model
                return View(MemoryCacheService.Get<TsetModel>("um"));
            }
     public class TsetModel
        {
            public int Id { get; set; }
            public string Name { get; set; }
        }
  • 相关阅读:
    作业3
    字符串的应用
    java类与对象
    作业
    水仙花数
    java例
    读书笔记(构建之法-11.19)
    补psp进度(11月4号-9号)
    PSP进度(11~16)
    团队项目-约跑软件需求规格说明书
  • 原文地址:https://www.cnblogs.com/macT/p/11671753.html
Copyright © 2011-2022 走看看