GithubHelp home page GithubHelp logo

leejunhui / yycache Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ibireme/yycache

0.0 0.0 0.0 4.73 MB

High performance cache framework for iOS.

License: MIT License

Objective-C 99.50% Ruby 0.50%

yycache's Introduction

YYCache

License MIT  Carthage compatible  CocoaPods  CocoaPods  Support  Build Status

High performance cache framework for iOS.
(It's a component of YYKit)

Performance

Memory cache benchmark result

Disk benchmark result

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

  1. Add pod 'YYCache' to your Podfile.
  2. Run pod install or pod update.
  3. Import <YYCache/YYCache.h>.

Carthage

  1. Add github "ibireme/YYCache" to your Cartfile.
  2. Run carthage update --platform ios and add the framework to your project.
  3. Import <YYCache/YYCache.h>.

Manually

  1. Download all the files in the YYCache subdirectory.
  2. Add the source files to your Xcode project.
  3. Link with required frameworks:
    • UIKit
    • CoreFoundation
    • QuartzCore
    • sqlite3
  4. 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 上,内存缓存每秒响应次数 (越高越好): Memory cache benchmark result

iPhone 6 上,磁盘缓存每秒响应次数 (越高越好): Disk benchmark result

推荐到 SQLite 官网下载和编译最新的 SQLite,替换 iOS 自带的 libsqlite3.dylib,以获得更好的性能。

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

特性

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

安装

CocoaPods

  1. 在 Podfile 中添加 pod 'YYCache'
  2. 执行 pod installpod update
  3. 导入 <YYCache/YYCache.h>。

Carthage

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

手动安装

  1. 下载 YYCache 文件夹内的所有内容。
  2. 将 YYCache 内的源文件添加(拖放)到你的工程。
  3. 链接以下的 frameworks:
    • UIKit
    • CoreFoundation
    • QuartzCore
    • sqlite3
  4. 导入 YYCache.h

文档

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

系统要求

该项目最低支持 iOS 6.0Xcode 8.0

许可证

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

相关链接

YYCache 设计思路与技术细节

yycache's People

Contributors

ibireme avatar yimingtang avatar everettjf avatar gainell avatar sablib avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.