Where does APC store data?

I want to use apc_store()

to cache some of the results.

But I need to know where the data will be stored and what the limit is.

Is it always stored in memory? Or does it also write to disk? I would prefer that data that is not accessed very often is stored on disk. Should I use a different caching system for this?

Is this the limit? apc.shm_size = 32MB

... If so, what happens when I surpass him?

+3


source to share


3 answers


Data stored in the APC variable cache via apc_store()

is always stored in memory. If you need to store more data than makes sense, you need to come up with some other caching solution.



The configuration directive apc.shm_size

sets the size of the APC shared memory cache, which is used for both opcodes and user variables. If you write more data to the cache than listed here, items will be removed from the cache starting with the least recently used. Your code should be able to handle this - it's a cache, by the way, not a database.

+9


source


APC will keep it in memory.

you can set the size you want to use using apc.shm_size



This is a link explaining how APC works. http://lampzone.wordpress.com/2010/03/26/how-does-apc-work/

And a list of all APC settings http://php.net/manual/en/apc.configuration.php

+3


source


APC always stores data in memory, it is for this and nothing else. You cannot write APC data to disk, but you can of course implement several different storage adapters for your caching needs. If you want some things to be saved to disk, use a file adapter. The various size settings are how much memory you allocate to APC, and if you exceed that, APC will start to reset the LIFO. This should only affect your performance and nothing else. Your application should work with or without cache. If not, you are abusing the idea of ​​caching for persistence.

+2


source







All Articles