Refresh not supported

This commit is contained in:
ClemensFischer 2025-02-28 15:40:41 +01:00
parent 057fd82feb
commit abd7567ffc
2 changed files with 27 additions and 27 deletions

View file

@ -99,6 +99,11 @@ namespace MapControl.Caching
return value;
}
public Task<byte[]> GetAsync(string key, CancellationToken token = default)
{
return Task.FromResult(Get(key));
}
public void Set(string key, byte[] value, DistributedCacheEntryOptions options)
{
CheckArguments(key, value, options);
@ -131,8 +136,21 @@ namespace MapControl.Caching
}
}
public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default)
{
Set(key, value, options);
return Task.CompletedTask;
}
public void Refresh(string key)
{
throw new NotSupportedException();
}
public Task RefreshAsync(string key, CancellationToken token = default)
{
throw new NotSupportedException();
}
public void Remove(string key)
@ -149,6 +167,13 @@ namespace MapControl.Caching
}
}
public Task RemoveAsync(string key, CancellationToken token = default)
{
Remove(key);
return Task.CompletedTask;
}
public void DeleteExpiredItems()
{
var deleted = fileDb.DeleteRecords(new FilterExpression(expiresField, DateTime.UtcNow, ComparisonOperatorEnum.LessThanOrEqual));
@ -161,32 +186,6 @@ namespace MapControl.Caching
}
}
public Task<byte[]> GetAsync(string key, CancellationToken token = default)
{
return Task.FromResult(Get(key));
}
public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default)
{
Set(key, value, options);
return Task.CompletedTask;
}
public Task RefreshAsync(string key, CancellationToken token = default)
{
Refresh(key);
return Task.CompletedTask;
}
public Task RemoveAsync(string key, CancellationToken token = default)
{
Remove(key);
return Task.CompletedTask;
}
private static void CheckArgument(string key)
{
if (string.IsNullOrEmpty(key))

View file

@ -138,11 +138,12 @@ namespace MapControl.Caching
public void Refresh(string key)
{
throw new NotSupportedException();
}
public Task RefreshAsync(string key, CancellationToken token = default)
{
return Task.CompletedTask;
throw new NotSupportedException();
}
public void Remove(string key)