清理缓存
来源:互联网 发布:古代城墙有多高 知乎 编辑:程序博客网 时间:2024/04/29 20:38
//清理缓存
-(void) clearCache
{
dispatch_async(
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
, ^{
NSString *cachPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSArray *files = [[NSFileManager defaultManager] subpathsAtPath:cachPath];
for (NSString *p in files) {
NSError *error;
NSString *path = [cachPath stringByAppendingPathComponent:p];
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
[[NSFileManager defaultManager] removeItemAtPath:path error:&error];
}
}
[self performSelectorOnMainThread:@selector(clearCacheSuccess)
withObject:nil waitUntilDone:YES];});
}
-(void) clearCache
{
dispatch_async(
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
, ^{
NSString *cachPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSArray *files = [[NSFileManager defaultManager] subpathsAtPath:cachPath];
for (NSString *p in files) {
NSError *error;
NSString *path = [cachPath stringByAppendingPathComponent:p];
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
[[NSFileManager defaultManager] removeItemAtPath:path error:&error];
}
}
[self performSelectorOnMainThread:@selector(clearCacheSuccess)
withObject:nil waitUntilDone:YES];});
}
0 0
- 缓存清理
- 清理缓存
- 缓存清理
- 清理缓存
- 清理缓存
- 清理缓存
- 清理缓存
- 清理缓存
- 清理缓存
- 清理缓存
- 清理缓存
- 得到缓存及清理缓存
- 页面缓存清理方法
- ajax的缓存清理
- ajax的缓存清理
- asp清理站点缓存
- asp清理站点缓存
- Hibernate清理缓存
- 样式规则多次编写
- 行为型模式11之3-Strategy策略模式例子理解
- localStoreage代码规范
- 利用MAVEN打包可运行jar包,包括依赖的第三方包
- 玩转Google开源C++单元测试框架Google Test系列(gtest)之二 - 断言
- 清理缓存
- POJ-3740-Easy Finding【DLX精确覆盖】
- 玩转Google开源C++单元测试框架Google Test系列(gtest)之三 - 事件机制
- Android 6.0 开发者对系统权限的使用与练习(Permissions Best Practices)
- sqlite API 简介(C\C++)
- 玩转Google开源C++单元测试框架Google Test系列(gtest)之四 - 参数化
- linux 配置用户sudo权限
- Solidity 文档--目录
- .container类的说明