Set the cache size used to reduce the number of database
        access operations.
766864
def cache_size(self, new_value):
        '''
        
        '''
        if type(new_value) == int and 0 < new_value:
            if self._lemma_cache is not None:
                self._lemma_cache  = repoze.lru.LRUCache(new_value)
                self._synset_cache = repoze.lru.LRUCache(new_value)
114719
public void resize(int maxSize) {
		this.maxSize = maxSize;
		if (cache.size() > maxSize) {
			int count = 0;
			Iterator<Long> rowIds = cache.keySet().iterator();
			while (rowIds.hasNext()) {
				rowIds.next();
				if (++count > maxSize) {
					rowIds.remove();
				}
			}
		}
	}
1056813
private void ensureCapacity() {
    if (size < resourceIds.length) {
      return;
    }
    int newCapacity = (resourceIds.length * 3) / 2 + 1;
    // Increase size of resourceIds
    String[] oldResourceIds = resourceIds;
    resourceIds = new String[newCapacity];
    System.arraycopy(oldResourceIds, 0, resourceIds, 0, oldResourceIds.length);
    // Increase size of blockData
    int[] oldBlockData = blockData;
    blockData = new int[newCapacity * blockInts];
    System.arraycopy(oldBlockData, 0, blockData, 0, oldBlockData.length);
    // Increase size of byResourceIndices (no need to copy old, because would be restored in method ensureSorted)
    resourceIdsIndex = new int[newCapacity];
    sorted = false;
  }
432255
public long cacheSize() {
    if (use_lru) {
      return (int) (lru_name_cache.size() + lru_id_cache.size());
    }
    return name_cache.size() + id_cache.size();
  }
1052449
private final void forceResizeCleanCache(final int lgResizeFactor) {
    assert (!dirty_); // Should never be dirty before a resize.
    lgArrLongs_ += lgResizeFactor; // new tgt size
    final long[] tgtArr = new long[1 << lgArrLongs_];
    final int newCount = HashOperations.hashArrayInsert(cache_, tgtArr, lgArrLongs_, thetaLong_);
    assert (curCount_ == newCount);
    curCount_ = newCount;
    cache_ = tgtArr;
    hashTableThreshold_ = setHashTableThreshold(lgNomLongs_, lgArrLongs_);
  }
504644
public void setWrapperCacheSize(int cacheSize)
    {
        wrapperCache.setCachePreferredMaxSize(cacheSize);
        int updatedCacheSize = getBeanIdCacheSize(cacheSize);
        beanIdCache.setSize(updatedCacheSize);
    }
1176358
def set_cache_buster(self, path, hash):
        """"""
        oz.aws_cdn.set_cache_buster(self.redis(), path, hash)
768173
def set_disk_cache(self, results, key=None):
        """"""
        if not getattr(self, 'disk_cache_location', False):
            self.init_disk_cache()
        disk_cache = shelve.open(self.disk_cache_location)
        key = self.model.hash if key is None else key
        disk_cache[key] = results
        disk_cache.close()
508839
def add_cache(self, namespace, key, query_hash, length, cache):
        """"""
        start = 0
        bulk_insert = self.bulk_insert
        cache_len = len(cache)
        row = '(%s,%s,%s,%s,%s,%s)'
        query = 'INSERT INTO gauged_cache ' \
            '(namespace, key, "hash", length, start, value) VALUES '
        execute = self.cursor.execute
        query_hash = self.psycopg2.Binary(query_hash)
        while start < cache_len:
            rows = cache[start:start+bulk_insert]
            params = []
            for timestamp, value in rows:
                params.extend((namespace, key, query_hash, length,
                               timestamp, value))
            insert = (row + ',') * (len(rows) - 1) + row
            execute(query + insert, params)
            start += bulk_insert
        self.db.commit()
574146
def set_store_to(self, store_to):
        """"""
        assert store_to is None or isinstance(store_to, Cache), \
            "store_to needs to be None or a Cache object."
        assert store_to is None or store_to.cl_size <= self.cl_size, \
            "cl_size may only increase towards main memory."
        self.store_to = store_to
        self.backend.store_to = store_to.backend
1035717
public void setMaxSize(long maxSize) {
		// if the new maxSize is <= 0, clear keyLRUList
		if (maxSize <= 0) {
			keyLRUList.clear();
		} else if (maxSize > 0 && this.maxSize <= 0) {
			// if the new maxSize > 0 and the old is <= 0, fill in LRU list -
			// order will be meaningless for now
			Iterator keys = cacheLineTable.keySet().iterator();

			while (keys.hasNext()) {
				keyLRUList.add(keys.next());
			}
		}

		// if the new maxSize is less than the current cache size, shrink the
		// cache.
		if (maxSize > 0 && cacheLineTable.size() > maxSize) {
			while (cacheLineTable.size() > maxSize) {
				Object lastKey = keyLRUList.getLast();

				removeObject(lastKey);
			}
		}

		this.maxSize = maxSize;
	}
392811
def cache(self, con):
        """"""
        self._lock.acquire()
        try:
            if not self._maxcached or len(self._idle_cache) < self._maxcached:
                con._reset(force=self._reset)  # rollback possible transaction
                # the idle cache is not full, so put it there
                self._idle_cache.append(con)  # append it to the idle cache
            else:  # if the idle cache is already full,
                con.close()  # then close the connection
            self._connections -= 1
            self._lock.notify()
        finally:
            self._lock.release()
506818
private void resize(final int ns) {
    final int size = BDDPrime.primeGTE(ns);
    this.table = new BDDCacheEntry[size];
    for (int n = 0; n < size; n++)
      this.table[n] = new BDDCacheEntry();
  }
981743
protected function decreaseCapacity()
    {
        $this->capacity = max(self::MIN_CAPACITY, $this->capacity  * $this->getDecayFactor());
    }
499550
@VisibleForTesting
  static int chooseTableSize(int setSize) {
    if (setSize == 1) {
      return 2;
    }
    // Correct the size for open addressing to match desired load factor.
    // Round up to the next highest power of 2.
    int tableSize = Integer.highestOneBit(setSize - 1) << 1;
    while (tableSize * DESIRED_LOAD_FACTOR < setSize) {
      tableSize <<= 1;
    }
    return tableSize;
  }
691757
private void dropCaches(final TSDB tsdb, final Channel chan) {
        LOG.warn(chan + " Dropping all in-memory caches.");
        tsdb.dropCaches();
    }
342955
def disable_caching(self):
        ""
        self.caching_enabled = False
        for c in self.values():
            c.disable_cacher()