Get the Root Contect ID from flow/java


I wonder if its possible to get the current Root Context ID (what you see in the Audit Log) from flow or java?

The reason is that I want to cache some data and use it later on in the execution chain (using savePipeLine). If I set the $name (savePipeLine input) to the current Root Context ID, I´m certain that no other service can access that data.

Or is there another way to cache some data so that it is only accessible from the current exeution chain? i.e. when the root service is finished, the cached data is gone.

Any help is appreciated