Skip to content

Instantly share code, notes, and snippets.

@codeimpossible
Created July 30, 2012 14:21
Show Gist options
  • Save codeimpossible/3207268 to your computer and use it in GitHub Desktop.
Save codeimpossible/3207268 to your computer and use it in GitHub Desktop.
cache locking
lock( HttpRuntime.Cache )
{
var languages = (Dictionary<string, string>)HttpRuntime.Cache.Get(languagesKey);
if (languages == null)
{
languages = new Dictionary<string, string>();
HttpRuntime.Cache.Add(languagesKey, languages, null, DateTime.Now.AddMinutes(15), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment