metadata: do not use grabber cache if not initialised

There’s no guarantee that a non-static member will be initialised.
Make all global variable static, there is no reason to export them

Fix #12206 part 2

(cherry picked from commit 44775b1785110949ef5970cffb9acdb32fc72c92)