Add support to remove cache properly
This commit is contained in:
parent
d26e2d52ba
commit
8dff91ec28
@ -134,6 +134,13 @@ typedef void(^MVMCoreGetImageBlock)(UIImage * _Nullable, NSData * _Nullable, BOO
|
||||
// Clears the page and module data.
|
||||
- (void)clearMFCache;
|
||||
|
||||
// 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 pageType.
|
||||
- (void)removePersistentModuleCacheForModule:(nonnull NSString *)moduleType moduleJSON:(nonnull NSDictionary *)jsonDictionary;
|
||||
|
||||
|
||||
#pragma mark - Advanced Deletion
|
||||
|
||||
// Removes a json dictionary from the cache by pageType. Pass in the block that you want to run once the dictionary is received and which queue to run it on. Pass in if you'd like the current thread to wait.
|
||||
|
||||
@ -330,7 +330,7 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
|
||||
}
|
||||
|
||||
if (![self shouldPersistentlyCachePage:jsonDictionary pageType:pageType]) {
|
||||
[[PersistentCacheManager shared] removeForKey:pageType error:nil];
|
||||
[self removePersistentJSONCacheForPageType:pageType pageJSON:jsonDictionary];
|
||||
return;
|
||||
}
|
||||
|
||||
@ -367,7 +367,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]];
|
||||
@ -433,6 +433,15 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
|
||||
}]];
|
||||
}
|
||||
|
||||
- (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 Deletion
|
||||
|
||||
- (void)removeJSONForPageType:(nonnull NSString *)pageType queue:(nullable NSOperationQueue *)queue waitUntilFinished:(BOOL)waitUntilFinished completionBlock:(nullable void (^)(void))completionBlock {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user