code: public void cacheStatements(Closure closure) throws SQLException {
          boolean savedCacheStatements = cacheStatements;
          cacheStatements = true;
          Connection connection = null;
          try {
              connection = createConnection();
              callClosurePossiblyWithConnection(closure, connection);
          } finally {
              cacheStatements = false;
              closeResources(connection, null);
              cacheStatements = savedCacheStatements;
          }
      }
docs: Caches every created preparedStatement in Closure <i>closure</i>
  Every cached preparedStatement is closed after closure has been called.
  If the closure takes a single argument, it will be called
  with the connection, otherwise it will be called with no arguments.
  
  @param closure the given closure
  @throws SQLException if a database error occurs
  @see #setCacheStatements(boolean)