Multi-Index Cache, Revisited

When I set out to do the multi-index cache, it occurred to me that instead of using the secondary indexes as mappings to the primary index, I could just store another reference to the same object.

I don’t know why I didn’t choose to do it that way, but now that I’ve been thinking about it for a while, I don’t see why not. It would eliminate a second lookup, and I can’t think of any adverse affects.

So, if there are 3 indexes, then instead of storing one object reference and 3 keys, we store three object references and three keys.

The next time I’m in there, I’ll change it and see if I’m forgetting anything. The API doesn’t change at all, just the innards.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: