function getAlbum id id int id cache App_Cache get cache_id album_ id

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
function getAlbum($id){
$id = (int) $id;
$cache = App_Cache::get();
$cache_id = 'album_'.$id;
if(false === ($album = $cache->load($cache_id))){
$select = $this->select ()->setIntegrityCheck ( false )->from('albums',array('count'=>'COUNT(*)','album_name'=>'name','cover_id','secret','default','al_id'=>'id','protect','album_url_name'=>'url_name','user_id'))
->where ( 'albums.id = ?', $id )
->joinLeft ( 'album_images', 'album_images.album_id = albums.id' )
->joinLeft ( 'images', 'images.id = albums.cover_id',array('path','filename','ext','randomName'))
->joinLeft ( 'servers', 'images.server_id = servers.id' );
$select->group('albums.id');
$album = $this->fetchRow( $select );
$tags = array('user_'.$album->user_id);
$cache->save($album, $cache_id, $tags ,86400);
}
Zend_Debug::dump($album);
return $album;
}