The "best" way is a very loaded term, and the answer may be highly dependent on factors not known until runtime.
- Do you have plenty of memory? - you will get better performance with an "all-in-memory" data structure, but if you do not have enough memory swapping will kill your performance.
- Do you need persistance? A database gives integrity but is slower than the above "all-in-memory" data structure. MUCH slower.
- Can you cache results? Varnish can help with that! http://www.varnish-cache.org/
The list goes on and on.
What you can do, is to write "the simplest thing that could possibly work" from the knowledge you currently do have, and do it in a modular fashion so you can easily reorganize when you know more. Note that the "simplest" thing is not necessarily simple!