Commit cb9ad5b8 authored by licong's avatar licong

fisrt

parent 73d6ecc3
......@@ -247,6 +247,9 @@
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = licong;
TargetAttributes = {
6003F589195388D20070C39A = {
DevelopmentTeam = DGT9C327YY;
};
6003F5AD195388D20070C39A = {
TestTargetID = 6003F589195388D20070C39A;
};
......@@ -513,6 +516,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "GMPhobos/GMPhobos-Prefix.pch";
INFOPLIST_FILE = "GMPhobos/GMPhobos-Info.plist";
......@@ -529,6 +533,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "GMPhobos/GMPhobos-Prefix.pch";
INFOPLIST_FILE = "GMPhobos/GMPhobos-Info.plist";
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:GMPhobos.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
source 'https://github.com/CocoaPods/Specs.git'
source 'http://git.gengmei.cc/gengmeiios/GMSpecs.git'
use_frameworks!
target 'GMPhobos_Example', :exclusive => true do
......
PODS:
- GMLibrary/Cache (0.0.1):
- TMCache (~> 2.1.0)
- GMPhobos (0.0.1):
- GMLibrary/Cache (~> 0.0.1)
- TMCache (2.1.0)
DEPENDENCIES:
- GMPhobos (from `../`)
EXTERNAL SOURCES:
GMPhobos:
:path: "../"
SPEC CHECKSUMS:
GMLibrary: c31039ad32bc93f866d6c3052c20acb8cf9c1568
GMPhobos: 2286c03083b1944f7c9e499bbb259ae85b1bb411
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
COCOAPODS: 0.39.0
Copyright (c) 2015 Sean Lee <1240690490@qq.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
//
// CacheService.h
// Gengmei
//
// Created by Thierry on 1/5/15.
// Copyright (c) 2015 Wanmeichuangyi. All rights reserved.
//
#import <Foundation/Foundation.h>
//#import <TMCache.h>
#import "WMDocumentCache.h"
typedef NS_ENUM(NSUInteger, WMCacheMethod) {
WMCacheDiskMethod = 1,
WMCacheMemoryMethod
};
@interface WMCacheService : NSObject
@property (nonatomic,strong) NSString * urlCommonString;
+ (instancetype )sharedInstance;
/**
* @brief 异步磁盘读写操作
*/
/*** @brief 由对应的键获取对应的缓存数据*/
- (void)storeObjectAtDiskWithkey:(NSString *)key
object:(id <NSCoding>)object
block:(TMDiskCacheObjectBlock)block;
/*** @brief 给特定的键,标记缓存数据并缓存*/
- (void)fetchObjectAtDiskWithkey:(NSString *)key
block:(TMDiskCacheObjectBlock)block;
/*** @brief 删除特定的键,对应的缓存数据*/
- (void)removeObjectAtDiskWithkey:(NSString *)key
block:(TMDiskCacheObjectBlock)block;
/*** @brief 清空所有的缓存数据*/
- (void)removeAllObjectsAtDiskWithBlock:(TMDiskCacheBlock)block;
/**
* @brief 同步磁盘读写操作
*/
/*** @brief 由对应的键获取对应的缓存数据*/
- (void)storeObjectAtDiskWithkey:(NSString *)key
object:(id <NSCoding>)object;
/*** @brief 给特定的键,标记缓存数据并缓存*/
- (id)fetchObjectAtDiskWithkey:(NSString *)key;
/*** @brief 删除特定的键,对应的缓存数据*/
- (void)removeObjectAtDiskWithkey:(NSString *)key;
/*** @brief 清空所有的缓存数据*/
- (void)removeAllObjectsAtDisk;
/**
* @brief 异步内存读写操作
*/
/*** @brief 由对应的键获取对应的缓存数据*/
- (void)storeObjectAtMemoryWithkey:(NSString *)key
object:(id <NSCoding>)object
block:(TMMemoryCacheObjectBlock)block;
/*** @brief 给特定的键,标记缓存数据并缓存*/
- (void)fetchObjectAtMemoryWithkey:(NSString *)key
block:(TMMemoryCacheObjectBlock)block;
/*** @brief 删除特定的键,对应的缓存数据*/
- (void)removeObjectAtMemoryWithkey:(NSString *)key
block:(TMMemoryCacheObjectBlock)block;
/*** @brief 清空所有的缓存数据*/
- (void)removeAllObjectsAtMemoryWithBlock:(TMMemoryCacheBlock)block;
/**
* @brief 同步内存读写操作
*/
/*** @brief 由对应的键获取对应的缓存数据*/
- (void)storeObjectAtMemoryWithkey:(NSString *)key
object:(id)object;
/*** @brief 给特定的键,标记缓存数据并缓存*/
- (id)fetchObjectAtMemoryWithkey:(NSString *)key;
/*** @brief 删除特定的键,对应的缓存数据*/
- (void)removeObjectAtMemoryWithkey:(NSString *)key;
/*** @brief 清空所有的缓存数据*/
- (void)removeAllObjectsAtMemory;
#pragma mark - 这里将数据缓存到Ducument目录下
/**
* @brief 异步磁盘读写操作
*/
- (void)storeObjectAtDucmentPathWithkey:(NSString *)key
object:(id <NSCoding>)object
block:(TMDiskCacheObjectBlock)block;
- (void)fetchObjectAtDucmentPathWithkey:(NSString *)key
block:(TMDiskCacheObjectBlock)block;
- (void)removeObjectAtDucmentPathWithkey:(NSString *)key
block:(TMDiskCacheObjectBlock)block;
- (void)removeAllObjectsAtDucmentPathWithBlock:(TMDiskCacheBlock)block;
/**
* @brief 同步内存读写操作
*/
- (void)storeObjectAtDucmentPathWithkey:(NSString *)key
object:(id <NSCoding>)object;
- (id)fetchObjectAtDucmentPathWithkey:(NSString *)key;
- (void)removeObjectAtDucmentPathWithkey:(NSString *)key;
- (void)removeAllObjectsAtDucmentPath;
@end
//
// CacheService.m
// Gengmei
//
// Created by Thierry on 1/5/15.
// Copyright (c) 2015 Wanmeichuangyi. All rights reserved.
//
#import "WMCacheService.h"
static WMCacheService *sharedManager = nil;
@implementation WMCacheService
+ (instancetype)sharedInstance{
static dispatch_once_t oncePredicate;
dispatch_once(&oncePredicate,^{
sharedManager = [[WMCacheService alloc]init];
});
return sharedManager;
}
- (void)storeObjectAtDiskWithkey:(NSString *)key object:(id <NSCoding>)object block:(TMDiskCacheObjectBlock)block{
[[TMCache sharedCache].diskCache setObject:object forKey:key block:block];
}
- (void)fetchObjectAtDiskWithkey:(NSString *)key block:(TMDiskCacheObjectBlock)block{
[[TMCache sharedCache].diskCache objectForKey:key block:block];
}
- (void)removeObjectAtDiskWithkey:(NSString *)key block:(TMDiskCacheObjectBlock)block{
[[TMCache sharedCache].diskCache removeObjectForKey:key block:block];
}
- (void)removeAllObjectsAtDiskWithBlock:(TMDiskCacheBlock)block{
[[TMCache sharedCache].diskCache removeAllObjects:block];
}
- (void)storeObjectAtDiskWithkey:(NSString *)key object:(id <NSCoding>)object{
[[TMCache sharedCache].diskCache setObject:object forKey:key];
}
- (id)fetchObjectAtDiskWithkey:(NSString *)key{
return [[TMCache sharedCache].diskCache objectForKey:key];
}
- (void)removeObjectAtDiskWithkey:(NSString *)key{
[[TMCache sharedCache].diskCache removeObjectForKey:key];
}
- (void)removeAllObjectsAtDisk{
[[TMCache sharedCache].diskCache removeAllObjects];
}
- (void)storeObjectAtMemoryWithkey:(NSString *)key object:(id <NSCoding>)object block:(TMMemoryCacheObjectBlock)block{
[[TMCache sharedCache].memoryCache setObject:object forKey:key block:block];
}
- (void)fetchObjectAtMemoryWithkey:(NSString *)key block:(TMMemoryCacheObjectBlock)block{
[[TMCache sharedCache].memoryCache objectForKey:key block:block];
}
- (void)removeObjectAtMemoryWithkey:(NSString *)key block:(TMMemoryCacheObjectBlock)block{
[[TMCache sharedCache].memoryCache removeObjectForKey:key block:block];
}
- (void)removeAllObjectsAtMemoryWithBlock:(TMMemoryCacheBlock)block{
[[TMCache sharedCache].memoryCache removeAllObjects:block];
}
- (void)storeObjectAtMemoryWithkey:(NSString *)key object:(id)object{
[[TMCache sharedCache].memoryCache setObject:object forKey:key];
}
- (id)fetchObjectAtMemoryWithkey:(NSString *)key{
return [[TMCache sharedCache].memoryCache objectForKey:key];
}
- (void)removeObjectAtMemoryWithkey:(NSString *)key{
[[TMCache sharedCache].memoryCache removeObjectForKey:key];
}
- (void)removeAllObjectsAtMemory{
[[TMCache sharedCache].memoryCache removeAllObjects];
}
- (void)storeObjectAtDucmentPathWithkey:(NSString *)key
object:(id <NSCoding>)object
block:(TMDiskCacheObjectBlock)block{
[[WMDocumentCache sharedCache].diskCache setObject:object forKey:key block:block];
}
- (void)fetchObjectAtDucmentPathWithkey:(NSString *)key
block:(TMDiskCacheObjectBlock)block{
[[WMDocumentCache sharedCache].diskCache objectForKey:key block:block];
}
- (void)removeObjectAtDucmentPathWithkey:(NSString *)key
block:(TMDiskCacheObjectBlock)block{
[[WMDocumentCache sharedCache].diskCache removeObjectForKey:key block:block];
}
- (void)removeAllObjectsAtDucmentPathWithBlock:(TMDiskCacheBlock)block{
[[WMDocumentCache sharedCache].diskCache removeAllObjects:block];
}
- (void)storeObjectAtDucmentPathWithkey:(NSString *)key
object:(id <NSCoding>)object{
[[WMDocumentCache sharedCache].diskCache setObject:object forKey:key];
}
- (id)fetchObjectAtDucmentPathWithkey:(NSString *)key{
return [[WMDocumentCache sharedCache].diskCache objectForKey:key];
}
- (void)removeObjectAtDucmentPathWithkey:(NSString *)key{
[[WMDocumentCache sharedCache].diskCache removeObjectForKey:key];
}
- (void)removeAllObjectsAtDucmentPath{
[[WMDocumentCache sharedCache].diskCache removeAllObjects];
}
@end
//
// WMCache.h
// Gengmei
//
// Created by Sean Lee on 7/23/15.
// Copyright (c) 2015 Wanmeichuangyi. All rights reserved.
//
#import "TMCache.h"
@interface WMDocumentCache : TMCache
@end
//
// WMCache.m
// Gengmei
//
// Created by Sean Lee on 7/23/15.
// Copyright (c) 2015 Wanmeichuangyi. All rights reserved.
//
#import "WMDocumentCache.h"
NSString * const WMCacheSharedName = @"WMCacheShared";
@implementation WMDocumentCache
+ (instancetype)sharedCache{
static id cache;
static dispatch_once_t predicate;
dispatch_once(&predicate, ^{
cache = [[self alloc] initWithName:WMCacheSharedName rootPath:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]];
});
return cache;
}
@end
# GMLibrary
[![CI Status](http://img.shields.io/travis/Sean Lee/GMLibrary.svg?style=flat)](https://travis-ci.org/Sean Lee/GMLibrary)
[![Version](https://img.shields.io/cocoapods/v/GMLibrary.svg?style=flat)](http://cocoapods.org/pods/GMLibrary)
[![License](https://img.shields.io/cocoapods/l/GMLibrary.svg?style=flat)](http://cocoapods.org/pods/GMLibrary)
[![Platform](https://img.shields.io/cocoapods/p/GMLibrary.svg?style=flat)](http://cocoapods.org/pods/GMLibrary)
## Usage
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
## Installation
GMLibrary is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod "GMLibrary"
```
## Author
Sean Lee, 1240690490@qq.com
## License
GMLibrary is available under the MIT license. See the LICENSE file for more info.
../../../GMLibrary/Pod/Classes/Cache/WMCacheService.h
\ No newline at end of file
../../../GMLibrary/Pod/Classes/Cache/WMDocumentCache.h
\ No newline at end of file
../../../../../Pod/Classes/Phobos.h
\ No newline at end of file
../../../TMCache/TMCache/TMCache.h
\ No newline at end of file
../../../TMCache/TMCache/TMCacheBackgroundTaskManager.h
\ No newline at end of file
../../../TMCache/TMCache/TMDiskCache.h
\ No newline at end of file
../../../TMCache/TMCache/TMMemoryCache.h
\ No newline at end of file
{
"name": "GMPhobos",
"version": "0.0.1",
"summary": "A short description of GMPhobos.",
"description": "",
"homepage": "http://git.gengmei.cc/gengmeiios/GMPhobos",
"license": "MIT",
"authors": {
"licong": "licong@gmei.com"
},
"source": {
"git": "http://git.gengmei.cc/gengmeiios/GMPhobos.git",
"tag": "0.0.1"
},
"platforms": {
"ios": "7.0"
},
"requires_arc": true,
"source_files": "Pod/Classes/**/*",
"dependencies": {
"GMLibrary/Cache": [
"~> 0.0.1"
]
},
"libraries": "z",
"resource_bundles": {
"GMPhobos": [
"Pod/Assets/*.png"
]
}
}
PODS:
- GMLibrary/Cache (0.0.1):
- TMCache (~> 2.1.0)
- GMPhobos (0.0.1):
- GMLibrary/Cache (~> 0.0.1)
- TMCache (2.1.0)
DEPENDENCIES:
- GMPhobos (from `../`)
EXTERNAL SOURCES:
GMPhobos:
:path: "../"
SPEC CHECKSUMS:
GMLibrary: c31039ad32bc93f866d6c3052c20acb8cf9c1568
GMPhobos: 2286c03083b1944f7c9e499bbb259ae85b1bb411
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
COCOAPODS: 0.39.0
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForAnalyzing = "YES"
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES">
<BuildableReference
BuildableIdentifier = 'primary'
BlueprintIdentifier = 'C25C4D7BBE2314246CD4BD18'
BlueprintName = 'GMPhobos'
ReferencedContainer = 'container:Pods.xcodeproj'
BuildableName = 'GMPhobos.framework'>
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
buildConfiguration = "Debug"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
This diff is collapsed.
# TMCache
## Fast parallel object cache for iOS and OS X.
[![Build Status](https://img.shields.io/travis/tumblr/TMCache.svg?style=flat)](https://travis-ci.org/tumblr/XExtensionItem)
[![Version](http://img.shields.io/cocoapods/v/TMCache.svg?style=flat)](http://cocoapods.org/?q=XExtensionItem)
[![Platform](http://img.shields.io/cocoapods/p/TMCache.svg?style=flat)]()
[![License](http://img.shields.io/cocoapods/l/TMCache.svg?style=flat)](https://github.com/tumblr/XExtensionItem/blob/master/LICENSE)
[TMCache](TMCache/TMCache.h) is a key/value store designed for persisting temporary objects that are expensive to reproduce, such as downloaded data or the results of slow processing. It is comprised of two self-similar stores, one in memory ([TMMemoryCache](TMCache/TMMemoryCache.h)) and one on disk ([TMDiskCache](TMCache/TMDiskCache.h)), all backed by GCD and safe to access from multiple threads simultaneously. On iOS, `TMMemoryCache` will clear itself when the app receives a memory warning or goes into the background. Objects stored in `TMDiskCache` remain until you trim the cache yourself, either manually or by setting a byte or age limit.
`TMCache` and `TMDiskCache` accept any object conforming to [NSCoding](https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Protocols/NSCoding_Protocol/Reference/Reference.html). Put things in like this:
```objective-c
UIImage *img = [[UIImage alloc] initWithData:data scale:[[UIScreen mainScreen] scale]];
[[TMCache sharedCache] setObject:img forKey:@"image" block:nil]; // returns immediately
```
Get them back out like this:
```objective-c
[[TMCache sharedCache] objectForKey:@"image"
block:^(TMCache *cache, NSString *key, id object) {
UIImage *image = (UIImage *)object;
NSLog(@"image scale: %f", image.scale);
}];
```
`TMMemoryCache` allows for concurrent reads and serialized writes, while `TMDiskCache` serializes disk access across all instances in the app to increase performance and prevent file contention. `TMCache` coordinates them so that objects added to memory are available immediately to other threads while being written to disk safely in the background. Both caches are public properties of `TMCache`, so it's easy to manipulate one or the other separately if necessary.
Collections work too. Thanks to the magic of `NSKeyedArchiver`, objects repeated in a collection only occupy the space of one on disk:
```objective-c
NSArray *images = @[ image, image, image ];
[[TMCache sharedCache] setObject:images forKey:@"images"];
NSLog(@"3 for the price of 1: %d", [[[TMCache sharedCache] diskCache] byteCount]);
```
## Installation
### Manually
[Download the latest tag](https://github.com/tumblr/TMCache/tags) and drag the `TMCache` folder into your Xcode project.
Install the docs by double clicking the `.docset` file under `docs/`, or view them online at [cocoadocs.org](http://cocoadocs.org/docsets/TMCache/)
### Git Submodule
git submodule add https://github.com/tumblr/TMCache.git
git submodule update --init
### CocoaPods
Add [TMCache](http://cocoapods.org/?q=name%3ATMCache) to your `Podfile` and run `pod install`.
## Requirements
__TMCache__ requires iOS 5.0 or OS X 10.7 and greater.
## Contributing
Please see [CONTRIBUTING.md](https://github.com/tumblr/XExtensionItem/blob/master/CONTRIBUTING.md) for information on how to help out.
## Contact
[Bryan Irace](mailto:bryan@tumblr.com)
## License
Copyright 2013 Tumblr, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. [See the License](LICENSE.txt) for the specific language governing permissions and limitations under the License.
/**
`TMCache` is a thread safe key/value store designed for persisting temporary objects that are expensive to
reproduce, such as downloaded data or the results of slow processing. It is comprised of two self-similar
stores, one in memory (<TMMemoryCache>) and one on disk (<TMDiskCache>).
`TMCache` itself actually does very little; its main function is providing a front end for a common use case:
a small, fast memory cache that asynchronously persists itself to a large, slow disk cache. When objects are
removed from the memory cache in response to an "apocalyptic" event they remain in the disk cache and are
repopulated in memory the next time they are accessed. `TMCache` also does the tedious work of creating a
dispatch group to wait for both caches to finish their operations without blocking each other.
The parallel caches are accessible as public properties (<memoryCache> and <diskCache>) and can be manipulated
separately if necessary. See the docs for <TMMemoryCache> and <TMDiskCache> for more details.
*/
#import <Foundation/Foundation.h>
#import "TMDiskCache.h"
#import "TMMemoryCache.h"
@class TMCache;
typedef void (^TMCacheBlock)(TMCache *cache);
typedef void (^TMCacheObjectBlock)(TMCache *cache, NSString *key, id object);
@interface TMCache : NSObject
#pragma mark -
/// @name Core
/**
The name of this cache, used to create the <diskCache> and also appearing in stack traces.
*/
@property (readonly) NSString *name;
/**
A concurrent queue on which blocks passed to the asynchronous access methods are run.
*/
@property (readonly) dispatch_queue_t queue;
/**
Synchronously retrieves the total byte count of the <diskCache> on the shared disk queue.
*/
@property (readonly) NSUInteger diskByteCount;
/**
The underlying disk cache, see <TMDiskCache> for additional configuration and trimming options.
*/
@property (readonly) TMDiskCache *diskCache;
/**
The underlying memory cache, see <TMMemoryCache> for additional configuration and trimming options.
*/
@property (readonly) TMMemoryCache *memoryCache;
#pragma mark -
/// @name Initialization
/**
A shared cache.
@result The shared singleton cache instance.
*/
+ (instancetype)sharedCache;
/**
Multiple instances with the same name are allowed and can safely access
the same data on disk thanks to the magic of seriality. Also used to create the <diskCache>.
@see name
@param name The name of the cache.
@result A new cache with the specified name.
*/
- (instancetype)initWithName:(NSString *)name;
/**
The designated initializer. Multiple instances with the same name are allowed and can safely access
the same data on disk thanks to the magic of seriality. Also used to create the <diskCache>.
@see name
@param name The name of the cache.
@param rootPath The path of the cache on disk.
@result A new cache with the specified name.
*/
- (instancetype)initWithName:(NSString *)name rootPath:(NSString *)rootPath;
#pragma mark -
/// @name Asynchronous Methods
/**
Retrieves the object for the specified key. This method returns immediately and executes the passed
block after the object is available, potentially in parallel with other blocks on the <queue>.
@param key The key associated with the requested object.
@param block A block to be executed concurrently when the object is available.
*/
- (void)objectForKey:(NSString *)key block:(TMCacheObjectBlock)block;
/**
Stores an object in the cache for the specified key. This method returns immediately and executes the
passed block after the object has been stored, potentially in parallel with other blocks on the <queue>.
@param object An object to store in the cache.
@param key A key to associate with the object. This string will be copied.
@param block A block to be executed concurrently after the object has been stored, or nil.
*/
- (void)setObject:(id <NSCoding>)object forKey:(NSString *)key block:(TMCacheObjectBlock)block;
/**
Removes the object for the specified key. This method returns immediately and executes the passed
block after the object has been removed, potentially in parallel with other blocks on the <queue>.
@param key The key associated with the object to be removed.
@param block A block to be executed concurrently after the object has been removed, or nil.
*/
- (void)removeObjectForKey:(NSString *)key block:(TMCacheObjectBlock)block;
/**
Removes all objects from the cache that have not been used since the specified date. This method returns immediately and
executes the passed block after the cache has been trimmed, potentially in parallel with other blocks on the <queue>.
@param date Objects that haven't been accessed since this date are removed from the cache.
@param block A block to be executed concurrently after the cache has been trimmed, or nil.
*/
- (void)trimToDate:(NSDate *)date block:(TMCacheBlock)block;
/**
Removes all objects from the cache.This method returns immediately and executes the passed block after the
cache has been cleared, potentially in parallel with other blocks on the <queue>.
@param block A block to be executed concurrently after the cache has been cleared, or nil.
*/
- (void)removeAllObjects:(TMCacheBlock)block;
#pragma mark -
/// @name Synchronous Methods
/**
Retrieves the object for the specified key. This method blocks the calling thread until the object is available.
@see objectForKey:block:
@param key The key associated with the object.
@result The object for the specified key.
*/
- (id)objectForKey:(NSString *)key;
/**
Stores an object in the cache for the specified key. This method blocks the calling thread until the object has been set.
@see setObject:forKey:block:
@param object An object to store in the cache.
@param key A key to associate with the object. This string will be copied.
*/
- (void)setObject:(id <NSCoding>)object forKey:(NSString *)key;
/**
Removes the object for the specified key. This method blocks the calling thread until the object
has been removed.
@param key The key associated with the object to be removed.
*/
- (void)removeObjectForKey:(NSString *)key;
/**
Removes all objects from the cache that have not been used since the specified date.
This method blocks the calling thread until the cache has been trimmed.
@param date Objects that haven't been accessed since this date are removed from the cache.
*/
- (void)trimToDate:(NSDate *)date;
/**
Removes all objects from the cache. This method blocks the calling thread until the cache has been cleared.
*/
- (void)removeAllObjects;
@end
This diff is collapsed.
//
// TMCacheBackgroundTaskManager.h
// TMCache
//
// Created by Bryan Irace on 4/24/15.
// Copyright (c) 2015 Tumblr. All rights reserved.
//
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0
#import <UIKit/UIKit.h>
#else
typedef NSUInteger UIBackgroundTaskIdentifier;
#endif
/**
A protocol that classes who can begin and end background tasks can conform to. This protocol provides an abstraction in
order to avoid referencing `+ [UIApplication sharedApplication]` from within an iOS application extension.
*/
@protocol TMCacheBackgroundTaskManager <NSObject>
/**
Marks the beginning of a new long-running background task.
@return A unique identifier for the new background task. You must pass this value to the `endBackgroundTask:` method to
mark the end of this task. This method returns `UIBackgroundTaskInvalid` if running in the background is not possible.
*/
- (UIBackgroundTaskIdentifier)beginBackgroundTask;
/**
Marks the end of a specific long-running background task.
@param identifier An identifier returned by the `beginBackgroundTaskWithExpirationHandler:` method.
*/
- (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier;
@end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#import <Foundation/Foundation.h>
@interface PodsDummy_GMLibrary : NSObject
@end
@implementation PodsDummy_GMLibrary
@end
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#import <UIKit/UIKit.h>
#import "WMCacheService.h"
#import "WMDocumentCache.h"
FOUNDATION_EXPORT double GMLibraryVersionNumber;
FOUNDATION_EXPORT const unsigned char GMLibraryVersionString[];
framework module GMLibrary {
umbrella header "GMLibrary-umbrella.h"
export *
module * { export * }
}
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/GMLibrary" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
#import <Foundation/Foundation.h>
@interface PodsDummy_GMPhobos : NSObject
@end
@implementation PodsDummy_GMPhobos
@end
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#import <UIKit/UIKit.h>
#import "Phobos.h"
FOUNDATION_EXPORT double GMPhobosVersionNumber;
FOUNDATION_EXPORT const unsigned char GMPhobosVersionString[];
framework module GMPhobos {
umbrella header "GMPhobos-umbrella.h"
export *
module * { export * }
}
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/GMPhobos" "${PODS_ROOT}/Headers/Public"
OTHER_LDFLAGS = -l"z"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
This diff is collapsed.
This diff is collapsed.
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment