This kind of variable caching only works for variables that are filled at startup and never changes. Once the server is running it has a number of distinct interpreters that do not share global variables.
Try to use "nsv_set collection_name var_name var_value" and "nsv_get collection_name var_name" instead.