diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 17ad922..db9d151 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -361,6 +361,9 @@ loadObject.pageType = [pageJSON string:KeyPageType]; } + //Remove the pages and modules from cache + [self removeCaches:[jsonDictionary dict:@"RemoveCaches"]]; + // Sets the response info map loadObject.responseInfoMap = [jsonDictionary dict:KeyResponseInfo]; @@ -830,6 +833,20 @@ } } ++ (void)removeCaches:(nullable NSDictionary *)cacheDictionary { + + if (cacheDictionary) { + NSArray *pagesToClear = [cacheDictionary array:@"pagesToClear"]; + NSArray *modulesToClear = [cacheDictionary array:@"modulesToClear"]; + if (modulesToClear) { + [[MVMCoreCache sharedCache] removeJSONForModules:modulesToClear]; + } + [pagesToClear enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [[MVMCoreCache sharedCache] removeJSONForPageType:obj]; + }]; + } +} + #pragma mark - Presentation Delegate - (void)navigationController:(UINavigationController *)navigationController willDisplayViewController:(UIViewController *)viewController {