From 29368a1566afcbfa861e3cf431156ee0f73f1f2b Mon Sep 17 00:00:00 2001 From: Mark Lopez Date: Mon, 5 Jun 2023 11:46:13 -0500 Subject: Source SQLite cache_size from an Environment Variable (#9666) --- Emby.Server.Implementations/ConfigurationOptions.cs | 5 +++-- Emby.Server.Implementations/Data/SqliteItemRepository.cs | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'Emby.Server.Implementations') diff --git a/Emby.Server.Implementations/ConfigurationOptions.cs b/Emby.Server.Implementations/ConfigurationOptions.cs index 630265dac9..f0c2676279 100644 --- a/Emby.Server.Implementations/ConfigurationOptions.cs +++ b/Emby.Server.Implementations/ConfigurationOptions.cs @@ -11,14 +11,15 @@ namespace Emby.Server.Implementations /// /// Gets a new copy of the default configuration options. /// - public static Dictionary DefaultConfiguration => new Dictionary + public static Dictionary DefaultConfiguration => new() { { HostWebClientKey, bool.TrueString }, { DefaultRedirectKey, "web/" }, { FfmpegProbeSizeKey, "1G" }, { FfmpegAnalyzeDurationKey, "200M" }, { PlaylistsAllowDuplicatesKey, bool.FalseString }, - { BindToUnixSocketKey, bool.FalseString } + { BindToUnixSocketKey, bool.FalseString }, + { SqliteCacheSizeKey, "20000" } }; } } diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index c32e7c75ad..ca8f605a02 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -25,6 +25,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; +using MediaBrowser.Controller.Extensions; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Persistence; @@ -34,6 +35,7 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Querying; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using SQLitePCL.pretty; @@ -319,13 +321,15 @@ namespace Emby.Server.Implementations.Data /// Instance of the interface. /// Instance of the interface. /// Instance of the interface. + /// Instance of the interface. /// config is null. public SqliteItemRepository( IServerConfigurationManager config, IServerApplicationHost appHost, ILogger logger, ILocalizationManager localization, - IImageProcessor imageProcessor) + IImageProcessor imageProcessor, + IConfiguration configuration) : base(logger) { _config = config; @@ -337,11 +341,13 @@ namespace Emby.Server.Implementations.Data _jsonOptions = JsonDefaults.Options; DbFilePath = Path.Combine(_config.ApplicationPaths.DataPath, "library.db"); + + CacheSize = configuration.GetSqliteCacheSize(); ReadConnectionsCount = Environment.ProcessorCount * 2; } /// - protected override int? CacheSize => 20000; + protected override int? CacheSize { get; } /// protected override TempStoreMode TempStore => TempStoreMode.Memory; -- cgit v1.2.3