How do I get the cache string? In Drupal 8, CSS files, images and many other files, are cached by appending a token at the end, as in /sites/default/files/styles/lrg_thumbnail/public/p2i-product_1_zoomout.png?itok=DroPCbms. 

Notice the itok=DroPCbms part.

What Drupal function returns this code?
Contrary to CSS/JS the itok is not for caching, but for DoS protection, see this question
Why are tokens added to image URLs?

The token is generated in
https://api.drupal.org/api/drupal/core%21modules%21image%21src%21Entity%21ImageStyle.php/function/ImageStyle%3A%3AgetPathToken/8.2.x