mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
Make media caching an option
This commit is contained in:
parent
d5556f4991
commit
991133045d
3 changed files with 11 additions and 0 deletions
|
@ -82,6 +82,11 @@ OUTPUT_BIT_RATE=128
|
|||
# environment, such a download will (silently) fail.
|
||||
ALLOW_DOWNLOAD=true
|
||||
|
||||
# If this is set to true, the query to get artist, album, and song information will be cached.
|
||||
# This can give a boost to Koel's boot time, especially if your library is huge.
|
||||
# However, the cache deserialization process can be memory sensitive, so if you encounter
|
||||
# errors, try setting this to false.
|
||||
CACHE_MEDIA=true
|
||||
|
||||
# The variables below are Laravel-specific.
|
||||
# You can change them if you know what you're doing. Otherwise, just leave them as-is.
|
||||
|
|
|
@ -11,6 +11,10 @@ class MediaCache
|
|||
|
||||
public function get()
|
||||
{
|
||||
if (!config('koel.cache_media')) {
|
||||
return Artist::orderBy('name')->with('albums', with('albums.songs'))->get();
|
||||
}
|
||||
|
||||
$data = Cache::get($this->keyName);
|
||||
if (!$data) {
|
||||
$data = Artist::orderBy('name')->with('albums', with('albums.songs'))->get();
|
||||
|
|
|
@ -115,4 +115,6 @@ return [
|
|||
'affiliate_id' => '1000lsGu',
|
||||
],
|
||||
|
||||
'cache_media' => env('CACHE_MEDIA', true),
|
||||
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue