workflows: refactoring of holdingpen

* Implements caching for fast research sorting and else.

* Simplifies the code.

* Factorizes some code part.

Signed-off-by: Guillaume Lastecoueres <guillaume.lastecoueres@cern.ch>
Should we keep the debug timing? If yes, perhaps the output can be done through the global logger debug?