mirror of
https://github.com/danog/Telegram.git
synced 2024-12-02 09:27:55 +01:00
64 lines
2.3 KiB
Objective-C
64 lines
2.3 KiB
Objective-C
/*
|
|
* This is the source code of Telegram for iOS v. 1.1
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
*
|
|
* Copyright Peter Iakovlev, 2013.
|
|
*/
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
typedef enum {
|
|
TGCacheMemory = 1,
|
|
TGCacheDisk = 2,
|
|
TGCacheBoth = 1 | 2
|
|
} TGCacheLocation;
|
|
|
|
typedef UIImage *(^TGCacheJpegDecodingBlock)(NSData *data);
|
|
|
|
@interface TGCache : NSObject
|
|
|
|
@property (nonatomic) int imageMemoryLimit;
|
|
@property (nonatomic) int imageMemoryEvictionInterval;
|
|
|
|
@property (nonatomic) int thumbnailMemoryLimit;
|
|
@property (nonatomic) int thumbnailEvictionInterval;
|
|
@property (nonatomic) int thumbnailBackgroundBaseline;
|
|
|
|
@property (nonatomic) int dataMemoryLimit;
|
|
@property (nonatomic) int dataMemoryEvictionInterval;
|
|
|
|
@property (nonatomic) int memoryWarningBaseline;
|
|
@property (nonatomic) int backgroundBaseline;
|
|
|
|
@property (nonatomic) int diskLimit;
|
|
@property (nonatomic) int diskEvictionInterval;
|
|
|
|
@property (nonatomic, strong, readonly) NSString *diskCachePath;
|
|
|
|
+ (dispatch_queue_t)diskCacheQueue;
|
|
+ (NSFileManager *)diskFileManager;
|
|
|
|
- (void)addTemporaryCachedImagesSource:(NSDictionary *)source autoremove:(bool)autoremove;
|
|
- (void)removeTemporaryCachedImageSource:(NSDictionary *)source;
|
|
|
|
- (void)cacheImage:(UIImage *)image withData:(NSData *)data url:(NSString *)url availability:(int)availability;
|
|
- (void)cacheImage:(UIImage *)image withData:(NSData *)data url:(NSString *)url availability:(int)availability completion:(void (^)(void))completion;
|
|
- (UIImage *)cachedImage:(NSString *)url availability:(int)availability;
|
|
- (void)removeFromMemoryCache:(NSString *)url matchEnd:(bool)matchEnd;
|
|
- (NSString *)pathForCachedData:(NSString *)url;
|
|
|
|
- (void)cacheThumbnail:(UIImage *)image url:(NSString *)url;
|
|
- (UIImage *)cachedThumbnail:(NSString *)url;
|
|
|
|
- (void)diskCacheContains:(NSString *)url1 orUrl:(NSString *)url2 completion:(void (^)(bool containsFirst, bool containsSecond))completion;
|
|
- (bool)diskCacheContainsSync:(NSString *)url;
|
|
- (void)removeFromDiskCache:(NSString *)url;
|
|
- (void)changeCacheItemUrl:(NSString *)oldUrl newUrl:(NSString *)newUrl;
|
|
- (void)moveToCache:(NSString *)fileUrl cacheUrl:(NSString *)cacheUrl;
|
|
- (void)clearCache:(int)availability;
|
|
- (NSArray *)storeMemoryCache;
|
|
- (void)restoreMemoryCache:(NSArray *)urlArray;
|
|
|
|
@end
|