简体   繁体   English

Parse.com:本地缓存有多大?

[英]Parse.com: How large is the local cache?

Parse.com handles local caching, which is great. Parse.com处理本地缓存,这很棒。

How large may the local cache become on an iOS device? iOS设备上的本地缓存有多大? In the online doc , Parse states: 在线文档中 ,Parse声明:

Parse takes care of automatically flushing the cache when it takes up too much space. 当Parse占用太多空间时,Parse会自动刷新缓存。

If I store thousands of objects in Parse,and would like to cache them all locally, would that work? 如果我在Parse中存储了数千个对象,并希望将它们全部缓存在本地,那会起作用吗? What is the cache limit? 什么是缓存限制?

Also is there a limit per entity or a global limit for all entities? 所有实体的每个实体或全局限制是否也有限制?

Thank you! 谢谢!

It sounds like you are looking to be able to use your Parse data offline. 听起来您希望能够脱机使用您的Parse数据。 I'm not certain of the size of the Parse cache or the details of how it works. 我不确定Parse缓存的大小或其工作原理的细节。 I have some experience using Parse and ran into some issues with this very topic. 我有一些使用Parse的经验,并遇到了这个主题的一些问题。 I think it's important to note that in Parse's documentation they describe that they "cache the result of a query on disk." 我认为值得注意的是,在Parse的文档中,他们描述了它们“将查询结果缓存在磁盘上”。 This is very different from caching all of your PFObjects on disk. 这与在磁盘上缓存所有PFObject非常不同。

Essentially the cache allows you to re-run a query that has already been run and get the same results as the first time. 本质上,缓存允许您重新运行已经运行的查询并获得与第一次相同的结果。 For example, you can't cache the results of a query that returns all of a certain object type and then later run another query that gets a subset of those objects from the cache. 例如,您无法缓存返回所有特定对象类型的查询结果,然后再运行另一个从缓存中获取这些对象子集的查询。 You have to run the exact same query to get the cached result. 您必须运行完全相同的查询才能获得缓存的结果。 This can be very limiting. 这可能非常有限。

I gave up on relying on Parse's cache before testing any of this, but I believe using it heavily can be dangerous. 在测试任何一个之前我放弃了依赖Parse的缓存,但我认为大量使用它可能很危险。 For example, if you retrieve a cached query result, edit one of the PFObjects, and then retrieve the same cached query result again I am pretty sure the PFObject you edited will not reflect your edits. 例如,如果您检索缓存的查询结果,请编辑其中一个PFObject,然后再次检索相同的缓存查询结果我非常确定您编辑的PFObject不会反映您的编辑。 I could be wrong about this, but you could test it easily enough. 我可能错了,但你可以很容易地测试它。

As I said, I gave up on relying on the Parse API for offline use. 正如我所说,我放弃了依赖Parse API进行离线使用。 I ended up using Core Data as the local store for my data and syncing my NSManagedObjects with Parse. 我最终使用Core Data作为我的数据的本地存储,并将我的NSManagedObjects与Parse同步。 In my case I needed everything to work when offline. 在我的情况下,我需要在离线时工作。 There may be a better way to handle this, but I haven't seen one. 可能有更好的方法来解决这个问题,但我还没有看到。

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

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