File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -650,6 +650,27 @@ - (void)test47DiskCacheExtendedData {
650
650
[self waitForExpectationsWithCommonTimeout ];
651
651
}
652
652
653
+ - (void )test48CacheUseConcurrentIOQueue {
654
+ XCTestExpectation *expectation = [self expectationWithDescription: @" SDImageCache concurrent ioQueue" ];
655
+ expectation.expectedFulfillmentCount = 2 ;
656
+
657
+ SDImageCacheConfig *config = [SDImageCacheConfig new ];
658
+ dispatch_queue_attr_t attr = dispatch_queue_attr_make_with_qos_class (DISPATCH_QUEUE_CONCURRENT, QOS_CLASS_BACKGROUND, 0 );
659
+ config.ioQueueAttributes = attr;
660
+
661
+ SDImageCache *cache = [[SDImageCache alloc ] initWithNamespace: @" Concurrent" diskCacheDirectory: @" /" config: config];
662
+ NSData *pngData = [NSData dataWithContentsOfFile: [self testPNGPath ]];
663
+ [cache queryCacheOperationForKey: @" Key1" done: ^(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType) {
664
+ expect (data).beNil ();
665
+ [expectation fulfill ];
666
+ }];
667
+ [cache storeImageData: pngData forKey: @" Key1" completion: ^{
668
+ [expectation fulfill ];
669
+ }];
670
+
671
+ [self waitForExpectationsWithCommonTimeout ];
672
+ }
673
+
653
674
#pragma mark - SDImageCache & SDImageCachesManager
654
675
- (void )test49SDImageCacheQueryOp {
655
676
XCTestExpectation *expectation = [self expectationWithDescription: @" SDImageCache query op works" ];
You can’t perform that action at this time.
0 commit comments