{"id":96,"date":"2010-05-14T19:06:33","date_gmt":"2010-05-14T11:06:33","guid":{"rendered":"http:\/\/karyleong.net\/?p=96"},"modified":"2010-05-14T19:06:33","modified_gmt":"2010-05-14T11:06:33","slug":"symfony-12-apc-cache","status":"publish","type":"post","link":"https:\/\/karyleong.net\/?p=96","title":{"rendered":"Symfony 1.2 APC Cache"},"content":{"rendered":"<p>;##### APC config ###<br \/>\n;apc.enabled = On<br \/>\napc.enable_cli = On<br \/>\napc.shm_size = 128<\/p>\n<h1>Doctrine cache<\/h1>\n<p><!--\n\n\n<div class='clear_right'><\/div>\n\n\n--><!-- to force the parent-box to enclose the floating divs --><\/p>\n<p><!-- end of ull_wiki_header--><\/p>\n<div class=\"ull_wiki_main\">\n<h1>As of sf 1.4<\/h1>\n<p><a class=\"link_new_window\" title=\"Link opens in a new  window\" href=\"http:\/\/www.symfony-project.org\/advent_calendar\/12\/en\" target=\"_blank\">http:\/\/www.symfony-project.org\/advent_calendar\/12\/en<\/a><\/p>\n<p><a class=\"link_new_window\" title=\"Link opens in a new  window\" href=\"http:\/\/www.doctrine-project.org\/documentation\/manual2\/1_0\/en\/one-page#caching\" target=\"_blank\">http:\/\/www.doctrine-project.org\/documentation\/manual2\/1_0\/en\/one-page#caching<\/a><\/p>\n<p><a class=\"link_new_window\" title=\"Link opens in a new  window\" href=\"http:\/\/www.sfblog.fr\/page\/utiliser-memcache-avec-doctrine-sous-symfony\" target=\"_blank\">http:\/\/www.sfblog.fr\/page\/utiliser-memcache-avec-doctrine-sous-symfony<\/a><\/p>\n<h1>Setup for sf 1.2<\/h1>\n<p>In the ProjectConfiguration:<\/p>\n<ul>\n<li>\n<pre>  public function initialize()\r\n  {\r\n    \/\/enable Doctrine cache\r\n    $manager = Doctrine_Manager::getInstance();\r\n    $cacheDriver = new Doctrine_Cache_Apc();\r\n    $manager-&gt;setAttribute(Doctrine::ATTR_RESULT_CACHE, $cacheDriver);\r\n  }<\/pre>\n<\/li>\n<\/ul>\n<p>Example query (in UllFlowAppTable.class.php):<\/p>\n<ul>\n<li>\n<pre>  \/**\r\n   * Find by Id\r\n   *\r\n   * @param integer $id\r\n   * @return Doctrine_Record\r\n   *\/\r\n  public static function findById($id)\r\n  {\r\n    $q = new Doctrine_Query;\r\n    $q\r\n      -&gt;from('UllFlowApp')\r\n      -&gt;where('id = ?', $id)\r\n      -&gt;useResultCache(true)\r\n    ;\r\n\r\n    return $q-&gt;execute()-&gt;getFirst();\r\n  }<\/pre>\n<\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>;##### APC config ### ;apc.enabled = On apc.enable_cli = On apc.shm_size = 128 Doctrine cache As of sf 1.4 http:\/\/www.symfony-project.org\/advent_calendar\/12\/en http:\/\/www.doctrine-project.org\/documentation\/manual2\/1_0\/en\/one-page#caching http:\/\/www.sfblog.fr\/page\/utiliser-memcache-avec-doctrine-sous-symfony Setup for sf 1.2 In the ProjectConfiguration: public function initialize() { \/\/enable Doctrine cache $manager = Doctrine_Manager::getInstance(); $cacheDriver = new Doctrine_Cache_Apc(); $manager-&gt;setAttribute(Doctrine::ATTR_RESULT_CACHE, $cacheDriver); } Example query (in UllFlowAppTable.class.php): \/** * Find by Id &#8230; <a title=\"Symfony 1.2 APC Cache\" class=\"read-more\" href=\"https:\/\/karyleong.net\/?p=96\" aria-label=\"More on Symfony 1.2 APC Cache\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/karyleong.net\/index.php?rest_route=\/wp\/v2\/posts\/96"}],"collection":[{"href":"https:\/\/karyleong.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/karyleong.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/karyleong.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/karyleong.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=96"}],"version-history":[{"count":1,"href":"https:\/\/karyleong.net\/index.php?rest_route=\/wp\/v2\/posts\/96\/revisions"}],"predecessor-version":[{"id":97,"href":"https:\/\/karyleong.net\/index.php?rest_route=\/wp\/v2\/posts\/96\/revisions\/97"}],"wp:attachment":[{"href":"https:\/\/karyleong.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/karyleong.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/karyleong.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}