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
Remove object synchronously #33
Comments
You could do implement this in user-space using a semaphore or dispatch group, no? |
You can't. The function to remove/clear objects itself is asynchronous, it will return immediately. It's no point calling that function with a semaphore or distpatch_sync. |
Ah, sorry. Did not realize there was not even a completion block. |
Do you think a completion block would be sufficient? I am not sure if I want to add sync methods for everything, since that would make the API much larger and more difficult to understand. Since the async part is backed by a serial queue, you should be able to call |
@aschuch : i think adding a completion block would be good enough. Actually i prefer this over a separate sync methods. |
One thing worth considering (and we experienced this with TMCache) is that while async by default with the ability to make synchronous using semaphores or dispatch groups seems like a great idea on paper, it ends up using more threads than synchronous by default with the ability to make asynchronous when needed does. Just food for thought. |
Actually @irace is right. Make the methods synchronous and wrap it with asynchronous when needed is much easier. That's what i usually do as well |
Please take a look at the WIP draft for AwesomeCache 3.0 #56, which will move towards a sync only API as suggested by @irace and @namanhams. Let me know what you think. |
I think it's good if we have an option to remove/clear objects synchronously.
The scenario is that i know the cache is no longer valid and i want to make sure that i don't fetch from it until i completely remove all objects.
The text was updated successfully, but these errors were encountered: