private function __construct() { $this->photoDao = PHOTO_BOL_PhotoDao::getInstance(); $this->photoCacheDao = PHOTO_BOL_PhotoCacheDao::getInstance(); $this->dataDao = PHOTO_BOL_SearchDataDao::getInstance(); $this->indexDao = PHOTO_BOL_SearchIndexDao::getInstance(); $this->entityTypeDao = PHOTO_BOL_SearchEntityTypeDao::getInstance(); $this->reloadEntityTypes(); }
public function cleareCache() { PHOTO_BOL_PhotoCacheDao::getInstance()->cleareCache(); }
public function findPhotoListByDesc($searchVal, $id, $page, $limit) { if (empty($searchVal)) { return array(); } $first = ($page - 1) * $limit; $photoCache = PHOTO_BOL_PhotoCacheDao::getInstance(); if (($cach = $photoCache->findCacheByKey($photoCache->getKey($searchVal))) !== NULL) { $data = json_decode($cach->data, TRUE); $photos = $this->photoDao->findPhotoListByIdList(explode(',', $data['list'][$id]['ids']), $first, $limit); } else { $photos = $this->photoDao->findPhotoListByDescription($searchVal, $id, $first, $limit); } if ($photos) { foreach ($photos as $key => $photo) { $photos[$key]['url'] = $this->getPhotoUrlByType($photo['id'], self::TYPE_PREVIEW, $photo['hash'], !empty($photo['dimension']) ? $photo['dimension'] : FALSE); } } return $photos; }