Let Doctrine use APC User Cache in Symfony 1.2

Simply drop a new function of some lines inside ProjectConfiguration.class.php

  public function configureDoctrine(Doctrine_Manager $manager)
  {
    if (ini_get("apc.enabled")==1)
      if (sfApplicationConfiguration::getEnvironment() != "dev")
        $manager->setAttribute(Doctrine::ATTR_QUERY_CACHE, new Doctrine_Cache_Apc());
      else apc_clear_cache("user");
  }

Every result will be cached inside the apc user cache, so the load on database will be reduced.

🇬🇧 🇺🇸 If you found value in my content, consider supporting me by treating me to a coffee, beer, or pizza. Your contributions help fuel more quality content creation.

🇮🇹 Se hai trovato valore nei miei contenuti, considera di supportarmi offrendomi un caffè, una birra o una pizza. I tuoi contributi aiutano a creare contenuti di qualità.

🇬🇧 🇺🇸 If you have found inaccuracies or wish to improve this article, please use the comments section below (after clicking on Load Comments).

🇮🇹 Se hai trovato imprecisioni o vuoi migliorare questo articolo, utilizza la sezione commenti qui sotto (dopo aver cliccato Load Comments)

Comments