Skip to content

Update memory cache to perform some tasks such as trimming and removing experied objects with low priority #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [performance] Return TTL cache objects without waiting for all metadata to be read. [#228]
(https://github.com/pinterest/PINCache/pull/228)
- [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)

## 3.0.1 -- Beta 7
- [fix] Fix up warnings and upgrade to PINOperation 1.1.1: [#213](https://github.com/pinterest/PINCache/pull/213)
Expand Down
16 changes: 8 additions & 8 deletions Source/PINMemoryCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ - (void)trimToAgeLimitRecursively
if (shouldReschedule) {
[self.operationQueue scheduleOperation:^{
[self trimToAgeLimitRecursively];
} withPriority:PINOperationQueuePriorityHigh];
} withPriority:PINOperationQueuePriorityLow];
}
});
}
Expand Down Expand Up @@ -374,7 +374,7 @@ - (void)removeObjectForKeyAsync:(NSString *)key completion:(PINCacheObjectBlock)

if (block)
block(self, key, nil);
} withPriority:PINOperationQueuePriorityHigh];
} withPriority:PINOperationQueuePriorityLow];
}

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

if (block)
block(self);
} withPriority:PINOperationQueuePriorityHigh];
} withPriority:PINOperationQueuePriorityLow];
}

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

if (block)
block(self);
} withPriority:PINOperationQueuePriorityHigh];
} withPriority:PINOperationQueuePriorityLow];
}

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

if (block)
block(self);
} withPriority:PINOperationQueuePriorityHigh];
} withPriority:PINOperationQueuePriorityLow];
}

- (void)removeExpiredObjectsAsync:(PINCacheBlock)block
Expand All @@ -414,7 +414,7 @@ - (void)removeExpiredObjectsAsync:(PINCacheBlock)block

if (block)
block(self);
} withPriority:PINOperationQueuePriorityHigh];
} withPriority:PINOperationQueuePriorityLow];
}

- (void)removeAllObjectsAsync:(PINCacheBlock)block
Expand All @@ -424,7 +424,7 @@ - (void)removeAllObjectsAsync:(PINCacheBlock)block

if (block)
block(self);
} withPriority:PINOperationQueuePriorityHigh];
} withPriority:PINOperationQueuePriorityLow];
}

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

if (completionBlock)
completionBlock(self);
} withPriority:PINOperationQueuePriorityHigh];
} withPriority:PINOperationQueuePriorityLow];
}

#pragma mark - Public Synchronous Methods -
Expand Down