PHP variable caching

I have cached the output buffer of pages recently, but now I want to cache the values ​​of variables.

I have a PHP file that executes a bunch of MySQL queries and then populates the variables with various data from these queries.

Some of these variables will never change , but some of them will change quite often. How can I cache certain variables this way? I use file based caching if that helps.

+5
source share
4 answers

Yup, file caching is an option.

There are other options like memcache and APC

. MySQL, , - , .

+10

, , , ( ) .

file_put_contents($filename, serialize($variable));
+1

( ) serialize, - unserialize.

, memcache, , .

, mysql MEMORY ...

+1

, memcache APC , , , , .

. , Zend_Cache Zend Framework. - . , , . .

0

All Articles