tencent cloud

Cache Management
Last updated: 2025-07-04 16:56:45
Cache Management
Last updated: 2025-07-04 16:56:45
During the use of mini programs, the following cache data is generated:
Mini program code cache: When a mini program is opened for the first time, its code is downloaded and cached for quicker access in the future. This data is shared across all accounts and is not isolated by account.
Mini program data cache: This refers to the files and data cached during the use of the mini program. This data is stored separately for each account.
To facilitate the superapp to manage mini program cache, the SDK provides the following capabilities.

Get the list of cached mini programs

Return a list of cached mini programs across all accounts. If the same mini program exists under multiple accounts, duplicates will be removed.
/**
* Gets the list of cached mini programs (under all accounts)
* Note: Only supported when called in the main process.
* @param callback Callback for the list
*/
public static void getMiniAppCacheForAllUser(ICallback<List<MiniApp>> callback)

Get the data cache size of a specified mini program

/**
* Gets the data cache size of a specified mini program (under all accounts and in all versions)
* Note: This API involves IO operations, please call it in a sub-thread.
* Note: Only supported when called in the main process.
* @param appId Mini program appid
* @return Size in bytes
*/
public static long getMiniAppCacheSizeForAllUser(String appId)

Get the code cache size of a specified mini program


/**
* Gets the code package size of a specified mini program (under all accounts and in all versions)
* Note: This API involves IO operations, please call it in a sub-thread.
* Note: Only supported when called in the main process.
* @param appId Mini program appid
* @return Size in bytes
*/
public static long getMiniAppPkgSizeForAllUser(String appId)

Delete the data cache of a specified mini program

/**
* Deletes the data cache of a specified mini program (under all accounts and in all versions)
* Note: This API involves IO operations, please call it in a sub-thread.
* Note: Only supported when called in the main process.
* @param appId
*/
public static void clearMiniAppCacheForAllUser(String appId)

Delete the code cache of a specified mini program

/**
* Deletes the code package of a specified mini program (under all accounts and in all versions)
* Note: This API involves IO operations, please call it in a sub-thread.
* Note: Only supported when called in the main process.
* @param appId Mini program appid
*/
public static void clearMiniAppPkgForAllUser(String appId)

Delete the data and code cache of a specified mini program

/**
* Deletes the cache and code package of a specified mini program (under all accounts and in all versions)
* Note: This API involves IO operations, please call it in a sub-thread.
* Note: Only supported when called in the main process.
* @param appId
*/
public static void deleteMiniAppForAllUser(String appId)


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback