Commit 2e180294 authored by gdlcf88's avatar gdlcf88

ClearAllCache feature.

parent f43e0bd3
...@@ -35,7 +35,11 @@ namespace EasyAbp.CacheManagement.CacheItems ...@@ -35,7 +35,11 @@ namespace EasyAbp.CacheManagement.CacheItems
_distributedCache = distributedCache; _distributedCache = distributedCache;
_keyNormalizer = keyNormalizer; _keyNormalizer = keyNormalizer;
_cancellationTokenProvider = cancellationTokenProvider; _cancellationTokenProvider = cancellationTokenProvider;
_connectionMultiplexer = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
var options = ConfigurationOptions.Parse(configuration["Redis:Configuration"]);
options.AllowAdmin = true;
_connectionMultiplexer = ConnectionMultiplexer.Connect(options);
} }
public async Task<IEnumerable<string>> GetKeysAsync(CacheItem cacheItem, public async Task<IEnumerable<string>> GetKeysAsync(CacheItem cacheItem,
......
...@@ -28,6 +28,12 @@ ...@@ -28,6 +28,12 @@
<abp-card-title>@L["CacheItem"]</abp-card-title> <abp-card-title>@L["CacheItem"]</abp-card-title>
</abp-column> </abp-column>
<abp-column size-md="_6" class="text-right"> <abp-column size-md="_6" class="text-right">
@if (await Authorization.IsGrantedAsync(CacheManagementPermissions.CacheItems.ClearAllCache))
{
<abp-button id="ClearAllCacheButton"
text="@L["ClearAllCache"].Value"
button-type="Danger"/>
}
@if (await Authorization.IsGrantedAsync(CacheManagementPermissions.CacheItems.Create)) @if (await Authorization.IsGrantedAsync(CacheManagementPermissions.CacheItems.Create))
{ {
<abp-button id="NewCacheItemButton" <abp-button id="NewCacheItemButton"
......
...@@ -76,4 +76,16 @@ $(function () { ...@@ -76,4 +76,16 @@ $(function () {
e.preventDefault(); e.preventDefault();
createModal.open(); createModal.open();
}); });
$('#ClearAllCacheButton').click(function (e) {
e.preventDefault();
abp.message.confirm(l('ClearAllCacheConfirmationMessage'), l('ClearAllCache'))
.done(function (accepted) {
if (accepted) {
service.clearAll().done(function () {
abp.notify.info(l('SuccessCleared'));
})
}
});
});
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment