internal T Get <T>(ICacheConsumer consumer, string attribute, Func <T> invokeQuery) { T t; if (this.TryLookupCache <T>(consumer, attribute, out t)) { return(t); } T result; lock (this.GetConcurrencyLock(attribute)) { if (this.TryLookupCache <T>(consumer, attribute, out t)) { result = t; } else { t = StorageGlobals.ProtectedADCall <T>(invokeQuery); this.cacheLock.EnterWriteLock(); try { OrganizationCache.MiniPropertyBag miniPropertyBag; if (!this.cache.TryGetValue(consumer.Id, out miniPropertyBag)) { miniPropertyBag = new OrganizationCache.MiniPropertyBag(); this.cache[consumer.Id] = miniPropertyBag; } miniPropertyBag[attribute] = t; result = t; } finally { this.cacheLock.ExitWriteLock(); } } } return(result); }