Replace global Hash with TS::Cache.
Use TS::Cache instead of Mutex + Hash.

TS::Cache#compute_if_absent guarantees that only a single thread will get to execute the provided block for a given key.
Make GTG::TransTable thread safe.

From now on only the `[]=` method is allowed to modify the internal states hashes.
Merge pull request #12398 from thedarkone/thread-safety-stuff

Thread safety fixes