Giter Club home page Giter Club logo

rencache's Introduction

RENCache

/// 默认缓存过期时间无限,可设置默认缓存时长(秒)
@property(nonatomic) NSTimeInterval defaultTimeoutInterval;
/// 内存中最大保存个数,默认为10
@property(nonatomic) NSInteger defaultCacheMemoryLimit;

/// 单利
+ (RENCache *)sharedGlobalCache;


/// 获取磁盘缓存所有key
- (NSArray *)allKeys;


/// 判断key是否有对应缓存
- (BOOL)hasCacheForKey:(NSString *)key;

/// 获取磁盘缓存个数
- (NSUInteger)getAllCacheCount;
/// 获取磁盘全部缓存大小
- (NSUInteger)getAllCacheSize;
/// 获取单个缓存的大小
- (NSUInteger)getSingleCacheSizeForKey:(NSString *)key;


/// 清除全部缓存(包括内存中的缓存)
- (void)clearAllCache;
/// 删除内存中的缓存
- (void)clearMemoryCache;
/// 删除单个缓存
- (void)removeCacheForKey:(NSString *)key;


/// 根据key读取写入的image
- (UIImage *)imageObjectForKey:(NSString *)key;
/// 根据key写入image
- (void)setImage:(UIImage *)image forKey:(NSString *)key;
/// 根据key写入image  @param timeoutInterval 设置缓存时长(秒)
- (void)setImage:(UIImage *)image forKey:(NSString *)key withTimeoutInterval:(NSTimeInterval)timeoutInterval;


/// 根据key读取value  @note 当获取对象是model时,model必须实现NSCoding协议
- (id)objectForKey:(NSString *)key;
/// 根据key写入value  @note 当value为自定义对象,必须实现NSCoding协议
- (void)setObjectValue:(id)value forKey:(NSString *)key;
/// 根据key写入value  @param timeoutInterval 设置缓存时长(秒) @note 当value为自定义对象,必须实现NSCoding协议
- (void)setObjectValue:(id)value forKey:(NSString *)key withTimeoutInterval:(NSTimeInterval)timeoutInterval;

rencache's People

Watchers

James Cloos avatar  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.