Scenario:
- A small number of PHP projects (e.g. websites) using APCu. Each identified by a unique id / hash, which could be e.g. 20 characters long. We call this $site_hash
below.
- Each project stores a large number of small values stored in APCu, identified by keys.
Usually one would distinguish the entries by using cache keys like this:
$value = apcu_fetch($site_hash . '|' . $key);
But one might do this one instead:
$value = apcu_fetch($key . '|' . $site_hash);
One could think that the second one is faster, because like this, a hash table lookup often only needs to look at the first few characters.
Can someone confirm this hypothesis?
(I am sure I could run this experiment myself. If I do, I will share it here.)