How to disable all caches in safari 11?
In the Web Inspector, under the Network tab, unselect ‘Use the resource cache when loading resources’. Blue means the cache is not used, black means the cache is used.

                                                

As you wished, this only takes effect when the web inspector is open. Note that this is a cache bypass, not a permanent ‘cache empty’, so when you un-bypass the cache, any cache from prior to the bypass will be used. To use the latest resources with the web inspector closed, empty the cache using the button to the right or Develop → Empty Caches (⌥⌘E).

Currently, in Safari Technology Preview there is a re-designed Network tab in the Web Inspector with a new cache bypass icon, which I expect to make its way to Safari soon.