Makes the public interface thread-safe.
Adds 'remove_cache' function.