Zend framework php中的zend mysql缓存用于提高网页性能

Zend framework php中的zend mysql缓存用于提高网页性能,zend-framework,Zend Framework,我们正在共享域中托管一个站点,其中没有安装memcache和APC服务。另一方面,在我们的一个表中,在该表中,数据约为1100万行。我们希望在系统中实现zend mysql缓存,以缓存mysql查询结果缓存。请指导我如何为我们的案例实现zend缓存???如果您使用zend framework,则情况不同此示例用于使用zend framework(版本1.*)库。您可以从 你可以在这里找到更多细节 include 'library/Zend/Cache.php';//include zend ca

我们正在共享域中托管一个站点,其中没有安装memcache和APC服务。另一方面,在我们的一个表中,在该表中,数据约为1100万行。我们希望在系统中实现zend mysql缓存,以缓存mysql查询结果缓存。请指导我如何为我们的案例实现zend缓存???

如果您使用zend framework,则情况不同此示例用于使用zend framework(版本1.*)库。您可以从

你可以在这里找到更多细节

include 'library/Zend/Cache.php';//include zend cache library

// set cache options
$frontendOptions = array(
   'lifetime' => null, // cache lifetime of 2 hours
   'automatic_serialization' => true
);

$backendOptions = array(
    'cache_dir' => './tmp/' // Directory where to put the cache files
);

// getting a Zend_Cache_Core object
$cache = Zend_Cache::factory('Core',
                             'File',
                             $frontendOptions,
                             $backendOptions);


// see if a cache already exists:
if( ($result = $cache->load('myresult')) === false ) {

    // cache miss; connect to the database

    mysql_connect('localhost', 'user', 'password');
    mysql_select_db('test');
    $query = 'select * from users';
    $rs = mysql_query($query);
    while($row = mysql_fetch_assoc($rs))
    {
        $result[] = $row;
    }


    $cache->save($result, 'myresult');

} else {

    // cache hit! shout so that we know
    echo "This one is from cache!\n\n";

}

print_r($result);