Horje
What is the best way to lock cache in asp.net? Code Example
What is the best way to lock cache in asp.net?
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

}




Csharp

Related
panning script c# on phone Code Example panning script c# on phone Code Example
c# .net core kendo dropdownlistfor enum Code Example c# .net core kendo dropdownlistfor enum Code Example
unity check if gameobject is inside collider Code Example unity check if gameobject is inside collider Code Example
struct Code Example struct Code Example
mongodb custom IIdGenerator Code Example mongodb custom IIdGenerator Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11