made statement cache thread-safe