cache: add empty path support
This avoids spurious drop offs as EMPTY is passed regardless of the
actual path name.
Pushign the work inside the lookup instead of just ignorign the flag
allows avoid checking for empty pathname for all other lookups.
(cherry picked from commit 7dd419cabc6bb9e019c56d15f8e6a88ee2f46859)