C#关键字as出现的错误

时间:2021-12-17 00:09:37
       ObjectCache cache = MemoryCache.Default;

            //
string cacheData1 = cache["key1"] as string;//得不到数据
//2
//string cacheData1 = Convert.ToString(cache["key1"]);//这个ok CacheItemPolicy policy1 = new CacheItemPolicy();
policy1.AbsoluteExpiration = new DateTimeOffset(DateTime.Now.AddMinutes());
cache.Set("key1", , policy1); Response.Write($"<h1>{cacheData1}</h1>");
Response.End();