Skip to main content

Cache

This guide describes the methods to manage cache.

Get Cache Dir Path#

The following code example demonstrates getting a cache directory path.

// Add trailing slash.val addTrailingSlash: Boolean = false
// Returns path where library caches files. App may use this folder too.FileManager.cache.getCacheDirPath(true)

Get And Create Cache Dir Path#

The following code example demonstrates creating a cache directory and getting a path to that directory.

// Add trailing slash.val addTrailingSlash: Boolean = false
// Returns path where library caches files. App may use this folder too.FileManager.cache.getAndCreateCacheDirPath(true)

Get Cache Size#

The function getCacheSize() returns a total size of the cache directory content in bytes. The following code example demonstrates clearing the cache.

FileManager.cache.getCacheSize()

Clear Cache#

The function clearCache() deletes the files located in the directory, returned by getCacheDirPath(). Note this method is blocking. The following code example demonstrates clearing the cache.

FileManager.cache.clearCache()