You should go with the simplest solution and just pull the data from the database. If you have say 10 categories on 500 products then this would be 50 records each time - which is a tiny amount of work for any database. Also keep in mind that the database will cache any frequently accessed data so it will be kept in memory anyway.
Writing code to do the caching for yourself is just wasted effort - you'll be trying to solving a problem that doesn't really exist. You'll just end up with complex code, more bugs and no real gain.
You'd also do much better to use
permanent connections (assuming PHP) to the database rather than disconnecting each time.
Always go with the simple solution.
Mike
EDIT : sorry Ronnyy - you must have posted this info will I was writing.