Exemplo n.º 1
0
        private static void SetInCache( int groupId, GroupDef groupDef )
        {
            if ( !Properties.Settings.Default.GroupDefCacheEnabled )
              {
            return;
              }

              RwLock.EnterWriteLock( );
              try
              {
            Cache[groupId] = groupDef;
              }
              finally
              {
            RwLock.ExitWriteLock( );
              }
        }
Exemplo n.º 2
0
        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( );
              }
        }