Package org.rocksdb
Class LRUCache
- All Implemented Interfaces:
AutoCloseable
Least Recently Used Cache
-
Field Summary
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_ -
Constructor Summary
ConstructorsConstructorDescriptionLRUCache(long capacity) Create a new cache with a fixed size capacityLRUCache(long capacity, int numShardBits) Create a new cache with a fixed size capacity.LRUCache(long capacity, int numShardBits, boolean strictCapacityLimit) Create a new cache with a fixed size capacity.LRUCache(long capacity, int numShardBits, boolean strictCapacityLimit, double highPriPoolRatio) Create a new cache with a fixed size capacity.LRUCache(long capacity, int numShardBits, boolean strictCapacityLimit, double highPriPoolRatio, double lowPriPoolRatio) Create a new cache with a fixed size capacity. -
Method Summary
Methods inherited from class org.rocksdb.Cache
getPinnedUsage, getUsageMethods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandleMethods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Constructor Details
-
LRUCache
public LRUCache(long capacity) Create a new cache with a fixed size capacity- Parameters:
capacity- The fixed size capacity of the cache
-
LRUCache
public LRUCache(long capacity, int numShardBits) Create a new cache with a fixed size capacity. The cache is sharded to 2^numShardBits shards, by hash of the key. The total capacity is divided and evenly assigned to each shard. numShardBits = -1 means it is automatically determined: every shard will be at least 512KB and number of shard bits will not exceed 6.- Parameters:
capacity- The fixed size capacity of the cachenumShardBits- The cache is sharded to 2^numShardBits shards, by hash of the key
-
LRUCache
public LRUCache(long capacity, int numShardBits, boolean strictCapacityLimit) Create a new cache with a fixed size capacity. The cache is sharded to 2^numShardBits shards, by hash of the key. The total capacity is divided and evenly assigned to each shard. If strictCapacityLimit is set, insert to the cache will fail when cache is full. numShardBits = -1 means it is automatically determined: every shard will be at least 512KB and number of shard bits will not exceed 6.- Parameters:
capacity- The fixed size capacity of the cachenumShardBits- The cache is sharded to 2^numShardBits shards, by hash of the keystrictCapacityLimit- insert to the cache will fail when cache is full
-
LRUCache
public LRUCache(long capacity, int numShardBits, boolean strictCapacityLimit, double highPriPoolRatio) Create a new cache with a fixed size capacity. The cache is sharded to 2^numShardBits shards, by hash of the key. The total capacity is divided and evenly assigned to each shard. If strictCapacityLimit is set, insert to the cache will fail when cache is full. User can also set percentage of the cache reserves for high priority entries via highPriPoolRatio. numShardBits = -1 means it is automatically determined: every shard will be at least 512KB and number of shard bits will not exceed 6.- Parameters:
capacity- The fixed size capacity of the cachenumShardBits- The cache is sharded to 2^numShardBits shards, by hash of the keystrictCapacityLimit- insert to the cache will fail when cache is fullhighPriPoolRatio- percentage of the cache reserves for high priority entries
-
LRUCache
public LRUCache(long capacity, int numShardBits, boolean strictCapacityLimit, double highPriPoolRatio, double lowPriPoolRatio) Create a new cache with a fixed size capacity. The cache is sharded to 2^numShardBits shards, by hash of the key. The total capacity is divided and evenly assigned to each shard. If strictCapacityLimit is set, insert to the cache will fail when cache is full. User can also set percentage of the cache reserves for high priority entries and low priority entries via highPriPoolRatio and lowPriPoolRatio. numShardBits = -1 means it is automatically determined: every shard will be at least 512KB and number of shard bits will not exceed 6.- Parameters:
capacity- The fixed size capacity of the cachenumShardBits- The cache is sharded to 2^numShardBits shards, by hash of the keystrictCapacityLimit- insert to the cache will fail when cache is fullhighPriPoolRatio- percentage of the cache reserves for high priority entrieslowPriPoolRatio- percentage of the cache reserves for low priority entries
-
-
Method Details
-
disposeInternal
protected final void disposeInternal(long handle) - Specified by:
disposeInternalin classRocksObject
-