PHP+MySQL website cache ? Yes/No - PHP

This is a discussion on PHP+MySQL website cache ? Yes/No - PHP ; Hi, I am making an eshop and I am thinking about caching system. You understand, that it cannot be entirely cached because visitor has it's own shopping cart etc. So, my thought is to cache only few blocks like "Categories", ...

+ Reply to Thread
Results 1 to 5 of 5

PHP+MySQL website cache ? Yes/No

  1. Default PHP+MySQL website cache ? Yes/No

    Hi,
    I am making an eshop and I am thinking about caching system.

    You understand, that it cannot be entirely cached because visitor has
    it's own shopping cart etc.

    So, my thought is to cache only few blocks like "Categories",
    "Navigation menu" etc. by storing it to an HTML file.

    The advantages are that it doesn't have to query database and generate
    the HTML code again, but my question is: Is it good approach? Shouldn't
    we optimize database instead of restoring the data on harddrive?

    Thank you for ideas,
    Martin Zvarik

  2. Default RE: [PHP] PHP+MySQL website cache ? Yes/No

    MySQL has caching functions I believe. Read here:
    http://dev.mysql.com/doc/refman/5.0/en/query-cache.html

    Best regards,
    Peter Lauri

    www.dwsasia.com - company web site
    www.lauri.se - personal web site
    www.carbonfree.org.uk - become Carbon Free


    -----Original Message-----
    From: Martin Zvarík [mailto:mzvarik@gmail.com]
    Sent: Sunday, February 25, 2007 12:50 PM
    To: php-general@lists.php.net
    Subject: [PHP] PHP+MySQL website cache ? Yes/No

    Hi,
    I am making an eshop and I am thinking about caching system.

    You understand, that it cannot be entirely cached because visitor has
    it's own shopping cart etc.

    So, my thought is to cache only few blocks like "Categories",
    "Navigation menu" etc. by storing it to an HTML file.

    The advantages are that it doesn't have to query database and generate
    the HTML code again, but my question is: Is it good approach? Shouldn't
    we optimize database instead of restoring the data on harddrive?

    Thank you for ideas,
    Martin Zvarik

    --
    PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php

  3. Default Re: [PHP] PHP+MySQL website cache ? Yes/No

    I know it does, but I think it is still faster to include a generated
    HTML file than query a database. But is it worth the miliseconds?

    ---
    Peter Lauri napsal(a):
    > MySQL has caching functions I believe. Read here:
    > http://dev.mysql.com/doc/refman/5.0/en/query-cache.html
    >
    > Best regards,
    > Peter Lauri
    >
    > www.dwsasia.com - company web site
    > www.lauri.se - personal web site
    > www.carbonfree.org.uk - become Carbon Free
    >
    >
    > -----Original Message-----
    > From: Martin Zvarík [mailto:mzvarik@gmail.com]
    > Sent: Sunday, February 25, 2007 12:50 PM
    > To: php-general@lists.php.net
    > Subject: [PHP] PHP+MySQL website cache ? Yes/No
    >
    > Hi,
    > I am making an eshop and I am thinking about caching system.
    >
    > You understand, that it cannot be entirely cached because visitor has
    > it's own shopping cart etc.
    >
    > So, my thought is to cache only few blocks like "Categories",
    > "Navigation menu" etc. by storing it to an HTML file.
    >
    > The advantages are that it doesn't have to query database and generate
    > the HTML code again, but my question is: Is it good approach? Shouldn't
    > we optimize database instead of restoring the data on harddrive?
    >
    > Thank you for ideas,
    > Martin Zvarik
    >


  4. Default Re: [PHP] PHP+MySQL website cache ? Yes/No

    Are you making a single eshop for just one store, or are you planning
    on your eshop being distributed to a zillion users?...

    Cuz unless your store gets a MILLION hits, the generation of static
    HTML instead of just using PHP will probably not save you very much at
    all.

    Write the application the most straight-forward way you can, and then
    check for acceptable performance.

    If it's not acceptable, use valgrind or xdebug to find the bottleneck,
    and fix it. Repeat this step until performance is acceptable.

    Trying to "fix" your performance before you know what the bottleneck
    is, is almost always a complete waste of time/resources.

    On Sun, February 25, 2007 4:49 am, Martin Zvarík wrote:
    > Hi,
    > I am making an eshop and I am thinking about caching system.
    >
    > You understand, that it cannot be entirely cached because visitor has
    > it's own shopping cart etc.
    >
    > So, my thought is to cache only few blocks like "Categories",
    > "Navigation menu" etc. by storing it to an HTML file.
    >
    > The advantages are that it doesn't have to query database and generate
    > the HTML code again, but my question is: Is it good approach?
    > Shouldn't
    > we optimize database instead of restoring the data on harddrive?
    >
    > Thank you for ideas,
    > Martin Zvarik
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >



    --
    Some people have a "gift" link here.
    Know what I want?
    I want you to buy a CD from some starving artist.
    http://cdbaby.com/browse/from/lynch
    Yeah, I get a buck. So?

  5. Default Re: [PHP] PHP+MySQL website cache ? Yes/No


    Your cart and all that has to open a DB connection anyway.

    Unless you do something horribly wrong in DB design, running one more
    simple query is CHEAP once you pay the price of making a connection.

    Benchmark it on your hardware and find out.


    On Sun, February 25, 2007 5:06 am, Martin Zvarík wrote:
    > I know it does, but I think it is still faster to include a generated
    > HTML file than query a database. But is it worth the miliseconds?
    >
    > ---
    > Peter Lauri napsal(a):
    >> MySQL has caching functions I believe. Read here:
    >> http://dev.mysql.com/doc/refman/5.0/en/query-cache.html
    >>
    >> Best regards,
    >> Peter Lauri
    >>
    >> www.dwsasia.com - company web site
    >> www.lauri.se - personal web site
    >> www.carbonfree.org.uk - become Carbon Free
    >>
    >>
    >> -----Original Message-----
    >> From: Martin Zvarík [mailto:mzvarik@gmail.com]
    >> Sent: Sunday, February 25, 2007 12:50 PM
    >> To: php-general@lists.php.net
    >> Subject: [PHP] PHP+MySQL website cache ? Yes/No
    >>
    >> Hi,
    >> I am making an eshop and I am thinking about caching system.
    >>
    >> You understand, that it cannot be entirely cached because visitor
    >> has
    >> it's own shopping cart etc.
    >>
    >> So, my thought is to cache only few blocks like "Categories",
    >> "Navigation menu" etc. by storing it to an HTML file.
    >>
    >> The advantages are that it doesn't have to query database and
    >> generate
    >> the HTML code again, but my question is: Is it good approach?
    >> Shouldn't
    >> we optimize database instead of restoring the data on harddrive?
    >>
    >> Thank you for ideas,
    >> Martin Zvarik
    >>

    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >



    --
    Some people have a "gift" link here.
    Know what I want?
    I want you to buy a CD from some starving artist.
    http://cdbaby.com/browse/from/lynch
    Yeah, I get a buck. So?

+ Reply to Thread