public function getTopSalesProducts() { //see if the html fragment is in memcache $memcache = new Memcache(); if ($memcache->connect('127.0.0.1', 11211)) { $topProducts = $memcache->get('brand-top-products-' . $this->manufacturer->id); if ($topProducts) { return $topProducts; } else { $topProducts = ProductSale::getBestSalesManufacturer((int) self::$cookie->id_lang, $this->manufacturer->id, 0, 15, null, null, false); $memcache->set('brand-top-products-' . $this->manufacturer->id, $topProducts, false, 172800); //cache for 2 days return $topProducts; } } else { return ProductSale::getBestSalesManufacturer((int) self::$cookie->id_lang, $this->manufacturer->id, 0, 15, null, null, false); } }