Beispiel #1
0
        /// <summary>
        /// Creates a set associative cache with specified number of rows and columns.
        /// </summary>
        /// <param name="rows">The number of rows.</param>
        /// <param name="columns">The number of columns per row.</param>
        /// <param name="concurrency">The number of locks to use for synchronization.</param>
        public ConcurrentCacheTable(int rows, int columns, int concurrency)
        {
            this.table  = new CacheTableInternal <TKey, TValue>(rows, columns);
            this.counts = new int[rows];

            this.lockObjects = new object[concurrency];
            for (int i = 0; i < concurrency; i++)
            {
                this.lockObjects[i] = new object();
            }

            this.rngs = new XorShiftRandom[concurrency];
            for (int i = 0; i < concurrency; i++)
            {
                this.rngs[i] = new XorShiftRandom();
            }
        }
Beispiel #2
0
 /// <summary>
 /// Creates a set associative cache with specified number of rows and columns.
 /// </summary>
 /// <param name="rows">The number of rows.</param>
 /// <param name="columns">The number of columns per row.</param>
 public CacheTable(int rows, int columns)
 {
     this.table = new CacheTableInternal <TKey, TValue>(rows, columns);
 }