Search code examples
phpapc

Differences between php apc and template caching


Hi guys im a bit confuse with Apc and template caching.
By i mean template caching is something like smarty caching functionality.
Basically what is the difference between both of them


Solution

  • APC cache is to compile php script into executable binary op-code and used it later.

    In short, compile once, stored into memory, and reusable until time-to-live ended, or until file get updated.

    Despite this major usage, APC also can used to store run-time variables into memory (you can treat this as global session for everyone accessing the same page)


    While smarty caching technically is not a binary op-code cache, PHP binary still need to convert it to binary op-code every time it get executed.

    What benefits of smarty caching as is it will stored the rendered HTML/output into disk (or you can save the output into APC, the second usage)

    Which mean, it save the execution cycle instead of compilation cycle