php - How to delete cakephp cached file by name or by name prefix?
In cakephp 2.0 I cache some information getting from some service calls in file for individual users. Using individual user_id as a prefix of the cached file name, I cache the files under a custom cache configuration which saves in a folder under cache folder.
Like, if the service name is get_user_info and the custom cache folder name is user_info then for a user say user_id:111, a file will be cached with name 111_get_user_info in cache/user_info.
If I need to remove the cached info for this user:111, I can't make that. Because Cache::clear(false, 'user_info') deletes all the cached files under cache/user_info and as a consequence other users cached info has removed as well.
Can anybody suggest me how can I clear the cached file by using a prefix match?
You can use the function
clearCache($file)where $file need to be some like that:
you need to create the entire path to pass a cake.
keep me posted if this solution work for you.