public function getBlogByTitle($title, $max = 50) { $title = strtolower($title); $cacheKey = "getBlogByTitle_" . md5($title) . "_" . $max . ".gb"; $blogList = $this->gbReadCache($cacheKey); if ($blogList === false) { $blogList = array(); foreach ($this->blogs as $idx => $blog) { $blogTitle = strtolower($blog['title']); if (strpos($blogTitle, $title) !== FALSE) { array_push($blogList, $blog); } if (count($blogList) >= $max) { break; } } $this->gbWriteCache($cacheKey, $blogList); } return $blogList; }