让 symfony 查询和结果缓存适用于 Oracle 11g

发布于 2024-12-13 04:00:14 字数 847 浏览 0 评论 0原文

我正在尝试让 memcache 查询/结果缓存与 Oracle 一起使用。它可以完美地对抗 mysql(使用 memcached 控制台验证:./memcached -u无人-m 40 -vv)。这是 web/index.php 中的内容:

$servers = array(
    'host' => 'localhost',
    'port' => 11211,
    'persistent' => false
);

$cacheDriver = new Doctrine_Cache_Memcache(array(
    'servers' => $servers,
    'compression' => false,
    'prefix' => 'qc-')
);
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine::ATTR_QUERY_CACHE, $cacheDriver);
$manager->setAttribute(Doctrine::ATTR_RESULT_CACHE, $cacheDriver);
$manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE_LIFESPAN, 3600);

这与 MySQL 的预期相同,但在我使用 ->useResultCache(true) 的第一个位置失败并显示以下消息:

结果缓存驱动程序未初始化。

有谁知道正在发生的事情和/或是否需要额外的配置才能使其与 Oracle DB 后端一起工作?

谢谢。

I'm trying to get the memcache query/result cache working with Oracle. It works flawlessly against mysql (verified with memcached console: ./memcached -u nobody -m 40 -vv). Here's what's in web/index.php:

$servers = array(
    'host' => 'localhost',
    'port' => 11211,
    'persistent' => false
);

$cacheDriver = new Doctrine_Cache_Memcache(array(
    'servers' => $servers,
    'compression' => false,
    'prefix' => 'qc-')
);
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine::ATTR_QUERY_CACHE, $cacheDriver);
$manager->setAttribute(Doctrine::ATTR_RESULT_CACHE, $cacheDriver);
$manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE_LIFESPAN, 3600);

This works as supposed against MySQL but fails with following message at the first location where i use ->useResultCache(true):

Result Cache driver not initialized.

Does anyone have clue about what's happening and/or if there's additional configuration needed to get it working with Oracle DB backend?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ゞ记忆︶ㄣ 2024-12-20 04:00:14

您应该尝试在 YOUR_APPConfiguration 类中设置这些管理器属性,如下所示: http://www.funstaff.ch/2009/03/19/le-cache-de-resultat-avec-doctrine

class frontendConfiguration extends sfApplicationConfiguration
{
  public function configureDoctrine(Doctrine_Manager $manager)
  {
    $servers = array(
        'host' => 'localhost',
        'port' => 11211,
        'persistent' => false
    );

    $cacheDriver = new Doctrine_Cache_Memcache(array(
        'servers' => $servers,
        'compression' => false,
        'prefix' => 'qc-')
    );
    $manager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, $cacheDriver);
    $manager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE_LIFESPAN, 3600);
    $manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE, $cacheDriver);
    $manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE_LIFESPAN, 3600);
  }
}

you should try to set those manager attributes inside your YOUR_APPConfiguration class like explained here : http://www.funstaff.ch/2009/03/19/le-cache-de-resultat-avec-doctrine

class frontendConfiguration extends sfApplicationConfiguration
{
  public function configureDoctrine(Doctrine_Manager $manager)
  {
    $servers = array(
        'host' => 'localhost',
        'port' => 11211,
        'persistent' => false
    );

    $cacheDriver = new Doctrine_Cache_Memcache(array(
        'servers' => $servers,
        'compression' => false,
        'prefix' => 'qc-')
    );
    $manager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, $cacheDriver);
    $manager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE_LIFESPAN, 3600);
    $manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE, $cacheDriver);
    $manager->setAttribute(Doctrine_Core::ATTR_RESULT_CACHE_LIFESPAN, 3600);
  }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文