我在 iOS 应用程序上使用 Realm 进行存储。
用户将在其中存储二进制数据(NSData*),并且可以选择删除某些记录以恢复空间。
除了使用writeCopyToPath
和替换数据库之外,还有其他方法强制进行压缩操作吗?
最佳答案
Apart from using
writeCopyToPath
and replacing the database, is there any other means of forcing a compaction operation?
这是 Realm 目前支持恢复“预分配但不再使用”磁盘空间的唯一方式。
支持在启动时自动压缩 Realm 文件也是 Realm 正在跟踪的内容:https://github.com/realm/realm-cocoa/issues/3289
关于ios - Realm.io 压缩数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36279679/