Try to make mini_cache operation thread safe.