Skip to content

Commit 94e5b0e

Browse files
nguyenhuygarrettmoon
authored andcommitted
Update memory cache to perform some tasks such as trimming and removing experied objects with low priority (#234)
* Update memory cache to perform some tasks such as trimming and removing experied objects with low priority * Update CHANGELOG * Small change
1 parent d7145a4 commit 94e5b0e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- [performance] Return TTL cache objects without waiting for all metadata to be read. [#228]
66
(https://github.com/pinterest/PINCache/pull/228)
7+
- [performance] Memory cache now performs some tasks such as trimming and removing experied objects with low priority. [#234](https://github.com/pinterest/PINCache/pull/234)
78

89
## 3.0.1 -- Beta 7
910
- [fix] Fix up warnings and upgrade to PINOperation 1.1.1: [#213](https://github.com/pinterest/PINCache/pull/213)

Source/PINMemoryCache.m

+8-8
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ - (void)trimToAgeLimitRecursively
310310
if (shouldReschedule) {
311311
[self.operationQueue scheduleOperation:^{
312312
[self trimToAgeLimitRecursively];
313-
} withPriority:PINOperationQueuePriorityHigh];
313+
} withPriority:PINOperationQueuePriorityLow];
314314
}
315315
});
316316
}
@@ -374,7 +374,7 @@ - (void)removeObjectForKeyAsync:(NSString *)key completion:(PINCacheObjectBlock)
374374

375375
if (block)
376376
block(self, key, nil);
377-
} withPriority:PINOperationQueuePriorityHigh];
377+
} withPriority:PINOperationQueuePriorityLow];
378378
}
379379

380380
- (void)trimToDateAsync:(NSDate *)trimDate completion:(PINCacheBlock)block
@@ -384,7 +384,7 @@ - (void)trimToDateAsync:(NSDate *)trimDate completion:(PINCacheBlock)block
384384

385385
if (block)
386386
block(self);
387-
} withPriority:PINOperationQueuePriorityHigh];
387+
} withPriority:PINOperationQueuePriorityLow];
388388
}
389389

390390
- (void)trimToCostAsync:(NSUInteger)cost completion:(PINCacheBlock)block
@@ -394,7 +394,7 @@ - (void)trimToCostAsync:(NSUInteger)cost completion:(PINCacheBlock)block
394394

395395
if (block)
396396
block(self);
397-
} withPriority:PINOperationQueuePriorityHigh];
397+
} withPriority:PINOperationQueuePriorityLow];
398398
}
399399

400400
- (void)trimToCostByDateAsync:(NSUInteger)cost completion:(PINCacheBlock)block
@@ -404,7 +404,7 @@ - (void)trimToCostByDateAsync:(NSUInteger)cost completion:(PINCacheBlock)block
404404

405405
if (block)
406406
block(self);
407-
} withPriority:PINOperationQueuePriorityHigh];
407+
} withPriority:PINOperationQueuePriorityLow];
408408
}
409409

410410
- (void)removeExpiredObjectsAsync:(PINCacheBlock)block
@@ -414,7 +414,7 @@ - (void)removeExpiredObjectsAsync:(PINCacheBlock)block
414414

415415
if (block)
416416
block(self);
417-
} withPriority:PINOperationQueuePriorityHigh];
417+
} withPriority:PINOperationQueuePriorityLow];
418418
}
419419

420420
- (void)removeAllObjectsAsync:(PINCacheBlock)block
@@ -424,7 +424,7 @@ - (void)removeAllObjectsAsync:(PINCacheBlock)block
424424

425425
if (block)
426426
block(self);
427-
} withPriority:PINOperationQueuePriorityHigh];
427+
} withPriority:PINOperationQueuePriorityLow];
428428
}
429429

430430
- (void)enumerateObjectsWithBlockAsync:(PINCacheObjectEnumerationBlock)block completionBlock:(PINCacheBlock)completionBlock
@@ -434,7 +434,7 @@ - (void)enumerateObjectsWithBlockAsync:(PINCacheObjectEnumerationBlock)block com
434434

435435
if (completionBlock)
436436
completionBlock(self);
437-
} withPriority:PINOperationQueuePriorityHigh];
437+
} withPriority:PINOperationQueuePriorityLow];
438438
}
439439

440440
#pragma mark - Public Synchronous Methods -

0 commit comments

Comments
 (0)