Update SQLiteCache.cs

This commit is contained in:
ClemensFischer 2025-02-24 14:37:31 +01:00
parent 5d649adbfa
commit 339fcbe3a4

View file

@ -195,29 +195,6 @@ namespace MapControl.Caching
}
}
private static void CheckArgument(string key)
{
if (string.IsNullOrEmpty(key))
{
throw new ArgumentException($"The {nameof(key)} argument must not be null or empty.", nameof(key));
}
}
private static void CheckArguments(string key, byte[] value, DistributedCacheEntryOptions options)
{
CheckArgument(key);
if (value == null)
{
throw new ArgumentNullException($"The {nameof(value)} argument must not be null.", nameof(value));
}
if (options == null)
{
throw new ArgumentNullException($"The {nameof(options)} argument must not be null.", nameof(options));
}
}
private SQLiteCommand GetItemCommand(string key)
{
var command = new SQLiteCommand("select buffer from items where key = @key and expiration > @now", connection);
@ -251,5 +228,28 @@ namespace MapControl.Caching
command.Parameters.AddWithValue("@now", DateTimeOffset.UtcNow.Ticks);
return command;
}
private static void CheckArgument(string key)
{
if (string.IsNullOrEmpty(key))
{
throw new ArgumentException($"The {nameof(key)} argument must not be null or empty.", nameof(key));
}
}
private static void CheckArguments(string key, byte[] value, DistributedCacheEntryOptions options)
{
CheckArgument(key);
if (value == null)
{
throw new ArgumentNullException($"The {nameof(value)} argument must not be null.", nameof(value));
}
if (options == null)
{
throw new ArgumentNullException($"The {nameof(options)} argument must not be null.", nameof(options));
}
}
}
}