Пример #1
0
        public void DoSomething()
        {
            MyCustomCache.SetCache(_keyName, _testValue);
            var myKey = MyCustomCache.GetCache(_keyName);

            Assert.AreEqual(myKey, _testValue)
        }
Пример #2
0
 static CacheManager()
 {
     /* the size can be defined as needed as long as it's
      * // properly parsed out by StringUtil.ParseSizeString()
      * // You should be able to see this "MyCustomCache" here:
      * // http://{yoursitecoreinstall}/sitecore/admin/cache.aspx
      */
     Cache = new MyCustomCache("MyCustomCache",
                               StringUtil.ParseSizeString("10KB"));
 }
Пример #3
0
        public HomeController(ILogger <HomeController> logger, IMemoryCache cache, MyCustomCache myCustomCache, IDistributedCache distributed)
        {
            _logger       = logger;
            _iMemoryCache = cache;
            //自定义的缓存
            _myCustomCache = myCustomCache;

            //分布式
            _distributed = distributed;
            //分布式redis和分布式sqlserver都是分布式的,所以可以使用同一个IDistributedCache对象
            //redis缓存
            _distributedredis = distributed;
            //分布式sqlserver缓存
            _distributedsql = distributed;
        }