Codota Logo
CacheLongKeyLIRS.getHash
Code IndexAdd Codota to your IDE (free)

How to use
getHash
method
in
org.h2.mvstore.cache.CacheLongKeyLIRS

Best Java code snippets using org.h2.mvstore.cache.CacheLongKeyLIRS.getHash (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: com.h2database/h2

private void addToMap(Entry<V> e) {
  int index = getHash(e.key) & mask;
  e.mapNext = entries[index];
  entries[index] = e;
  usedMemory += e.memory;
  mapSize++;
}
origin: com.h2database/h2

/**
 * Check whether there is a resident entry for the given key. This
 * method does not adjust the internal state of the cache.
 *
 * @param key the key (may not be null)
 * @return true if there is a resident entry
 */
public boolean containsKey(long key) {
  int hash = getHash(key);
  return getSegment(hash).containsKey(key, hash);
}
origin: com.h2database/h2

/**
 * Get the value for the given key if the entry is cached. This method
 * adjusts the internal state of the cache sometimes, to ensure commonly
 * used entries stay in the cache.
 *
 * @param key the key (may not be null)
 * @return the value, or null if there is no resident entry
 */
public V get(long key) {
  int hash = getHash(key);
  return getSegment(hash).get(key, hash);
}
origin: com.h2database/h2

/**
 * Get the memory used for the given key.
 *
 * @param key the key (may not be null)
 * @return the memory, or 0 if there is no resident entry
 */
public int getMemory(long key) {
  int hash = getHash(key);
  return getSegment(hash).getMemory(key, hash);
}
origin: com.h2database/h2

private Entry<V> find(long key) {
  int hash = getHash(key);
  return getSegment(hash).find(key, hash);
}
origin: com.h2database/h2

/**
 * Add an entry to the cache. The entry may or may not exist in the
 * cache yet. This method will usually mark unknown entries as cold and
 * known entries as hot.
 *
 * @param key the key (may not be null)
 * @param value the value (may not be null)
 * @param memory the memory used for the given entry
 * @return the old value, or null if there was no resident entry
 */
public V put(long key, V value, int memory) {
  int hash = getHash(key);
  int segmentIndex = getSegmentIndex(hash);
  Segment<V> s = segments[segmentIndex];
  // check whether resize is required: synchronize on s, to avoid
  // concurrent resizes (concurrent reads read
  // from the old segment)
  synchronized (s) {
    s = resizeIfNeeded(s, segmentIndex);
    return s.put(key, hash, value, memory);
  }
}
origin: com.h2database/h2

/**
 * Remove an entry. Both resident and non-resident entries can be
 * removed.
 *
 * @param key the key (may not be null)
 * @return the old value, or null if there was no resident entry
 */
public V remove(long key) {
  int hash = getHash(key);
  int segmentIndex = getSegmentIndex(hash);
  Segment<V> s = segments[segmentIndex];
  // check whether resize is required: synchronize on s, to avoid
  // concurrent resizes (concurrent reads read
  // from the old segment)
  synchronized (s) {
    s = resizeIfNeeded(s, segmentIndex);
    return s.remove(key, hash);
  }
}
origin: com.h2database/h2

private void evictBlock() {
  // ensure there are not too many hot entries: right shift of 5 is
  // division by 32, that means if there are only 1/32 (3.125%) or
  // less cold entries, a hot entry needs to become cold
  while (queueSize <= (mapSize >>> 5) && stackSize > 0) {
    convertOldestHotToCold();
  }
  // the oldest resident cold entries become non-resident
  while (usedMemory > maxMemory && queueSize > 0) {
    Entry<V> e = queue.queuePrev;
    usedMemory -= e.memory;
    removeFromQueue(e);
    e.value = null;
    e.memory = 0;
    addToQueue(queue2, e);
    // the size of the non-resident-cold entries needs to be limited
    int maxQueue2Size = nonResidentQueueSize * (mapSize - queue2Size);
    if (maxQueue2Size >= 0) {
      while (queue2Size > maxQueue2Size) {
        e = queue2.queuePrev;
        int hash = getHash(e.key);
        remove(e.key, hash);
      }
    }
  }
}
origin: com.h2database/h2

Entry<V> e = find(s.key, getHash(s.key));
if (e == null) {
  e = copy(s);
Entry<V> e = find(s.key, getHash(s.key));
if (e == null) {
  e = copy(s);
origin: com.eventsourcing/h2

private void addToMap(Entry<V> e) {
  int index = getHash(e.key) & mask;
  e.mapNext = entries[index];
  entries[index] = e;
  usedMemory += e.memory;
  mapSize++;
}
origin: com.h2database/h2-mvstore

private void addToMap(Entry<V> e) {
  int index = getHash(e.key) & mask;
  e.mapNext = entries[index];
  entries[index] = e;
  usedMemory += e.memory;
  mapSize++;
}
origin: com.h2database/h2-mvstore

private Entry<V> find(long key) {
  int hash = getHash(key);
  return getSegment(hash).find(key, hash);
}
origin: com.eventsourcing/h2

private Entry<V> find(long key) {
  int hash = getHash(key);
  return getSegment(hash).find(key, hash);
}
origin: org.wowtools/h2

/**
 * Get the memory used for the given key.
 *
 * @param key the key (may not be null)
 * @return the memory, or 0 if there is no resident entry
 */
public int getMemory(long key) {
  int hash = getHash(key);
  return getSegment(hash).getMemory(key, hash);
}
origin: com.eventsourcing/h2

/**
 * Get the value for the given key if the entry is cached. This method
 * adjusts the internal state of the cache sometimes, to ensure commonly
 * used entries stay in the cache.
 *
 * @param key the key (may not be null)
 * @return the value, or null if there is no resident entry
 */
public V get(long key) {
  int hash = getHash(key);
  return getSegment(hash).get(key, hash);
}
origin: com.eventsourcing/h2

/**
 * Check whether there is a resident entry for the given key. This
 * method does not adjust the internal state of the cache.
 *
 * @param key the key (may not be null)
 * @return true if there is a resident entry
 */
public boolean containsKey(long key) {
  int hash = getHash(key);
  return getSegment(hash).containsKey(key, hash);
}
origin: com.h2database/h2-mvstore

/**
 * Get the value for the given key if the entry is cached. This method
 * adjusts the internal state of the cache sometimes, to ensure commonly
 * used entries stay in the cache.
 *
 * @param key the key (may not be null)
 * @return the value, or null if there is no resident entry
 */
public V get(long key) {
  int hash = getHash(key);
  return getSegment(hash).get(key, hash);
}
origin: org.wowtools/h2

/**
 * Check whether there is a resident entry for the given key. This
 * method does not adjust the internal state of the cache.
 *
 * @param key the key (may not be null)
 * @return true if there is a resident entry
 */
public boolean containsKey(long key) {
  int hash = getHash(key);
  return getSegment(hash).containsKey(key, hash);
}
origin: org.wowtools/h2

/**
 * Get the value for the given key if the entry is cached. This method
 * adjusts the internal state of the cache sometimes, to ensure commonly
 * used entries stay in the cache.
 *
 * @param key the key (may not be null)
 * @return the value, or null if there is no resident entry
 */
public V get(long key) {
  int hash = getHash(key);
  return getSegment(hash).get(key, hash);
}
origin: com.h2database/h2-mvstore

/**
 * Check whether there is a resident entry for the given key. This
 * method does not adjust the internal state of the cache.
 *
 * @param key the key (may not be null)
 * @return true if there is a resident entry
 */
public boolean containsKey(long key) {
  int hash = getHash(key);
  return getSegment(hash).containsKey(key, hash);
}
org.h2.mvstore.cacheCacheLongKeyLIRSgetHash

Javadoc

Get the hash code for the given key. The hash code is further enhanced to spread the values more evenly.

Popular methods of CacheLongKeyLIRS

  • <init>
    Create a new cache with the given memory size.
  • clear
    Remove all entries.
  • get
    Get the value for the given key if the entry is cached. This method adjusts the internal state of th
  • getMaxMemory
    Get the maximum memory to use.
  • getUsedMemory
    Get the currently used memory.
  • put
    Add an entry to the cache. The entry may or may not exist in the cache yet. This method will usually
  • remove
    Remove an entry. Both resident and non-resident entries can be removed.
  • find
  • getMap
    Convert this cache to a map.
  • getSegment
  • getSegmentIndex
  • keySet
    Get the set of keys for resident entries.
  • getSegmentIndex,
  • keySet,
  • resizeIfNeeded,
  • setMaxMemory,
  • size,
  • sizeOf,
  • getMaxItemSize

Popular in Java

  • Making http post requests using okhttp
  • getExternalFilesDir (Context)
  • addToBackStack (FragmentTransaction)
  • putExtra (Intent)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • IOException (java.io)
    Signals that an I/O exception of some sort has occurred. This class is the general class of exceptio
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now