feat: add Resource Cache for loading the same resource

This commit is contained in:
pengfei.zhou
2021-11-18 18:15:36 +08:00
committed by osborn
parent 5b80e4e0e1
commit 3bedd8034c
4 changed files with 38 additions and 13 deletions

View File

@@ -238,8 +238,12 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
if ([@"image" isEqualToString:name]) {
NSString *type = prop[@"type"];
NSString *identifier = prop[@"identifier"];
NSString *resId = prop[@"resId"];
DoricAsyncResult <NSData *> *asyncResult = [[self.doricContext.driver.registry.loaderManager
load:identifier withResourceType:type withContext:self.doricContext] fetchRaw];
load:resId
withIdentifier:identifier
withResourceType:type
withContext:self.doricContext] fetchRaw];
[asyncResult setResultCallback:^(NSData *imageData) {
[self.doricContext dispatchToMainQueue:^{
#if DORIC_USE_YYWEBIMAGE