Skip to content
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

When an object in PINMemoryCache is replaced, willRemove and didRemove blocks aren't called #94

Open
davehakim opened this issue Jun 24, 2016 · 0 comments
Assignees
Labels
Milestone

Comments

@davehakim
Copy link
Contributor

When an object in PINMemoryCache is replaced, the willRemoveObjectBlock and the didRemoveObjectBlock for the old object aren't called.

They are called in most other cases when an object is removed via a call to removeObjectAndExecuteBlocksForKey. This happens in

removeObjectForKey

And when trimming in

trimMemoryToDate trimToCostLimit trimToCostLimitByDate

But they aren't called in ALL other cases. They are not called in the case of removing ALL objects. In that case willRemoveAllObjectsBlock and didRemoveAllObjectsBlock blocks are called instead.

Also worth noting, if trimToDate is given a date of distantPast (should this be distantFuture ?) it will call removeAll instead of the normal trim hence also skipping calls to the willRemove/didRemove blocks

Anyways, with that background in mind, should the blocks be called in the case when an object is replaced ?

And what about when an object in the cache is replaced with an object it is .equal() to ?

@garrettmoon garrettmoon self-assigned this Sep 21, 2016
@garrettmoon garrettmoon added this to the 3.0 milestone Jan 20, 2017
@garrettmoon garrettmoon added the bug label Oct 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants