I'm implementing object caching in a PHP application using APC.
The issue is, that sometimes I will select something from the database based on different criteria. For instance, when a user logs into the web site, all I have is his username and password, so I'm going to select from the database based on the username.
In other situations, I'll have the user ID, and want to select based off of that.
Each time I select a user, I'd like to add the object to the cache.
So let's say I put it in there once with the key "User.user_id.123" and once with "User.user_name.JoeSmith".
This does, however, mean that I've just put the same object into my cache twice, right? That doesn't seem so efficient.
Is there a way to put one object into an APC cache with multiple keys for finding it later?