private static void SetInCache( int groupId, GroupDef groupDef ) { if ( !Properties.Settings.Default.GroupDefCacheEnabled ) { return; } RwLock.EnterWriteLock( ); try { Cache[groupId] = groupDef; } finally { RwLock.ExitWriteLock( ); } }
internal static bool TryGetFromCache( int groupId, out GroupDef groupDef ) { if ( !Properties.Settings.Default.GroupDefCacheEnabled ) { groupDef = default( GroupDef ); return false; } RwLock.EnterReadLock( ); try { return Cache.TryGetValue( groupId, out groupDef ); } finally { RwLock.ExitReadLock( ); } }