Ejemplo n.º 1
0
        /// <summary>
        /// 取得快取
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGetCache_Click(object sender, EventArgs e)
        {
            CacheModel.GetCache query = new CacheModel.GetCache()
            {
                CacheName = txtGetCacheName.Text,
            };

            CacheModel.GetCacheResult result = cache.GetCache(query);
            txtResult.Text = JsonConvert.SerializeObject(result);
        }
Ejemplo n.º 2
0
        public CacheModel.GetCacheResult GetCache(CacheModel.GetCache query)
        {
            CacheItem item = cache.GetCacheItem(query.CacheName);

            CacheModel.GetCacheResult result = null;
            if (item != null)
            {
                result = new CacheModel.GetCacheResult()
                {
                    CacheName  = item.Key,
                    CacheValue = item.Value.ToString(),
                };
            }

            return(result);
        }