缓存雪崩
缓存雪崩是由于原有缓存失效(过期),新缓存未到期间。所有请求都去查询数据库,而对数据库CPU和内存造成巨大压力,严重的会造成数据库宕机。从而形成一系列连锁反应,造成整个系统崩溃。
1. 碰到这种情况,一般并发量不是特别多的时候,使用最多的解决方案是加锁排队。
public object GetProductListNew()
{ const int cacheTime = 30; const string cacheKey = "product_list"; const string lockKey = cacheKey;
var cacheValue = CacheHelper.Get(cacheKey); if (cacheValue != null)
{

