Manually clear the Cache

Source: Internet
Author: User

1.nsstring *home = nshomedirectory(); Gets the directory path of the application,

There are three folders in the directory: Documents, Library, tmp

Documents: Primary storage: Use this path to place critical data, i.e. data that cannot be regenerated through the app

Library: Main storage: Cache files, can be generated in real-time.

TMP: The temporary file is stored and is automatically cleared when it is closed.

2. Write out the contents of the folder you want to clear.

Go to the folder according to the previous home path to view the folder you want to clear under library/caches/default/

nsstring *path = @ "library/caches/default/ Com.hackemist.SDWebImageCache.default ";

3. Stitching into a complete path

nsstring *newpath = [Home stringbyappendingpathcomponent:p ath];

4. Create a File Manager

Nsfilemanager *manager = [Nsfilemanager Defaultmanager];

5. The manager deletes the contents of this path

[Manager Removeitematpath:newpath];

6. Shows how much of the purge can get the cache size.

Use Sdimagecache frame: nsinteger size = [[Sdimagecache sharedimagecache] getsize];

This can be displayed on the label.

Manually clear the Cache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.