Albeit being relevant to SEO, it’s actually a webdev question. What tech are you utilizing? If it’s wordpress, there should be plugins capable of supporting you. If it’s either a self-written website/application or build with a framework (like Zend Framework), either take a look at already existing libraries/code segments you can utilize for caching, or develop a lightweight caching option yourself.
But without having more information it’s pretty hard to give you any supportive advise.