简体   繁体   English

如何删除PFFile的缓存

[英]How to delete PFFile's cache

I'm using Parse and PFFile and developing iOS app that provide audio contents. 我正在使用Parse和PFFile并正在开发提供音频内容的iOS应用。

And when I download new mp3 file from cloud, the data look to be saved locally as cache. 当我从云下载新的mp3文件时,数据看起来将保存为本地缓存。 Caching itself is good. 缓存本身很好。

But my problem is since each audio content is around 3mb and storage usage of my app keep increasing. 但是我的问题是,由于每个音频内容都在3mb左右,并且我的应用程序的存储空间不断增加。 I want to delete old local cache manually. 我想手动删除旧的本地缓存。

It is possible? 有可能的? and how can I delete cached files? 以及如何删除缓存的文件?

[UPDATED] [更新]

Heres my code. 这是我的代码。 Basically I download mp3 data from parse cloud by using getDataInBackgroundWithBlock. 基本上,我使用getDataInBackgroundWithBlock从解析云下载mp3数据。

// lessonObj is PFObject
let lessonFile = lessonObj["mp3"] as PFFile
lessonFile.getDataInBackgroundWithBlock {
    (mp3Data: NSData!, error: NSError!) -> Void in
    if ( error == nil ) {
        // next step
    } else {
        // println("error")
    }
}

Thank you! 谢谢!

[PFFile clearAllCachedDataInBackground];

为了清除缓存,您将需要使用以下功能。

[PFQuery clearAllCachedResults];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM