From 871a7227fc448fd288a6365b9ef2cae6f61af102 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Sun, 20 Dec 2015 17:42:30 +0100 Subject: [PATCH] Webserver: GetAllSongs() uses now a cache --- Vocaluxe/Base/Server/CVocaluxeServer.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Vocaluxe/Base/Server/CVocaluxeServer.cs b/Vocaluxe/Base/Server/CVocaluxeServer.cs index 42e1e63a..6bce25f9 100644 --- a/Vocaluxe/Base/Server/CVocaluxeServer.cs +++ b/Vocaluxe/Base/Server/CVocaluxeServer.cs @@ -624,11 +624,18 @@ namespace Vocaluxe.Base.Server return _GetSongInfo(song, true); } + + private static SSongInfo[] songInfoCache = null; public static SSongInfo[] GetAllSongs() { - List songs = CSongs.Songs; - return (from s in songs + if (songInfoCache == null) + { + List songs = CSongs.Songs; + songInfoCache = (from s in songs select _GetSongInfo(s, false)).AsParallel().ToArray(); + } + + return songInfoCache; } public static string GetMp3Path(int songId)