public final class Cache extends Object
Contains cache settings.
Modifier and Type | Method and Description |
---|---|
static long |
getAllocatedDiskBytesCount()
Gets the allocated disk bytes count.
|
static long |
getAllocatedMemoryBytesCount()
Gets the allocated in-memory bytes count.
|
static String |
getCacheFolder()
Gets the cache folder.
|
static int |
getCacheType()
Gets or sets the cache scheme used.
|
static boolean |
getExactReallocateOnly()
Gets a value indicating whether reallocation should be exact or not.
|
static int |
getMaxDiskSpaceForCache()
Gets the maximum available disk space for cache.
|
static int |
getMaxMemoryForCache()
Gets the maximum available memory for cache in memory.
|
static void |
setCacheFolder(String value)
Sets the cache folder.
|
static void |
setCacheType(int value)
Sets the cache scheme used.
|
static void |
setDefaults()
Sets the
Cache settings to defaults. |
static void |
setExactReallocateOnly(boolean value)
Sets a value indicating whether reallocation should be exact or not.
|
static void |
setMaxDiskSpaceForCache(int value)
Sets the maximum available disk space for cache.
|
static void |
setMaxMemoryForCache(int value)
Sets the maximum available memory for cache in memory.
|
public static boolean getExactReallocateOnly()
Gets a value indicating whether reallocation should be exact or not. If reallocation is non exact the performance should be higher.
true
if reallocation is exact; otherwise, false
.
The exact reallocation will perform reallocation of additional memory only up to the upper limit specified. When passing upper limit for in-memory during reallocation the cached data will be copied to disk if possible. When passing upper limit for disk memory during reallocation the appropriate exception is thrown. The performance should be higher if this option is turned off as no additional copying will be performed if possible, however this may also lead to pass upper limits specified for memory or disk.
public static void setExactReallocateOnly(boolean value)
Sets a value indicating whether reallocation should be exact or not. If reallocation is non exact the performance should be higher.
value
- true
if reallocation is exact; otherwise, false
.
The exact reallocation will perform reallocation of additional memory only up to the upper limit specified. When passing upper limit for in-memory during reallocation the cached data will be copied to disk if possible. When passing upper limit for disk memory during reallocation the appropriate exception is thrown. The performance should be higher if this option is turned off as no additional copying will be performed if possible, however this may also lead to pass upper limits specified for memory or disk.
public static String getCacheFolder()
Gets the cache folder.
public static void setCacheFolder(String value)
Sets the cache folder.
value
- The cache folder.public static long getAllocatedMemoryBytesCount()
Gets the allocated in-memory bytes count.
public static long getAllocatedDiskBytesCount()
Gets the allocated disk bytes count.
public static int getMaxMemoryForCache()
Gets the maximum available memory for cache in memory. The value specified is megabytes count.
Value of 0 will consume all available memory and serves as no upper limit.
public static void setMaxMemoryForCache(int value)
Sets the maximum available memory for cache in memory. The value specified is megabytes count.
value
- The maximum memory for cache.
Value of 0 will consume all available memory and serves as no upper limit.
public static int getMaxDiskSpaceForCache()
Gets the maximum available disk space for cache. The value specified is megabytes count.
Value of 0 will consume all available memory and serves as no upper limit.
public static void setMaxDiskSpaceForCache(int value)
Sets the maximum available disk space for cache. The value specified is megabytes count.
value
- The maximum available disk space for cache.
Value of 0 will consume all available memory and serves as no upper limit.
public static int getCacheType()
Gets or sets the cache scheme used.
public static void setCacheType(int value)
Sets the cache scheme used.
value
- The cache scheme used.public static void setDefaults()
Sets the Cache
settings to defaults.