ใช้ Zend_Cache ใน Zend Framework มาทำ Cache ใช้กันดีกว่า

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: ใช้ Zend_Cache ใน Zend Framework มาทำ Cache ใช้กันดีกว่า

Re: ใช้ Zend_Cache ใน Zend Framework มาทำ Cache ใช้กันดีกว่า

โดย AllowPost » 17/03/2017 12:24 am

น่าลองมาก ครับ ^^

Re: ใช้ Zend_Cache ใน Zend Framework มาทำ Cache ใช้กันดีกว่า

โดย fusebalance » 13/07/2015 12:32 pm

โอ้ ขอบคุณค่ะ :icon_plusone:

ใช้ Zend_Cache ใน Zend Framework มาทำ Cache ใช้กันดีกว่า

โดย mindphp » 25/02/2012 1:56 pm

ใช้ Zend_Cache ใน Zend Framework มาทำ Cache ใช้กันดีกว่า
ของมูลที่จะเอาไปใช้ จะอยู่ใน $data

โค้ด: เลือกทั้งหมด

<?php
include 'library/Zend/Cache.php';

$frontendOptions = array(
   'lifetime' => 10,
   'automatic_serialization' => true
);

$backendOptions = array(
    'cache_dir' => 'tmp/'
);

$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
$id = 'myBigLoop';

$start_time = microtime(true);

if(!($data = $cache->load($id)))
{
    echo "Not found in Cache<br />";

    $data = ”;
    for ($i = 0; $i < 1000000; $i++)
    {
        $data = $data . $i;
    }
    $cache->save($data);
}
else
{
        echo "Running from Cache<br />";
}

echo sprintf('%01.4f', microtime(true) – $start_time);
 

ข้างบน