Fix deadlocking issues in TMMemoryCache related to thread starvation

1. Re-architected everything to be synchronous by default and asynchronous methods are simply wrapped versions of the synchronous ones.
2. Changed TMMemoryCache to use pthread_locks instead of dispatch_queues to protect resources (this is where we lose our performance, context switching is faster than locks).
3. Added an integration test which shows the deadlocking (but passes with the above changes).

This results in a slight performance degradation, but it resolves deadlocking issues. Would love to get feedback on this or hear other ideas for resolving the issue.