Version 4.13.0

This commit is contained in:
ClemensF 2019-07-21 00:17:16 +02:00
parent 8b08d721d4
commit 8244ddb5c3
13 changed files with 625 additions and 739 deletions

View file

@ -72,31 +72,31 @@ namespace MapControl.Caching
public override bool Contains(string key, string regionName = null)
{
if (regionName != null)
{
throw new NotSupportedException("ImageFileCache does not support named regions.");
}
if (key == null)
{
throw new ArgumentNullException("The parameter key must not be null.");
}
if (regionName != null)
{
throw new NotSupportedException("The parameter regionName must be null.");
}
return memoryCache.Contains(key) || FindFile(key) != null;
}
public override object Get(string key, string regionName = null)
{
if (regionName != null)
{
throw new NotSupportedException("ImageFileCache does not support named regions.");
}
if (key == null)
{
throw new ArgumentNullException("The parameter key must not be null.");
}
if (regionName != null)
{
throw new NotSupportedException("The parameter regionName must be null.");
}
var imageCacheItem = memoryCache.Get(key) as ImageCacheItem;
if (imageCacheItem == null)
@ -150,21 +150,21 @@ namespace MapControl.Caching
public override void Set(string key, object value, CacheItemPolicy policy, string regionName = null)
{
if (regionName != null)
{
throw new NotSupportedException("ImageFileCache does not support named regions.");
}
if (key == null)
{
throw new ArgumentNullException("The parameter key must not be null.");
}
if (regionName != null)
{
throw new NotSupportedException("The parameter regionName must be null.");
}
var imageCacheItem = value as ImageCacheItem;
if (imageCacheItem == null || imageCacheItem.Buffer == null || imageCacheItem.Buffer.Length == 0)
{
throw new NotSupportedException("The parameter value must be an ImageCacheItem with a non-empty Buffer.");
throw new ArgumentException("The parameter value must be an ImageCacheItem with a non-empty Buffer.");
}
memoryCache.Set(key, imageCacheItem, policy);
@ -232,16 +232,16 @@ namespace MapControl.Caching
public override object Remove(string key, string regionName = null)
{
if (regionName != null)
{
throw new NotSupportedException("ImageFileCache does not support named regions.");
}
if (key == null)
{
throw new ArgumentNullException("The parameter key must not be null.");
}
if (regionName != null)
{
throw new NotSupportedException("The parameter regionName must be null.");
}
memoryCache.Remove(key);
var path = FindFile(key);