Merge branch 'feature/offlineFeedbackClearAppCache' into 'release/20_0_0'
Add support for removing persistent cache properly. Add support for removing persistent cache properly including the application level cache. JIRA: MVAPCT-155 Co-authored-by: Xi Zhang <xi.zhang@verizon.com> See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core/-/merge_requests/335
This commit is contained in:
commit
4bf30550ef
@ -147,6 +147,12 @@ typedef void(^MVMCoreGetImageBlock)(UIImage * _Nullable, NSData * _Nullable, BOO
|
||||
/// Clears the persistent JSON cache
|
||||
- (void)clearPersistentJSONCache;
|
||||
|
||||
// Removes a json dictionary from the cache by pageType.
|
||||
- (void)removePersistentJSONCacheForPageType:(nonnull NSString *)pageType pageJSON:(nonnull NSDictionary *)jsonDictionary;
|
||||
|
||||
// Removes a json dictionary from the cache by moduleType.
|
||||
- (void)removePersistentModuleCacheForModule:(nonnull NSString *)moduleType moduleJSON:(nonnull NSDictionary *)jsonDictionary;
|
||||
|
||||
#pragma mark Image Functions
|
||||
|
||||
/// Register a bundle as one to search for images in.
|
||||
|
||||
@ -181,6 +181,14 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
|
||||
return [[PersistentCacheManager shared] loadForKey:moduleName path:[self getPathForPersistentCacheModule:moduleName] error:&error];
|
||||
}
|
||||
|
||||
- (void)removePersistentJSONCacheForPageType:(nonnull NSString *)pageType pageJSON:(nonnull NSDictionary *)jsonDictionary {
|
||||
[[PersistentCacheManager shared] removeForKey:pageType error:nil];
|
||||
}
|
||||
|
||||
- (void)removePersistentModuleCacheForModule:(nonnull NSString *)moduleType moduleJSON:(nonnull NSDictionary *)jsonDictionary {
|
||||
[[PersistentCacheManager shared] removeForKey:moduleType error:nil];
|
||||
}
|
||||
|
||||
#pragma mark - Advanced Fetch
|
||||
|
||||
- (void)fetchJSONForPageType:(nullable NSString *)pageType queue:(nullable NSOperationQueue *)queue waitUntilFinished:(BOOL)waitUntilFinished completionHandler:(nonnull void (^)(NSDictionary * _Nullable jsonDictionary))completionHandler {
|
||||
@ -315,7 +323,7 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
|
||||
[weakSelf.pageTypeCache setObject:jsonDictionary forKey:pageType];
|
||||
|
||||
if (![self shouldPersistentlyCachePage:jsonDictionary pageType:pageType]) {
|
||||
[[PersistentCacheManager shared] removeForKey:pageType error:nil];
|
||||
[self removePersistentJSONCacheForPageType:pageType pageJSON:jsonDictionary];
|
||||
return;
|
||||
}
|
||||
[self addPageToPersistentCache:jsonDictionary pageType:pageType expirationDate:[self getExpirationDateForJSON:jsonDictionary]];
|
||||
@ -351,7 +359,7 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
|
||||
[weakSelf.moduleCache setObject:jsonDictionary forKey:module];
|
||||
|
||||
if (![self shouldPersistentlyCacheModule:jsonDictionary module:module]) {
|
||||
[[PersistentCacheManager shared] removeForKey:module error:nil];
|
||||
[self removePersistentModuleCacheForModule:module moduleJSON:jsonDictionary];
|
||||
return;
|
||||
}
|
||||
[self addModuleToPersistentCache:jsonDictionary moduleName:module expirationDate:[self getExpirationDateForJSON:jsonDictionary]];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user