diff options
author | matt handler <matt.handler@gmail.com> | 2011-04-20 14:39:20 -0400 |
---|---|---|
committer | matt handler <matt.handler@gmail.com> | 2011-04-20 14:39:20 -0400 |
commit | 9d52266f823daf5cb83e3eebe1b9f57594bc9d4a (patch) | |
tree | 38402f7ddbb0f3a40ebc7c88d673756701f47510 /Classes/HJMOFileCache.h | |
download | piccast-app-9d52266f823daf5cb83e3eebe1b9f57594bc9d4a.tar.gz piccast-app-9d52266f823daf5cb83e3eebe1b9f57594bc9d4a.zip |
first commit
Diffstat (limited to 'Classes/HJMOFileCache.h')
-rwxr-xr-x | Classes/HJMOFileCache.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Classes/HJMOFileCache.h b/Classes/HJMOFileCache.h new file mode 100755 index 0000000..6cbbb24 --- /dev/null +++ b/Classes/HJMOFileCache.h @@ -0,0 +1,62 @@ +// +// HJFiler.h +// hjlib +// +// Copyright Hunter and Johnson 2009, 2010, 2011 +// HJCache may be used freely in any iOS or Mac application free or commercial. +// May be redistributed as source code only if all the original files are included. +// See http://www.markj.net/hjcache-iphone-image-cache/ + +#import <Foundation/Foundation.h> + +/* + Provides file caching for the object manager. Its able to trim its size so it + doesn't grow forever. See also HJBigFileCache. + */ + +@interface HJMOFileCache : NSObject { + + NSString* rootPath; + NSString* loadingPath; + NSString* readyPath; + NSString* countsPath; + + BOOL isCounting; + BOOL isLRU; + long fileCount; + long long byteCount; + + long fileCountLimit; + NSTimeInterval fileAgeLimit; + NSThread* maintenanceThread; +} + +@property long fileCount; +@property long long byteCount; +@property long fileCountLimit; +@property NSTimeInterval fileAgeLimit; +@property (nonatomic, retain) NSThread* maintenanceThread; + +-(HJMOFileCache*)initWithRootPath:(NSString*)root; +-(HJMOFileCache*)initWithRootPath:(NSString*)root + isCounting:(BOOL)isCounting + fileCountLimit:(long)countLimit + fileAgeLimit:(NSTimeInterval)ageLimit; + +-(void)createCacheDirsIfNeeded; + +-(NSString*)filenameForOid:(id)oid; +-(NSString*)readyFilePathForOid:(id)oid; +-(NSString*)loadingFilePathForOid:(id)oid; +-(NSString*)loadingFinishedForOid:(id)oid; +-(void)removeOid:(id)oid; + +-(void) deleteAllFilesInDir:(NSString*)path; +-(void) emptyCache; +-(void) saveCounts; +-(void) loadCounts; +-(void)trimCache; +-(void)trimCacheUsingBackgroundThread; +-(void)trimCacheDir:(NSString*)cachePath; + +@end |