添加项目文件。
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using FileService.Application.Ports;
|
||||
using FileService.Application.StorageContracts;
|
||||
using IM.Commons;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FileService.Infrastructure.Storage
|
||||
{
|
||||
public class StorageCacheService:IStorageRedisCache
|
||||
{
|
||||
private readonly IRedisService redis;
|
||||
|
||||
public StorageCacheService(IRedisService redis)
|
||||
{
|
||||
this.redis = redis;
|
||||
}
|
||||
public async Task SetAsync(UploadRuntimeCache upload)
|
||||
{
|
||||
string key = RedisHelper.GetUploadInfoKey(upload.UploadSessionId);
|
||||
await redis.SetAsync<UploadRuntimeCache>(key, upload);
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(string sessionId)
|
||||
{
|
||||
string key = RedisHelper.GetUploadInfoKey(sessionId);
|
||||
await redis.RemoveAsync(key);
|
||||
}
|
||||
|
||||
public Task DeleteByTaskIdAsync(string taskId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<UploadRuntimeCache?> GetAsync(string sessionId)
|
||||
{
|
||||
var key = RedisHelper.GetUploadInfoKey(sessionId);
|
||||
return await redis.GetAsync<UploadRuntimeCache>(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user