YYCache - iOS的高性能缓存框架

网友投稿 1005 2022-10-21

YYCache - iOS的高性能缓存框架

YYCache - iOS的高性能缓存框架

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 CacheRelease 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 CacheCustomization: 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 or pod update.Import .

Carthage

Add github "ibireme/YYCache" to your Cartfile.Run carthage update --platform ios and add the framework to your project.Import .

Manually

Download all the files in the YYCache subdirectory.Add the source files to your Xcode project.Link with required frameworks: UIKitCoreFoundationQuartzCoresqlite3Import 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 7.0+.

License

YYCache is provided under the MIT license. See LICENSE file for details.

中文介绍

高性能 iOS 缓存框架。 (该项目是 YYKit 组件之一)

性能

推荐到 SQLite 官网-和编译最新的 SQLite,以替换 iOS 自带的 libsqlite3.dylib,以获得最高 1.5~3 倍的性能提升。

更多测试代码和用例见 Benchmark/CacheBenchmark.xcodeproj。

特性

LRU: 缓存支持 LRU (least-recently-used) 淘汰算法。缓存控制: 支持多种缓存控制方法:总数量、总大小、存活时间、空闲空间。兼容性: API 基本和 NSCache 保持一致, 所有方法都是线程安全的。内存缓存对象释放控制: 对象的释放(release) 可以配置为同步或异步进行,可以配置在主线程或后台线程进行。自动清空: 当收到内存警告或 App 进入后台时,缓存可以配置为自动清空。磁盘缓存可定制性: 磁盘缓存支持自定义的归档解档方法,以支持那些没有实现 NSCoding 协议的对象。存储类型控制: 磁盘缓存支持对每个对象的存储类型 (SQLite/文件) 进行自动或手动控制,以获得更高的存取性能。

安装

CocoaPods

在 Podfile 中添加 pod 'YYCache'。执行 pod install 或 pod update。导入

Carthage

在 Cartfile 中添加 github "ibireme/YYCache"。执行 carthage update --platform ios 并将生成的 framework 添加到你的工程。导入

手动安装

- YYCache 文件夹内的所有内容。将 YYCache 内的源文件添加(拖放)到你的工程。链接以下的 frameworks: UIKitCoreFoundationQuartzCoresqlite3导入 YYCache.h。

文档

你可以在 CocoaDocs 查看在线 API 文档,也可以用 appledoc 本地生成文档。

系统要求

该项目最低支持 iOS 6.0 和 Xcode 7.0。

许可证

YYCache 使用 MIT 许可证,详情见 LICENSE 文件。

相关链接

YYCache 设计思路与技术细节

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:MapStruct入门使用
下一篇:三天学会使用MyBatis,绝对干货,只实战,不学究
相关文章

 发表评论

暂时没有评论,来抢沙发吧~