Optimization by storing database table in memory?

For the second case (even the first case) you might find FastGlobal an alternative approach to encapsulating data that changes infrequently and requires fast and efficient access.