TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Jérôme Morissard.
JMCache is a key/value store designed for persisting temporary objects fully based on GCD. It is composed of a cache disk and a memory cache (JMCacheMemory).
JMCache is cool because :
typedef NS_ENUM(NSUInteger, JMCacheType) {
JMCacheTypePublic,
JMCacheTypePrivate,
JMCacheTypeOffline
};
typedef NS_OPTIONS(NSUInteger, JMCacheType) {
JMCacheTypeInMemory = 1,
JMCacheTypeOnDisk = 1 << 1,
JMCacheTypeInMemoryThenOnDisk = (JMCacheTypeInMemory | JMCacheTypeOnDisk)
};
You can write your own valueTransformer to increase security of your encoded data. For example, see minimalist implemtation of JMCacheReverseDataValueTransformer class.
@property (strong, nonatomic) JMCacheValueTransformer *valueTransformer;
// Async API
- (void)objectForKey:(NSString *)key withCompletionBlock:(JMCacheCompletionBlockObjectError)block;
- (void)setObject:(NSObject *)obj forKey:(NSString *)key withCompletionBlock:(JMCacheCompletionBlockBoolError)block;
- (void)removeObjectForKey:(NSString *)key withCompletionBlock:(JMCacheCompletionBlockBoolError)block;
- (void)clearCacheWithCompletionBlock:(JMCacheCompletionBlockBool)block;
// Sync API
- (id)objectForKey:(NSString *)key;
- (BOOL)setObject:(NSObject *)obj forKey:(NSString *)key;
- (NSInteger)numberOfCachedObjects;