congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
CacheLongKeyLIRS.setMaxMemory
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: com.h2database/h2

/**
 * Set the read cache size in MB.
 *
 * @param mb the cache size in MB.
 */
public void setCacheSize(int mb) {
  final long bytes = (long) mb * 1024 * 1024;
  if (cache != null) {
    cache.setMaxMemory(bytes);
    cache.clear();
  }
  if (cacheChunkRef != null) {
    cacheChunkRef.setMaxMemory(bytes / 4);
    cacheChunkRef.clear();
  }
}
origin: com.h2database/h2

/**
 * Create a new cache with the given memory size.
 *
 * @param config the configuration
 */
@SuppressWarnings("unchecked")
public CacheLongKeyLIRS(Config config) {
  setMaxMemory(config.maxMemory);
  this.nonResidentQueueSize = config.nonResidentQueueSize;
  DataUtils.checkArgument(
      Integer.bitCount(config.segmentCount) == 1,
      "The segment count must be a power of 2, is {0}", config.segmentCount);
  this.segmentCount = config.segmentCount;
  this.segmentMask = segmentCount - 1;
  this.stackMoveDistance = config.stackMoveDistance;
  segments = new Segment[segmentCount];
  clear();
  // use the high bits for the segment
  this.segmentShift = 32 - Integer.bitCount(segmentMask);
}
origin: org.wowtools/h2

/**
 * Set the read cache size in MB.
 *
 * @param mb the cache size in MB.
 */
public void setCacheSize(int mb) {
  if (cache != null) {
    cache.setMaxMemory((long) mb * 1024 * 1024);
    cache.clear();
  }
}
origin: com.eventsourcing/h2

/**
 * Set the read cache size in MB.
 *
 * @param mb the cache size in MB.
 */
public void setCacheSize(int mb) {
  if (cache != null) {
    cache.setMaxMemory((long) mb * 1024 * 1024);
    cache.clear();
  }
}
origin: com.h2database/h2-mvstore

/**
 * Set the read cache size in MB.
 *
 * @param mb the cache size in MB.
 */
public void setCacheSize(int mb) {
  final long bytes = (long) mb * 1024 * 1024;
  if (cache != null) {
    cache.setMaxMemory(bytes);
    cache.clear();
  }
  if (cacheChunkRef != null) {
    cacheChunkRef.setMaxMemory(bytes / 4);
    cacheChunkRef.clear();
  }
}
origin: com.eventsourcing/h2

/**
 * Create a new cache with the given memory size.
 *
 * @param config the configuration
 */
@SuppressWarnings("unchecked")
public CacheLongKeyLIRS(Config config) {
  setMaxMemory(config.maxMemory);
  this.nonResidentQueueSize = config.nonResidentQueueSize;
  DataUtils.checkArgument(
      Integer.bitCount(config.segmentCount) == 1,
      "The segment count must be a power of 2, is {0}", config.segmentCount);
  this.segmentCount = config.segmentCount;
  this.segmentMask = segmentCount - 1;
  this.stackMoveDistance = config.stackMoveDistance;
  segments = new Segment[segmentCount];
  clear();
  // use the high bits for the segment
  this.segmentShift = 32 - Integer.bitCount(segmentMask);
}
origin: com.h2database/h2-mvstore

/**
 * Create a new cache with the given memory size.
 *
 * @param config the configuration
 */
@SuppressWarnings("unchecked")
public CacheLongKeyLIRS(Config config) {
  setMaxMemory(config.maxMemory);
  this.nonResidentQueueSize = config.nonResidentQueueSize;
  DataUtils.checkArgument(
      Integer.bitCount(config.segmentCount) == 1,
      "The segment count must be a power of 2, is {0}", config.segmentCount);
  this.segmentCount = config.segmentCount;
  this.segmentMask = segmentCount - 1;
  this.stackMoveDistance = config.stackMoveDistance;
  segments = new Segment[segmentCount];
  clear();
  // use the high bits for the segment
  this.segmentShift = 32 - Integer.bitCount(segmentMask);
}
origin: org.wowtools/h2

/**
 * Create a new cache with the given memory size.
 *
 * @param config the configuration
 */
@SuppressWarnings("unchecked")
public CacheLongKeyLIRS(Config config) {
  setMaxMemory(config.maxMemory);
  this.nonResidentQueueSize = config.nonResidentQueueSize;
  DataUtils.checkArgument(
      Integer.bitCount(config.segmentCount) == 1,
      "The segment count must be a power of 2, is {0}", config.segmentCount);
  this.segmentCount = config.segmentCount;
  this.segmentMask = segmentCount - 1;
  this.stackMoveDistance = config.stackMoveDistance;
  segments = new Segment[segmentCount];
  clear();
  // use the high bits for the segment
  this.segmentShift = 32 - Integer.bitCount(segmentMask);
}
org.h2.mvstore.cacheCacheLongKeyLIRSsetMaxMemory

Javadoc

Set the maximum memory this cache should use. This will not immediately cause entries to get removed however; it will only change the limit. To resize the internal array, call the clear method.

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
  • getHash
    Get the hash code for the given key. The hash code is further enhanced to spread the values more eve
  • getMap
    Convert this cache to a map.
  • getSegment
  • getSegmentIndex
  • getSegment,
  • getSegmentIndex,
  • keySet,
  • resizeIfNeeded,
  • size,
  • sizeOf,
  • getMaxItemSize

Popular in Java

  • Creating JSON documents from java classes using gson
  • findViewById (Activity)
  • addToBackStack (FragmentTransaction)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now