@CacheLocalStore public class CacheFileLocalStore<K,V> extends Object implements CacheStore<K,IgniteBiTuple<V,?>>, LifecycleAware
CacheStore
implementation. Internally it uses compact offheap map for key hashes and
pointers to append-only update log files. When log file becomes too sparse (contains too many entries that have
already been removed) it will be compacted by a background process.
setWriteMode(CacheFileLocalStoreWriteMode)
setWriteDelay(long)
setWriteBufferSize(int)
setFsyncDelay(long)
setReadBufferSize(int)
setCompactBufferSize(int)
setMinCompactSize(long)
setMaxSparsity(float)
setSparsityCheckFrequency(long)
setRootPath(String)
setChecksum(boolean)
setMapCapacity(int)
setMapSegments(int)
... GridCacheStore<String, GridTuple2<String, ?>> store = new CacheFileLocalStore<String, String>(); ...
... <bean id="cache.local.store" class="CacheFileLocalStore"> </bean> ...
For information about Spring framework visit www.springframework.org
Modifier and Type | Field and Description |
---|---|
protected String |
cacheName |
static CacheFileLocalStoreWriteMode |
DFLT_COMMIT_MODE
Default write mode.
|
static int |
DFLT_COMPACT_BUFFER_SIZE
Default compact buffer size.
|
static int |
DFLT_FSYNC_DELAY
Default value for fsync delay in milliseconds.
|
static int |
DFLT_MAP_CAPACITY
Default map capacity.
|
static int |
DFLT_MAP_SEGMENTS
Default number of map segments.
|
static float |
DFLT_MAX_SPARSITY
Default maximum sparsity.
|
static long |
DFLT_MIN_COMPACT_SIZE
Default minimum compaction size.
|
static int |
DFLT_READ_BUFFER_SIZE
Default read buffer size.
|
static String |
DFLT_ROOT_PATH
Default root path for file storage.
|
static long |
DFLT_SPARSITY_CHECK_FREQUENCY
Default sparsity check frequency.
|
static boolean |
DFLT_USE_CONSISTENT_ID
Default use consistent ID for store path.
|
static int |
DFLT_WRITE_BUFFER_SIZE
Default write buffer size.
|
static int |
DFLT_WRITE_DELAY
Default value for write delay in microseconds.
|
protected Ignite |
ignite |
protected IgniteLogger |
log |
Constructor and Description |
---|
CacheFileLocalStore() |
Modifier and Type | Method and Description |
---|---|
void |
delete(Object key) |
void |
deleteAll(Collection<?> keys) |
int |
getCompactBufferSize()
Gets compact buffer size.
|
long |
getFsyncDelay()
Gets maximum delay in milliseconds after which fsync will be issued after a write to a file.
|
int |
getMapCapacity()
Gets initial internal hash map capacity.
|
int |
getMapSegments()
Gets number of map segments.
|
float |
getMaxSparsity()
Gets maximum allowed file sparsity above which compaction has to start.
|
long |
getMinCompactSize()
Gets minimum file size for compaction.
|
int |
getReadBufferSize()
Gets read buffer size.
|
String |
getRootPath()
Gets root directory path for storage.
|
long |
getSparsityCheckFrequency()
Gets frequency to check sparsity of files for compaction.
|
boolean |
getUseConsistentId() |
int |
getWriteBufferSize()
Gets write buffer size in bytes.
|
long |
getWriteDelay()
Gets write delay after which write buffer can be flushed to the disk.
|
CacheFileLocalStoreWriteMode |
getWriteMode()
Gets write mode.
|
boolean |
isChecksum()
Gets whether checksum calculation is enabled.
|
@Nullable IgniteBiTuple<V,?> |
load(K key) |
Map<K,IgniteBiTuple<V,?>> |
loadAll(Iterable<? extends K> keys) |
void |
loadCache(IgniteBiInClosure<K,IgniteBiTuple<V,?>> clo,
Object... args)
Loads all values from underlying persistent storage.
|
void |
sessionEnd(boolean commit)
Tells store to commit or rollback a transaction depending on the value of the
'commit'
parameter. |
void |
setChecksum(boolean checksum)
Enables or disables checksum calculation for entries on disk.
|
void |
setCompactBufferSize(int compactBufSize)
Sets compact buffer size.
|
void |
setFsyncDelay(long fsyncDelay)
Sets maximum delay in milliseconds after which fsync will be issued after a write to a file.
|
void |
setMapCapacity(int mapCap)
Sets initial internal hash map capacity.
|
void |
setMapSegments(int mapSegments)
Sets number of map segments.
|
void |
setMaxSparsity(float maxSparsity)
Sets maximum allowed file sparsity above which compaction has to start.
|
void |
setMinCompactSize(long minCompactSize)
Sets minimum file size for compaction.
|
void |
setReadBufferSize(int readBufSize)
Sets read buffer size.
|
void |
setRootPath(String rootPath)
Sets root directory path for storage.
|
void |
setSparsityCheckFrequency(long sparsityCheckFreq)
Sets frequency to check sparsity of files for compaction.
|
void |
setUseConsistentId(Boolean useConsistentId)
Sets use consistent ID flag.
|
void |
setWriteBufferSize(int writeBufSize)
Sets write buffer size in bytes.
|
void |
setWriteDelay(long writeDelay)
Sets write delay after which write buffer can be flushed to the disk.
|
void |
setWriteMode(CacheFileLocalStoreWriteMode writeMode)
Sets write mode.
|
void |
start()
Starts grid component, called on grid start.
|
void |
stop()
Stops grid component, called on grid shutdown.
|
String |
toString() |
void |
write(javax.cache.Cache.Entry<? extends K,? extends IgniteBiTuple<V,?>> entry) |
void |
writeAll(Collection<javax.cache.Cache.Entry<? extends K,? extends IgniteBiTuple<V,?>>> entries) |
public static final int DFLT_FSYNC_DELAY
public static final int DFLT_WRITE_DELAY
public static final CacheFileLocalStoreWriteMode DFLT_COMMIT_MODE
public static final int DFLT_WRITE_BUFFER_SIZE
public static final int DFLT_READ_BUFFER_SIZE
public static final long DFLT_SPARSITY_CHECK_FREQUENCY
public static final int DFLT_COMPACT_BUFFER_SIZE
public static final int DFLT_MAP_CAPACITY
public static final int DFLT_MAP_SEGMENTS
public static final float DFLT_MAX_SPARSITY
public static final long DFLT_MIN_COMPACT_SIZE
public static final boolean DFLT_USE_CONSISTENT_ID
public static final String DFLT_ROOT_PATH
IGNITE_HOME/work
folder
if IGNITE_HOME
system or environment variable specified, otherwise it is relative to
work
folder under system java.io.tmpdir
folder.@IgniteInstanceResource @GridToStringExclude protected Ignite ignite
@CacheNameResource protected String cacheName
@LoggerResource protected IgniteLogger log
public int getWriteBufferSize()
public void setWriteBufferSize(int writeBufSize)
writeBufSize
- Buffer size.public int getReadBufferSize()
public void setReadBufferSize(int readBufSize)
readBufSize
- Buffer size.public int getCompactBufferSize()
setWriteBufferSize(int)
size.public void setCompactBufferSize(int compactBufSize)
setWriteBufferSize(int)
size.compactBufSize
- Buffer size.public long getSparsityCheckFrequency()
public void setSparsityCheckFrequency(long sparsityCheckFreq)
sparsityCheckFreq
- Sparsity check frequency in milliseconds.setMaxSparsity(float)
public long getFsyncDelay()
0
then fsync will be issued immediately.public void setFsyncDelay(long fsyncDelay)
0
then fsync will be issued immediately.fsyncDelay
- Fsync delay in milliseconds.public long getWriteDelay()
CacheFileLocalStoreWriteMode.SYNC_BUFFERED
and
CacheFileLocalStoreWriteMode.ASYNC_BUFFERED
write modes.public void setWriteDelay(long writeDelay)
CacheFileLocalStoreWriteMode.SYNC_BUFFERED
and
CacheFileLocalStoreWriteMode.ASYNC_BUFFERED
write modes.writeDelay
- Write delay in microseconds.public CacheFileLocalStoreWriteMode getWriteMode()
CacheFileLocalStoreWriteMode
public void setWriteMode(CacheFileLocalStoreWriteMode writeMode)
writeMode
- Write mode.CacheFileLocalStoreWriteMode
public float getMaxSparsity()
0
and 1
.public void setMaxSparsity(float maxSparsity)
0
and 1
.maxSparsity
- Maximum sparsity.public long getMinCompactSize()
public void setMinCompactSize(long minCompactSize)
minCompactSize
- Minimum compact size.public boolean isChecksum()
public void setChecksum(boolean checksum)
checksum
- Checksum flag.public int getMapCapacity()
public void setMapCapacity(int mapCap)
mapCap
- Initial map capacity.public int getMapSegments()
public void setMapSegments(int mapSegments)
mapSegments
- Number of map segments.public String getRootPath()
public void setRootPath(String rootPath)
rootPath
- Root path.public void setUseConsistentId(Boolean useConsistentId)
ClusterNode.consistentId()
.useConsistentId
- Use consistent ID flag.public boolean getUseConsistentId()
public void start()
start
in interface LifecycleAware
public void stop()
stop
in interface LifecycleAware
@Nullable public @Nullable IgniteBiTuple<V,?> load(K key)
load
in interface javax.cache.integration.CacheLoader<K,IgniteBiTuple<V,?>>
public void loadCache(IgniteBiInClosure<K,IgniteBiTuple<V,?>> clo, @Nullable Object... args)
IgniteCache.loadCache(IgniteBiPredicate, Object...)
method is invoked which is usually to preload the cache from persistent storage.
This method is optional, and cache implementation does not depend on this
method to do anything. Default implementation of this method in
CacheStoreAdapter
does nothing.
For every loaded value method IgniteBiInClosure.apply(Object, Object)
should be called on the passed in closure. The closure will then make sure
that the loaded value is stored in cache.
loadCache
in interface CacheStore<K,IgniteBiTuple<V,?>>
clo
- Closure for loaded values.args
- Arguments passes into
IgniteCache.loadCache(IgniteBiPredicate, Object...)
method.public Map<K,IgniteBiTuple<V,?>> loadAll(Iterable<? extends K> keys)
loadAll
in interface javax.cache.integration.CacheLoader<K,IgniteBiTuple<V,?>>
public void write(javax.cache.Cache.Entry<? extends K,? extends IgniteBiTuple<V,?>> entry)
write
in interface javax.cache.integration.CacheWriter<K,IgniteBiTuple<V,?>>
public void writeAll(Collection<javax.cache.Cache.Entry<? extends K,? extends IgniteBiTuple<V,?>>> entries)
writeAll
in interface javax.cache.integration.CacheWriter<K,IgniteBiTuple<V,?>>
public void delete(Object key)
delete
in interface javax.cache.integration.CacheWriter<K,IgniteBiTuple<V,?>>
public void deleteAll(Collection<?> keys)
deleteAll
in interface javax.cache.integration.CacheWriter<K,IgniteBiTuple<V,?>>
public void sessionEnd(boolean commit)
'commit'
parameter.sessionEnd
in interface CacheStore<K,IgniteBiTuple<V,?>>
commit
- True
if transaction should commit, false
for rollback.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024