RMTileCache.h
951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// TileImageCache.h
// Images
//
// Created by Joseph Gentle on 30/08/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "RMTile.h"
#import "RMTileSource.h"
@class RMTileImage;
typedef enum {
RMCachePurgeStrategyLRU,
RMCachePurgeStrategyFIFO,
} RMCachePurgeStrategy;
@protocol RMTileCache<NSObject>
// Returns the cached image if it exists. nil otherwise.
-(RMTileImage*) cachedImage:(RMTile)tile;
-(void)didReceiveMemoryWarning;
@optional
-(void)addTile: (RMTile)tile WithImage: (RMTileImage*)image;
@end
@interface RMTileCache : NSObject<RMTileCache>
{
NSMutableArray *caches;
}
-(id)initWithTileSource: (id<RMTileSource>) tileSource;
+(NSNumber*) tileHash: (RMTile)tile;
// Add tile to cache
-(void)addTile: (RMTile)tile WithImage: (RMTileImage*)image;
// Add another cache to the chain
-(void)addCache: (id<RMTileCache>)cache;
-(void)didReceiveMemoryWarning;
@end