Authored by Justin R. Miller

more tile cache key instance fixes

@@ -33,6 +33,7 @@ @@ -33,6 +33,7 @@
33 { 33 {
34 NSString *_mapsKey; 34 NSString *_mapsKey;
35 NSString *_imageURLString; 35 NSString *_imageURLString;
  36 + NSString *_uniqueTilecacheKey;
36 RMBingImagerySet _imagerySet; 37 RMBingImagerySet _imagerySet;
37 } 38 }
38 39
@@ -49,6 +50,8 @@ @@ -49,6 +50,8 @@
49 50
50 _imagerySet = imagerySet; 51 _imagerySet = imagerySet;
51 52
  53 + _uniqueTilecacheKey = [NSString stringWithFormat:@"Bing%lu", (unsigned long)_imagerySet];
  54 +
52 self.minZoom = 1; 55 self.minZoom = 1;
53 self.maxZoom = 21; 56 self.maxZoom = 21;
54 57
@@ -123,7 +126,7 @@ @@ -123,7 +126,7 @@
123 126
124 - (NSString *)uniqueTilecacheKey 127 - (NSString *)uniqueTilecacheKey
125 { 128 {
126 - return [NSString stringWithFormat:@"Bing%lu", (unsigned long)_imagerySet]; 129 + return _uniqueTilecacheKey;
127 } 130 }
128 131
129 - (NSString *)shortName 132 - (NSString *)shortName
@@ -42,6 +42,7 @@ @@ -42,6 +42,7 @@
42 @implementation RMMBTilesSource 42 @implementation RMMBTilesSource
43 { 43 {
44 RMFractalTileProjection *tileProjection; 44 RMFractalTileProjection *tileProjection;
  45 + NSString *_uniqueTilecacheKey;
45 } 46 }
46 47
47 @synthesize cacheable = _cacheable, opaque = _opaque; 48 @synthesize cacheable = _cacheable, opaque = _opaque;
@@ -71,6 +72,8 @@ @@ -71,6 +72,8 @@
71 if ( ! queue) 72 if ( ! queue)
72 return nil; 73 return nil;
73 74
  75 + _uniqueTilecacheKey = [NSString stringWithFormat:@"MBTiles%@", [queue.path lastPathComponent]];
  76 +
74 [queue inDatabase:^(FMDatabase *db) { 77 [queue inDatabase:^(FMDatabase *db) {
75 [db setShouldCacheStatements:YES]; 78 [db setShouldCacheStatements:YES];
76 }]; 79 }];
@@ -330,7 +333,7 @@ @@ -330,7 +333,7 @@
330 333
331 - (NSString *)uniqueTilecacheKey 334 - (NSString *)uniqueTilecacheKey
332 { 335 {
333 - return [NSString stringWithFormat:@"MBTiles%@", [queue.path lastPathComponent]]; 336 + return _uniqueTilecacheKey;
334 } 337 }
335 338
336 - (NSString *)shortName 339 - (NSString *)shortName
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 41
42 @property (nonatomic, strong) NSDictionary *infoDictionary; 42 @property (nonatomic, strong) NSDictionary *infoDictionary;
43 @property (nonatomic, strong) NSString *tileJSON; 43 @property (nonatomic, strong) NSString *tileJSON;
44 -@property (nonatomic, strong) NSString *cacheKey; 44 +@property (nonatomic, strong) NSString *uniqueTilecacheKey;
45 45
46 @end 46 @end
47 47
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 49
50 @implementation RMMapboxSource 50 @implementation RMMapboxSource
51 51
52 -@synthesize infoDictionary=_infoDictionary, tileJSON=_tileJSON, imageQuality=_imageQuality, dataQueue=_dataQueue; 52 +@synthesize infoDictionary=_infoDictionary, tileJSON=_tileJSON, imageQuality=_imageQuality, dataQueue=_dataQueue, uniqueTilecacheKey=_uniqueTilecacheKey;
53 53
54 - (id)init 54 - (id)init
55 { 55 {
@@ -85,7 +85,7 @@ @@ -85,7 +85,7 @@
85 85
86 _tileJSON = tileJSON; 86 _tileJSON = tileJSON;
87 87
88 - _cacheKey = [NSString stringWithFormat:@"Mapbox-%@%@", [_infoDictionary objectForKey:@"id"], ([_infoDictionary objectForKey:@"version"] ? [@"-" stringByAppendingString:[_infoDictionary objectForKey:@"version"]] : @"")]; 88 + _uniqueTilecacheKey = [NSString stringWithFormat:@"Mapbox-%@%@", [_infoDictionary objectForKey:@"id"], ([_infoDictionary objectForKey:@"version"] ? [@"-" stringByAppendingString:[_infoDictionary objectForKey:@"version"]] : @"")];
89 89
90 id dataObject = nil; 90 id dataObject = nil;
91 91
@@ -355,7 +355,7 @@ @@ -355,7 +355,7 @@
355 355
356 - (NSString *)uniqueTilecacheKey 356 - (NSString *)uniqueTilecacheKey
357 { 357 {
358 - return self.cacheKey; 358 + return self.uniqueTilecacheKey;
359 } 359 }
360 360
361 - (NSString *)shortName 361 - (NSString *)shortName