YYCache alternatives and similar libraries
Based on the "Cache" category.
Alternatively, view YYCache alternatives based on common mentions on social networks and blogs.
-
SPTPersistentCache
Everyone tries to implement a cache at some point in their iOS app’s lifecycle, and this is ours. -
Track
Track is a thread safe cache write by Swift. Composed of DiskCache and MemoryCache which support LRU.
CodeRabbit: AI Code Reviews for Developers
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of YYCache or a related project?
README
YYCache
High performance cache framework for iOS. (It's a component of YYKit)
Performance
You may download and compile the latest version of sqlite and ignore the libsqlite3.dylib in iOS system to get higher performance.
See Benchmark/CacheBenchmark.xcodeproj
for more benchmark case.
Features
- LRU: Objects can be evicted with least-recently-used algorithm.
- Limitation: Cache limitation can be controlled with count, cost, age and free space.
- Compatibility: The API is similar to
NSCache
, all methods are thread-safe. - Memory Cache
- Release Control: Objects can be released synchronously/asynchronously on main thread or background thread.
- Automatically Clear: It can be configured to automatically evict objects when receive memory warning or app enter background.
- Disk Cache
- Customization: It supports custom archive and unarchive method to store object which does not adopt NSCoding.
- Storage Type Control: It can automatically decide the storage type (sqlite / file) for each object to get better performance.
Installation
CocoaPods
- Add
pod 'YYCache'
to your Podfile. - Run
pod install
orpod update
. - Import <YYCache/YYCache.h>.
Carthage
- Add
github "ibireme/YYCache"
to your Cartfile. - Run
carthage update --platform ios
and add the framework to your project. - Import <YYCache/YYCache.h>.
Manually
- Download all the files in the YYCache subdirectory.
- Add the source files to your Xcode project.
- Link with required frameworks:
- UIKit
- CoreFoundation
- QuartzCore
- sqlite3
- Import
YYCache.h
.
Documentation
Full API documentation is available on CocoaDocs. You can also install documentation locally using appledoc.
Requirements
This library requires iOS 6.0+
and Xcode 8.0+
.
License
YYCache is provided under the MIT license. See LICENSE file for details.
中文介绍
高性能 iOS 缓存框架。 (该项目是 YYKit 组件之一)
性能
iPhone 6 上,内存缓存每秒响应次数 (越高越好):
iPhone 6 上,磁盘缓存每秒响应次数 (越高越好):
推荐到 SQLite 官网下载和编译最新的 SQLite,替换 iOS 自带的 libsqlite3.dylib,以获得更好的性能。
更多测试代码和用例见 Benchmark/CacheBenchmark.xcodeproj
。
特性
- LRU: 缓存支持 LRU (least-recently-used) 淘汰算法。
- 缓存控制: 支持多种缓存控制方法:总数量、总大小、存活时间、空闲空间。
- 兼容性: API 基本和
NSCache
保持一致, 所有方法都是线程安全的。 - 内存缓存
- 对象释放控制: 对象的释放(release) 可以配置为同步或异步进行,可以配置在主线程或后台线程进行。
- 自动清空: 当收到内存警告或 App 进入后台时,缓存可以配置为自动清空。
- 磁盘缓存
- 可定制性: 磁盘缓存支持自定义的归档解档方法,以支持那些没有实现 NSCoding 协议的对象。
- 存储类型控制: 磁盘缓存支持对每个对象的存储类型 (SQLite/文件) 进行自动或手动控制,以获得更高的存取性能。
安装
CocoaPods
- 在 Podfile 中添加
pod 'YYCache'
。 - 执行
pod install
或pod update
。 - 导入 <YYCache/YYCache.h>。
Carthage
- 在 Cartfile 中添加
github "ibireme/YYCache"
。 - 执行
carthage update --platform ios
并将生成的 framework 添加到你的工程。 - 导入 <YYCache/YYCache.h>。
手动安装
- 下载 YYCache 文件夹内的所有内容。
- 将 YYCache 内的源文件添加(拖放)到你的工程。
- 链接以下的 frameworks:
- UIKit
- CoreFoundation
- QuartzCore
- sqlite3
- 导入
YYCache.h
。
文档
你可以在 CocoaDocs 查看在线 API 文档,也可以用 appledoc 本地生成文档。
系统要求
该项目最低支持 iOS 6.0
和 Xcode 8.0
。
许可证
YYCache 使用 MIT 许可证,详情见 LICENSE 文件。
相关链接
*Note that all licence references and agreements mentioned in the YYCache README section above
are relevant to that project's source code only.