Caching with php file [closed]

我怕爱的太早我们不能终老 提交于 2019-12-08 14:20:34

问题


I am creating a php script with simple coding. I don't have much knowledge about caching. But have heard that there are object caching, Database Caching which will improve load time.

e.g., I have a sample php query, how can I enable database caching and please also tell me some basics about object caching.

$test="
SELECT *, 
       Sum(sellprice*quantity) + tips AS amount, 
       receiptdetails.name            AS personname 
FROM   cart, 
       cartproduct, 
       receiptdetails, 
       receipt, 
       product 
WHERE  cart.ID = cartproduct.cartid 
       AND receiptdetails.cartid = cart.ID 
       AND receipt.cartid = cart.ID 
       AND product.ID = cartproduct.productid 
GROUP  BY cart.ID
";

回答1:


The most popular way is to use Memcached for caching. Basically it is just a key-value storage engine that cache values in RAM. Your application can make use of it to cache values to reduce the needs for querying DB every time.

You can take a look at the PHP's Memcached extension on how to use PHP with Memcached.



来源:https://stackoverflow.com/questions/24719391/caching-with-php-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!