PHP cache mysql or complete html?

392 views Asked by At

worth the set cache html code or just mysql (serialize)?

the full HTML should reduce load time without re-implementation of the php script if I'm wrong. Do you know of some other disadvantages?

//Use html to serialize cache or another option?

3

There are 3 answers

2
Martin Rothenberger On BEST ANSWER

Nothing is faster than plain HTML pages, so go for both cache solutions. But as Alfred said, you should use APC instead of MySQL as serialized cache. Also, you should take advantage of the MySQL query cache.

Further on, checkout memcached and/or Redis as alternative for storing values which need to be stored and retrieved very often.

EDIT: Just another idea to gain more performance - store your HTML files using a tmpfs (RAM based) filesystem. If something is faster than pure HTML files, then it can only be pure HTML files served via RAM disk. ;)

0
Peter Cetinski On

Use both. HTML caching is critical in high-volume PHP sites.

2
Alfred On

You should set expire headers on all your assets. Furthermore if possible use APC instead of mysql cache. If not possible to use APC, then you could use MySQL query cache like you said(I assume you meant this), but it is not as solid as APC.