Search code examples
phpapc

apc_add() versus apc_store()


I know that apc_store() overwrites the key if it already exists, so I know the difference, my question is just: What's the better method/best practice?


Solution

  • The only difference between those two functions is that apc_add() will not overwrite an existing entry.
    apc_store(), on the other hand, will overwrite an existing entry.

    So, which one should your use, between apc_add() and apc_store() ?
    Well, it all depends on your needs : do you want an existing entry to be overwritten, or not ?