Copies a file in the disk cache (asynchronously). eventPrefix = prefix of the "CopyDone" event. An event is triggered when the job ends. You can get it with: Sub eventPrefix_CopyDone(key As String, Error As Boolean) Error is true if there was an error.
DiskFreeAsLong
Returns the available space in bytes of the disk cache.
DiskJournalAsList
Returns a copy of the journal of the disk cache.
Example: Dim l As List l = myCache.DiskJournal For i = 0 To l.Size - 1 Log(l.Get(i)) Next
DiskListAsMap
Returns a list of the current contents of the disk cache, unordered. Map structure: key=filename, value=object array (0=time of the last modification, 1=size in bytes)
Example: Dim m As Map m = myCache.DiskList Dim Info(2) As Object For i = 0 To m.Size - 1 Log(m.GetKeyAt(i)) Info = m.GetValueAt(i) Log(" " & DateTime.Date(Info(0)) & " " & DateTime.Time(Info(0))) Log(" " & Info(1) & " bytes") Next
DiskUsedAsLong
Returns the sum of the sizes in bytes of the files in the disk cache.
FreeMemoryAsLong [read only]
Gets an approximation of the amount (in bytes) of free memory available to the running program.
Returns the bitmap for key from one of the caches (the memory cache is looked first). Returns null if the key was not found. The bitmap source (memory or disk cache) is specified in the log. updateMemory = if true, the memory cache is updated if the bitmap was only on disk.
Returns the given bitmap for key from one of the caches. If the bitmap is in memory, it is sent back immediately. Otherwise, it is loaded from disk asynchronously. updateMemory = if true, the memory cache is updated if the bitmap was only found on disk. eventPrefix = prefix of the "GetDone" event. An event is triggered when the job ends. You can get it with: Sub eventPrefix_GetDone(key As String, bmp As Bitmap) bmp is null if the key was not found or there was an error.
Returns the bitmap for key from the disk cache. Returns null if the key was not found. colorReduction = if True, the number of colors is reduced to save memory. This setting has no effect if some pixels are not opaque.
Returns the bitmap for key from the disk cache (asynchronously). colorReduction = if True, the number of colors is reduced to save memory. This setting has no effect if some pixels are not opaque. eventPrefix = prefix of the "GetDone" event. An event is triggered when the job ends. You can get it with: Sub eventPrefix_GetDone(key As String, bmp As Bitmap) bmp is null if the key was not found or there was an error.
Returns the object for key from the disk cache (asynchronously). eventPrefix = prefix of the "GetDone" event. An event is triggered when the job ends. You can get it with: Sub eventPrefix_GetDone(key As String, obj As Object) obj is null if the key was not found or there was an error.
GetStringFromDisk (keyAsString) AsString
Gets the string for key from the disk cache. Returns an empty string if the key was not found.
Initializes the caches. memoryCachePct: percentage of free memory to use for the memory cache (this cache is only used for bitmaps, the other objects are stored on disk). Cannot exceed 90. diskCacheSize: size in bytes of the cache on disk. diskCacheDir: folder where the cache files are stored. If empty, the default cache folder is used. This folder is specific to the application.
Example: myCache.Initialize(25, 20 * 1024 * 1024, "/mnt/sdcard/myAppCache") '25% for the memory cache and 20MB for the disk cache
IsClosedAsBoolean
Returns true if the disk cache has been closed.
IsInMemory (keyAsString) AsBoolean
Returns true if the Bitmap for key is still in the memory cache.
IsOnDisk (keyAsString) AsBoolean
Returns true if the file for key is still in the disk cache.
MaxMemoryAsLong [read only]
Gets the maximum amount of memory (in bytes) that may be used by the running program.
MemoryEvictionCountAsInt
Returns the number of bitmaps that have been evicted from the memory cache.
MemoryFreeAsInt
Returns the available space in bytes of the memory cache.
MemoryHitCountAsInt
Returns the number of times GetBitmapFromMemory returned a bitmap that was present in the cache.
MemoryListAsMap
Returns a copy of the current contents of the memory cache, ordered from least recently accessed to most recently accessed.
MemoryMissCountAsInt
Returns the number of times GetBitmapFromMemory returned null (bitmap not found).
MemoryPutCountAsInt
Returns the number of times PutBitmapInMemory was called.
MemoryUsedAsInt
Returns the sum of the sizes in bytes of the entries in the memory cache.
Stores the given bitmap in the disk cache. Format: "JPEG" or "PNG" Quality: quality of JPEG compression (0..100). This setting is ignored for the PNG format.
Stores the given bitmap in the disk cache (asynchronously). Format: "JPEG" or "PNG" Quality: quality of JPEG compression (0..100). This setting is ignored for the PNG format. eventPrefix = prefix of the "PutDone" event. An event is triggered when the job ends. You can get it with: Sub eventPrefix_PutDone(key As String, Error As Boolean) Error is true if there was an error.
PutObjectOnDisk (keyAsString, objAsObject)
Stores the given object in the disk cache. This works only with serializable objects (numbers, booleans, lists, arrays...).
Stores the given object in the disk cache (asynchronously). This works only with serializable objects (numbers, booleans, lists, arrays...). eventPrefix = prefix of the "PutDone" event. An event is triggered when the job ends. You can get it with: Sub eventPrefix_PutDone(key As String, Error As Boolean) Error is true if there was an error.
PutStringOnDisk (keyAsString, valueAsString)
Stores the given string in the disk cache.
RemoveBitmapFromMemory (keyAsString)
Removes the Bitmap for key if it exists.
RemoveFromDisk (keyAsString) AsBoolean
Removes the file for key if it exists in the disk cache. Returns true if the file was removed.
Top