|
@@ -16,6 +16,7 @@ using TEAMModelOS.SDK.Extension;
|
|
|
using System.IdentityModel.Tokens.Jwt;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using TEAMModelOS.Filter;
|
|
|
+using StackExchange.Redis;
|
|
|
|
|
|
namespace TEAMModelOS.Controllers.Core
|
|
|
{
|
|
@@ -233,10 +234,22 @@ namespace TEAMModelOS.Controllers.Core
|
|
|
[HttpPost("get-blobsize")]
|
|
|
public async Task<ActionResult> GetBlobsSize(JsonElement request)
|
|
|
{
|
|
|
+
|
|
|
request.TryGetProperty("containerName", out JsonElement containerName);
|
|
|
var name =containerName.GetString();
|
|
|
+ RedisValue value = default;
|
|
|
+ value = _azureRedis.GetRedisClient(8).HashGet($"Blob:Record", name);
|
|
|
+ if (value != default && !value.IsNullOrEmpty)
|
|
|
+ {
|
|
|
+ JsonElement record = value.ToString().ToObject<JsonElement>();
|
|
|
+ if (record.TryGetInt64(out long blobsize))
|
|
|
+ {
|
|
|
+ return Ok(new { size= blobsize });
|
|
|
+ }
|
|
|
+ }
|
|
|
var client = _azureStorage.GetBlobContainerClient(name);
|
|
|
var size = await client.GetBlobsSize();
|
|
|
+ await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", name, size);
|
|
|
return Ok(new { size });
|
|
|
}
|
|
|
/// <summary>
|