mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Replaced ImageCacheItem by Tuple
This commit is contained in:
parent
2709f90cdc
commit
77c2169999
14 changed files with 60 additions and 122 deletions
|
|
@ -75,7 +75,7 @@ namespace MapControl.Caching
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine("FileDbCache.Contains(\"{0}\"): {1}", key, ex.Message);
|
||||
Debug.WriteLine("FileDbCache.Contains({0}): {1}", key, ex.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -100,11 +100,7 @@ namespace MapControl.Caching
|
|||
return null;
|
||||
}
|
||||
|
||||
return new ImageCacheItem
|
||||
{
|
||||
Buffer = (byte[])record[0],
|
||||
Expiration = (DateTime)record[1]
|
||||
};
|
||||
return Tuple.Create((byte[])record[0], (DateTime)record[1]);
|
||||
}
|
||||
|
||||
public override CacheItem GetCacheItem(string key, string regionName = null)
|
||||
|
|
@ -131,12 +127,12 @@ namespace MapControl.Caching
|
|||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
|
||||
if (!(value is ImageCacheItem imageCacheItem))
|
||||
if (!(value is Tuple<byte[], DateTime> cacheItem))
|
||||
{
|
||||
throw new ArgumentException("The value argument must be a MapControl.Caching.ImageCacheItem instance.", nameof(value));
|
||||
throw new ArgumentException("The value argument must be a Tuple<byte[], DateTime>.", nameof(value));
|
||||
}
|
||||
|
||||
AddOrUpdateRecord(key, imageCacheItem.Buffer, imageCacheItem.Expiration);
|
||||
AddOrUpdateRecord(key, cacheItem.Item1, cacheItem.Item2);
|
||||
}
|
||||
|
||||
public override void Set(string key, object value, DateTimeOffset absoluteExpiration, string regionName = null)
|
||||
|
|
@ -184,7 +180,7 @@ namespace MapControl.Caching
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine("FileDbCache.Remove(\"{0}\"): {1}", key, ex.Message);
|
||||
Debug.WriteLine("FileDbCache.Remove({0}): {1}", key, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,4 @@
|
|||
<Reference Include="System.Runtime.Caching" />
|
||||
<PackageReference Include="FileDb.NET" Version="7.4.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\MapControl\WPF\MapControl.WPF.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue