Alex
Alex

Reputation: 68470

Difference between apc_add and apc_store?

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?

Upvotes: 7

Views: 1620

Answers (1)

Jan Dragsbaek
Jan Dragsbaek

Reputation: 8101

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.

Upvotes: 8

Related Questions