phphostingeaccelerator

PHP variable caching


I have some data in MySQL database that are static most of the time. They are mainly almost static values like cities, states, and ethnic. I want to cache them in a variable, preferebly in memory, so that I won't need to perform another query to MySQL every time a page loads.

The problem is, my hosting doesn't support memcache nor APC. The only accelerator I could find is eAccelerator, and I don't think it will do what I have in mind.

Is there any way I can do caching? It is http://www.k-disk.net

Thank you


Solution

  • You can use the Shared Memory extension.

    Look this basic sample: http://www.php.net/manual/en/shmop.examples-basic.php