Skip to content

Commit 96219aa

Browse files
authored
Sample code fixes
1 parent 227ec46 commit 96219aa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ NOTE: The significant difference between this and the above more robus caching f
194194
provide for any reclaming of resources by garbage collection, etc. unless manually implemented via `WeakReference` yourself.
195195

196196
NOTE: It supports basic removal, but the `LazyStaticInMemoryCache<>` provides a pattern (of Lazy + ConcurrentDictionary) that is
197-
best used for data that never chagnes once it is loaded/initialized (e.g. Reflection Results, Annotation Attribute cache, etc.).
197+
best used for data that never changes once it is loaded/initialized (e.g. Reflection Results, Annotation Attribute cache, etc.).
198198
In almost all cases for data that changes over it's life, the LazyCache<> above with support for cache expiration policy is the
199199
better pattern to use along with it's intrinsic support of garbage collection pressure to reclaim resources.
200200

@@ -207,7 +207,7 @@ public class AttributeConfigReader
207207
[AttributeUsage(AttributeTargets.Class)]
208208
private class ConfigAttribute : Attribute
209209
{
210-
. . . implement your design time configuration properties . . .
210+
//. . . implement your design time configuration properties . . .
211211
}
212212

213213
//By making the cache static it is now a global and thread-safe blocking cache; enabling only
@@ -229,11 +229,11 @@ public class AttributeConfigReader
229229
// how many or how fast multiple (e.g. hundreds/thousands) threads/reqeuests come in for that same data!
230230
//NOTE: Exception handling is critical here -- because Lazy<> will cache the Exception -- and
231231
// this class ensures that exceptions are never cached!
232-
var cacheResult = _lazyAttribConfigCache.GetOrAdd(typeof(T), (key) =>
232+
var cacheResult = _lazyAttribConfigCache.GetOrAdd(typeof(T), (typeKey) =>
233233
{
234234
//NOTE: If an Exception occurs then the result will not be cached, only value values
235235
// will be cached (e.g. a safe response of null will be cached).
236-
var configAttribute = GetConfigAttributeInternal();
236+
var configAttribute = GetConfigAttributeInternal(typeKey);
237237
return configAttribute;
238238
});
239239

0 commit comments

Comments
 (0)