com.aspose.imaging
Class Cache

java.lang.Object
  extended by com.aspose.imaging.Cache

public class Cache
extends java.lang.Object

Contains cache settings.


Constructor Summary
Cache()
           
 
Method Summary
static StreamContainer allocate(long length)
           Allocates a new stream container of the specified length.
static long getAllocatedDiskBytesCount()
           Gets the allocated disk bytes count.
static long getAllocatedMemoryBytesCount()
           Gets the allocated in-memory bytes count.
static java.lang.String getCacheFolder()
           Gets or sets the cache folder.
static int getCacheType()
           Gets 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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache()
Method Detail

allocate

public static StreamContainer allocate(long length)

Allocates a new stream container of the specified length.

Parameters:
length - The length, specified in bytes.
Returns:
The allocated stream or appropriate exception if allocation failed.

getAllocatedDiskBytesCount

public static long getAllocatedDiskBytesCount()

Gets the allocated disk bytes count.

Value: The allocated disk bytes count.


getAllocatedMemoryBytesCount

public static long getAllocatedMemoryBytesCount()

Gets the allocated in-memory bytes count.

Value: The allocated in-memory bytes count.


getCacheFolder

public static java.lang.String getCacheFolder()

Gets or sets the cache folder.

Value: The cache folder.


getCacheType

public static int getCacheType()

Gets the cache scheme used.

Value: The cache scheme used.


getExactReallocateOnly

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.

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.


getMaxDiskSpaceForCache

public static int getMaxDiskSpaceForCache()

Gets 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.


getMaxMemoryForCache

public static int getMaxMemoryForCache()

Gets 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.


setCacheType

public static void setCacheType(int value)

Sets the cache scheme used.

Value: The cache scheme used.


setDefaults

public static void setDefaults()

Sets the Cache settings to defaults.


setExactReallocateOnly

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.


setMaxDiskSpaceForCache

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.


setMaxMemoryForCache

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.