@@ 81-87 (lines=7) @@ | ||
78 | try { |
|
79 | $cacheKey = md5("lastfm_artist_$name"); |
|
80 | ||
81 | if ($response = cache($cacheKey)) { |
|
82 | $response = simplexml_load_string($response); |
|
83 | } else { |
|
84 | if ($response = $this->get("?method=artist.getInfo&autocorrect=1&artist=$name")) { |
|
85 | cache([$cacheKey => $response->asXML()], 24 * 60 * 7); |
|
86 | } |
|
87 | } |
|
88 | ||
89 | $response = json_decode(json_encode($response), true); |
|
90 | ||
@@ 142-148 (lines=7) @@ | ||
139 | try { |
|
140 | $cacheKey = md5("lastfm_album_{$name}_{$artistName}"); |
|
141 | ||
142 | if ($response = cache($cacheKey)) { |
|
143 | $response = simplexml_load_string($response); |
|
144 | } else { |
|
145 | if ($response = $this->get("?method=album.getInfo&autocorrect=1&album=$name&artist=$artistName")) { |
|
146 | cache([$cacheKey => $response->asXML()], 24 * 60 * 7); |
|
147 | } |
|
148 | } |
|
149 | ||
150 | $response = json_decode(json_encode($response), true); |
|
151 |