Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between apc_add and apc_store?

Tags:

php

caching

apc

I don't see any in the PHP docs:

http://www.php.net/manual/en/function.apc-store.php

http://www.php.net/manual/en/function.apc-add.php

Am I missing something here? When should I use each one?

And why are there two usage definitions, one returs true and one returns array?

like image 808
Alex Avatar asked Dec 08 '11 23:12

Alex


1 Answers

So the docs say that apc_store does Cache a variable in the data store and apc_add does Caches a variable in the data store, only if it's not already stored.. Notice the last part - "only if it's not already stored. So apc_store simply overwrites existing values already stored.

The second part is a array with errors.

Returns TRUE on success or FALSE on failure. Second syntax returns array with error keys.

like image 171
Jan Dragsbaek Avatar answered Nov 04 '22 03:11

Jan Dragsbaek