give server cache control

This commit is contained in:
Pfeil, Scott Robert 2019-02-14 16:59:40 -05:00
parent 2259725d7a
commit d0621c51bb

View File

@ -218,9 +218,12 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
} }
// Adds json to cache with page type key. // Adds json to cache with page type key.
NSNumber *shouldCache = [jsonDictionary objectForKey:@"cache" ofType:[NSNumber class]];
if (!shouldCache || shouldCache.boolValue) {
[weakSelf.pageTypeCache setObject:jsonDictionary forKey:pageType]; [weakSelf.pageTypeCache setObject:jsonDictionary forKey:pageType];
} }
} }
}
if (completionBlock) { if (completionBlock) {
[(queue ?: weakSelf.completionQueue) addOperations:@[[NSBlockOperation blockOperationWithBlock:completionBlock]] waitUntilFinished:waitUntilFinished]; [(queue ?: weakSelf.completionQueue) addOperations:@[[NSBlockOperation blockOperationWithBlock:completionBlock]] waitUntilFinished:waitUntilFinished];
} }
@ -252,8 +255,11 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
} }
// Adds json to cache with page type key. // Adds json to cache with page type key.
NSNumber *shouldCache = [jsonDictionary objectForKey:@"cache" ofType:[NSNumber class]];
if (!shouldCache || shouldCache.boolValue) {
[weakSelf.moduleCache setObject:obj forKey:key]; [weakSelf.moduleCache setObject:obj forKey:key];
} }
}
}]; }];
} }
if (completionBlock) { if (completionBlock) {