|
|
|
|
@ -31,32 +31,33 @@ namespace Volo.Abp.PermissionManagement
|
|
|
|
|
|
|
|
|
|
protected virtual async Task<PermissionGrantCacheItem> GetCacheItemAsync(string name, string providerName, string providerKey)
|
|
|
|
|
{
|
|
|
|
|
Logger.LogDebug($"PermissionStore.GetCacheItemAsync: name={name}, providerName={providerName}, providerKey={providerKey}");
|
|
|
|
|
|
|
|
|
|
var cacheKey = CalculateCacheKey(name, providerName, providerKey);
|
|
|
|
|
|
|
|
|
|
Logger.LogDebug($"PermissionStore.GetCacheItemAsync: {cacheKey}");
|
|
|
|
|
|
|
|
|
|
var cacheItem = await Cache.GetAsync(cacheKey);
|
|
|
|
|
|
|
|
|
|
if (cacheItem != null)
|
|
|
|
|
{
|
|
|
|
|
Logger.LogDebug("Found in the cache.");
|
|
|
|
|
Logger.LogDebug($"Found in the cache: {cacheKey}");
|
|
|
|
|
return cacheItem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Logger.LogDebug("Not found in the cache, getting from the repository!");
|
|
|
|
|
Logger.LogDebug($"Not found in the cache, getting from the repository: {cacheKey}");
|
|
|
|
|
|
|
|
|
|
cacheItem = new PermissionGrantCacheItem(
|
|
|
|
|
name,
|
|
|
|
|
await PermissionGrantRepository.FindAsync(name, providerName, providerKey) != null
|
|
|
|
|
(await PermissionGrantRepository.FindAsync(name, providerName, providerKey)) != null
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Logger.LogDebug("Setting the cache item.");
|
|
|
|
|
Logger.LogDebug($"Setting the cache item: {cacheKey}");
|
|
|
|
|
|
|
|
|
|
await Cache.SetAsync(
|
|
|
|
|
cacheKey,
|
|
|
|
|
cacheItem
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Logger.LogDebug("Finished setting the cache item.");
|
|
|
|
|
Logger.LogDebug($"Finished setting the cache item: {cacheKey}");
|
|
|
|
|
|
|
|
|
|
return cacheItem;
|
|
|
|
|
}
|
|
|
|
|
|