This commit is contained in:
ClemensFischer 2025-03-31 20:55:57 +02:00
parent d01a948cf4
commit 4c5321958a
3 changed files with 6 additions and 15 deletions

View file

@ -43,11 +43,6 @@ namespace MapControl.Caching
public FileDbCache(FileDbCacheOptions options, ILoggerFactory loggerFactory = null)
{
if (loggerFactory != null)
{
logger = loggerFactory.CreateLogger<FileDbCache>();
}
var path = options.Path;
if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(Path.GetExtension(path)))
@ -55,6 +50,8 @@ namespace MapControl.Caching
path = Path.Combine(path ?? "", "TileCache.fdb");
}
logger = loggerFactory?.CreateLogger<FileDbCache>();
try
{
fileDb.Open(path);

View file

@ -39,11 +39,6 @@ namespace MapControl.Caching
public SQLiteCache(SQLiteCacheOptions options, ILoggerFactory loggerFactory = null)
{
if (loggerFactory != null)
{
logger = loggerFactory.CreateLogger<SQLiteCache>();
}
var path = options.Path;
if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(Path.GetExtension(path)))
@ -64,6 +59,8 @@ namespace MapControl.Caching
command.ExecuteNonQuery();
}
logger = loggerFactory?.CreateLogger<SQLiteCache>();
logger?.LogInformation("Opened database {path}", path);
if (options.ExpirationScanFrequency > TimeSpan.Zero)

View file

@ -43,16 +43,13 @@ namespace MapControl.Caching
public ImageFileCache(ImageFileCacheOptions options, ILoggerFactory loggerFactory = null)
{
if (loggerFactory != null)
{
logger = loggerFactory.CreateLogger<ImageFileCache>();
}
var path = options.Path;
rootDirectory = new DirectoryInfo(!string.IsNullOrEmpty(path) ? path : "TileCache");
rootDirectory.Create();
logger = loggerFactory?.CreateLogger<ImageFileCache>();
logger?.LogInformation("Started in {name}", rootDirectory.FullName);
var memoryCacheOptions = new MemoryDistributedCacheOptions();