Add thread_safe as a gem dependency
Change inference cache to be a threadsafe Hash