mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-20 07:23:59 +08:00
Merge remote-tracking branch 'remotes/origin/1.10.x' into 8830_menuitemsaving
This commit is contained in:
commit
b41f8b4f48
@ -8,4 +8,8 @@ namespace Orchard.Caching.Services {
|
||||
void Remove(string key);
|
||||
void Clear();
|
||||
}
|
||||
|
||||
public interface ICacheStorageProviderWithKeyPrefix : ICacheStorageProvider {
|
||||
void Clear(string key);
|
||||
}
|
||||
}
|
@ -9,10 +9,9 @@ using StackExchange.Redis;
|
||||
using System;
|
||||
|
||||
namespace Orchard.Redis.Caching {
|
||||
|
||||
[OrchardFeature("Orchard.Redis.Caching")]
|
||||
[OrchardSuppressDependency("Orchard.Caching.Services.DefaultCacheStorageProvider")]
|
||||
public class RedisCacheStorageProvider : Component, ICacheStorageProvider {
|
||||
public class RedisCacheStorageProvider : Component, ICacheStorageProviderWithKeyPrefix {
|
||||
public const string ConnectionStringKey = "Orchard.Redis.Cache";
|
||||
|
||||
private readonly ShellSettings _shellSettings;
|
||||
@ -61,6 +60,10 @@ namespace Orchard.Redis.Caching {
|
||||
_connectionMultiplexer.KeyDeleteWithPrefix(GetLocalizedKey("*"));
|
||||
}
|
||||
|
||||
public void Clear(string key) {
|
||||
_connectionMultiplexer.KeyDeleteWithPrefix(GetLocalizedKey($"{_shellSettings.Name}:{key}"));
|
||||
}
|
||||
|
||||
private string GetLocalizedKey(string key) {
|
||||
return _shellSettings.Name + ":Cache:" + key;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user