From d0621c51bb889b7904797a4bb4924ebc550c1aad Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 14 Feb 2019 16:59:40 -0500 Subject: [PATCH] give server cache control --- MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m index 68cc85d..a52bc7c 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m @@ -218,7 +218,10 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt"; } // Adds json to cache with page type key. - [weakSelf.pageTypeCache setObject:jsonDictionary forKey:pageType]; + NSNumber *shouldCache = [jsonDictionary objectForKey:@"cache" ofType:[NSNumber class]]; + if (!shouldCache || shouldCache.boolValue) { + [weakSelf.pageTypeCache setObject:jsonDictionary forKey:pageType]; + } } } if (completionBlock) { @@ -250,9 +253,12 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt"; // Create the cache if necessary. weakSelf.moduleCache = [NSMutableDictionary dictionary]; } - + // Adds json to cache with page type key. - [weakSelf.moduleCache setObject:obj forKey:key]; + NSNumber *shouldCache = [jsonDictionary objectForKey:@"cache" ofType:[NSNumber class]]; + if (!shouldCache || shouldCache.boolValue) { + [weakSelf.moduleCache setObject:obj forKey:key]; + } } }]; }