NetCore: Abstract ConfigurationManager references

This commit is contained in:
cyberdot
2020-03-03 11:18:54 +00:00
parent dc36fa1290
commit 01362d0dd0
69 changed files with 374 additions and 121 deletions

View File

@@ -1,12 +1,13 @@
using System.Configuration;
using CSharpTest.Net.Collections;
using CSharpTest.Net.Serialization;
using Umbraco.Abstractions;
namespace Umbraco.Web.PublishedCache.NuCache.DataSource
{
internal class BTree
{
public static BPlusTree<int, ContentNodeKit> GetTree(string filepath, bool exists)
public static BPlusTree<int, ContentNodeKit> GetTree(string filepath, bool exists, INuCacheSettings settings)
{
var keySerializer = new PrimitiveSerializer();
var valueSerializer = new ContentNodeKitSerializer();
@@ -19,7 +20,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
CachePolicy = CachePolicy.None,
// default is 4096, min 2^9 = 512, max 2^16 = 64K
FileBlockSize = GetBlockSize(),
FileBlockSize = GetBlockSize(settings),
// other options?
};
@@ -32,11 +33,11 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
return tree;
}
private static int GetBlockSize()
private static int GetBlockSize(INuCacheSettings settings)
{
var blockSize = 4096;
var appSetting = ConfigurationManager.AppSettings["Umbraco.Web.PublishedCache.NuCache.BTree.BlockSize"];
var appSetting = settings.BTreeBlockSize;
if (appSetting == null)
return blockSize;