Skip to content

Commit

Permalink
Version bump + some comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwaliszko committed Aug 20, 2016
1 parent 8c3cd58 commit 53845b0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Binary file modified doc/api/api.chm
Binary file not shown.
6 changes: 4 additions & 2 deletions src/ExpressiveAnnotations.MvcUnobtrusive/Caching/MapCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace ExpressiveAnnotations.MvcUnobtrusive.Caching
/// </summary>
internal static class MapCache<TKey, TValue> // http://stackoverflow.com/q/3037203/270315
{
private static readonly ConcurrentDictionary<TKey, Lazy<TValue>> _cache = new ConcurrentDictionary<TKey, Lazy<TValue>>(); // why lazy? -> http://stackoverflow.com/q/12611167/270315, https://blogs.endjin.com/2015/10/using-lazy-and-concurrentdictionary-to-ensure-a-thread-safe-run-once-lazy-loaded-collection/
private static readonly ConcurrentDictionary<TKey, Lazy<TValue>> _cache = new ConcurrentDictionary<TKey, Lazy<TValue>>(); // why lazy? -> http://stackoverflow.com/q/12611167/270315

public static TValue GetOrAdd(TKey key, Func<TKey, TValue> valueFactory) // delegate value factory invocation guaranteed to be atomic
{
Expand All @@ -23,7 +23,9 @@ public static TValue GetOrAdd(TKey key, Func<TKey, TValue> valueFactory) // dele
k => new Lazy<TValue>(
() => valueFactory(k),
LazyThreadSafetyMode.ExecutionAndPublication));
return lazyResult.Value;
return lazyResult.Value; /* From http://bit.ly/2b8E1AS: If multiple concurrent threads try to call GetOrAdd with the same key at once, multiple Lazy objects may be
* created but these are cheap, and all but one will be thrown away. The return Lazy object will be the same across all threads, and the
* first one to call the Value property will run the expensive delegate method, whilst the other threads are locked, waiting for the result. */
}

public static void Clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.0.0")]
[assembly: AssemblyFileVersion("2.5.0.0")]
[assembly: AssemblyVersion("2.5.1.0")]
[assembly: AssemblyFileVersion("2.5.1.0")]

0 comments on commit 53845b0

Please sign in to comment.