mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Update FileDbCache.cs
This commit is contained in:
parent
d71616e7ba
commit
37bc610c38
|
|
@ -83,10 +83,7 @@ namespace MapControl.Caching
|
|||
|
||||
public byte[] Get(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentException($"The {nameof(key)} argument must not be null or empty.", nameof(key));
|
||||
}
|
||||
CheckArgument(key);
|
||||
|
||||
byte[] value = null;
|
||||
|
||||
|
|
@ -116,20 +113,7 @@ namespace MapControl.Caching
|
|||
|
||||
public void Set(string key, byte[] value, DistributedCacheEntryOptions options)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentException($"The {nameof(key)} argument must not be null or empty.", nameof(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));
|
||||
}
|
||||
CheckArguments(key, value, options);
|
||||
|
||||
DateTime expiration;
|
||||
|
||||
|
|
@ -176,14 +160,12 @@ namespace MapControl.Caching
|
|||
|
||||
public void Refresh(string key)
|
||||
{
|
||||
CheckArgument(key);
|
||||
}
|
||||
|
||||
public void Remove(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentException($"The {nameof(key)} argument must not be null or empty.", nameof(key));
|
||||
}
|
||||
CheckArgument(key);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -217,5 +199,28 @@ namespace MapControl.Caching
|
|||
Remove(key);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue