mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-27 12:29:04 +08:00
[Fixes: #7462] Orchard.OutputCache - Possible NRE in DefaultTagCache ctor when accessing the WorkContext (#7463)
Fixes #7462
This commit is contained in:
committed by
Sébastien Ros
parent
d0b65cb60b
commit
5c6dd3e34f
@@ -17,13 +17,15 @@ namespace Orchard.OutputCache.Services {
|
||||
var key = shellSettings.Name + ":TagCache";
|
||||
var workContext = workContextAccessor.GetContext();
|
||||
|
||||
if ( workContext != null ) {
|
||||
_dictionary = workContext.HttpContext.Cache.Get(key) as ConcurrentDictionary<string, HashSet<string>>;
|
||||
|
||||
if (_dictionary == null) {
|
||||
if ( _dictionary == null ) {
|
||||
_dictionary = new ConcurrentDictionary<string, HashSet<string>>(StringComparer.OrdinalIgnoreCase);
|
||||
workContext.HttpContext.Cache.Add(key, _dictionary, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Tag(string tag, params string[] keys) {
|
||||
var set = _dictionary.GetOrAdd(tag, x => new HashSet<string>());
|
||||
|
||||
Reference in New Issue
Block a user