adding caching to get value sum
This commit is contained in:
parent
23256245a0
commit
87a98fefb1
@ -77,11 +77,15 @@ namespace OpenCand.API.Repository
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<GetValueSumResponse>> GetValueSum(string query, Dictionary<string, object>? parameters = null)
|
public async Task<List<GetValueSumResponse>> GetValueSum(string query, Dictionary<string, object>? parameters = null)
|
||||||
|
{
|
||||||
|
string cacheKey = GenerateCacheKey(query.GetHashCode().ToString());
|
||||||
|
return await GetOrSetCacheAsync(cacheKey, async () =>
|
||||||
{
|
{
|
||||||
using (var connection = new NpgsqlConnection(ConnectionString))
|
using (var connection = new NpgsqlConnection(ConnectionString))
|
||||||
{
|
{
|
||||||
return (await connection.QueryAsync<GetValueSumResponse>(query, parameters)).AsList();
|
return (await connection.QueryAsync<GetValueSumResponse>(query, parameters)).AsList();
|
||||||
}
|
}
|
||||||
|
}) ?? new List<GetValueSumResponse>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user