improve cache performance (CPU & mem)

see https://github.com/doctrine/orientdb-odm/commit/df875c946e02a9c84eee22f0c86e0a3b06bd70ec#commitcomment-2500697

I have preferred to keep unrolled code over factorization to keep perf optimal, let me know if you prefer to have a unique `static fromCache()`.

/cc @odino