📜  在 asp.net 中锁定缓存 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:13.199000             🧑  作者: Mango

代码示例1
private static object ThisLock = new object();

public string GetFoo()
{

  // try to pull from cache here

  lock (ThisLock)
  {
    // cache was empty before we got the lock, check again inside the lock

    // cache is still empty, so retreive the value here

    // store the value in the cache here
  }

  // return the cached value here

}