cachai.data.clear_cache

cachai.data.clear_cache(max_age_days=0)[source]

Delete old cached files from cachai’s cache directory.

Parameters
max_age_daysint, optional

Maximum file age in days. Files older than this will be deleted. If set to 0 (default), all files are removed.

Examples

import cachai.data as chd

# Delete all cached files
chd.clear_cache()
3 file(s) deleted by 2025-09-29 (14:43:47) from cachai's cache folder.
Space freed: 153.1 KB (100.0%).

You can also choose the maximum file age in days, files older than max_age_days will be deleted:

import cachai.data as chd

# Delete files older than 30 days
clear_cache(max_age_days=30)