mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
PERF: 16858 Shape table cached too aggressively, should expired on file changes, deletion and creation
--HG-- branch : perf
This commit is contained in:
parent
b88178b542
commit
5a0742d61d
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Routing;
|
||||
using Autofac;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Commands;
|
||||
using Orchard.Commands.Builtin;
|
||||
using Orchard.ContentManagement;
|
||||
@ -46,6 +46,7 @@ namespace Orchard.Setup {
|
||||
builder.RegisterModule(new MvcModule());
|
||||
builder.RegisterModule(new CommandModule());
|
||||
builder.RegisterModule(new WorkContextModule());
|
||||
builder.RegisterModule(new CacheModule());
|
||||
|
||||
builder.RegisterType<RoutePublisher>().As<IRoutePublisher>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<ModelBinderPublisher>().As<IModelBinderPublisher>().InstancePerLifetimeScope();
|
||||
|
@ -1,29 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Autofac.Features.Metadata;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Utility;
|
||||
|
||||
namespace Orchard.DisplayManagement.Descriptors {
|
||||
|
||||
public class DefaultShapeTableManager : IShapeTableManager, ISingletonDependency {
|
||||
public class DefaultShapeTableManager : IShapeTableManager {
|
||||
private readonly IEnumerable<Meta<IShapeTableProvider>> _bindingStrategies;
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
private readonly ICacheManager _cacheManager;
|
||||
|
||||
public DefaultShapeTableManager(
|
||||
IEnumerable<Meta<IShapeTableProvider>> bindingStrategies,
|
||||
IExtensionManager extensionManager) {
|
||||
IExtensionManager extensionManager,
|
||||
ICacheManager cacheManager) {
|
||||
_extensionManager = extensionManager;
|
||||
_cacheManager = cacheManager;
|
||||
_bindingStrategies = bindingStrategies;
|
||||
}
|
||||
|
||||
readonly ConcurrentDictionary<string, ShapeTable> _tables = new ConcurrentDictionary<string, ShapeTable>();
|
||||
|
||||
public ShapeTable GetShapeTable(string themeName) {
|
||||
return _tables.GetOrAdd(themeName ?? "", x => {
|
||||
return _cacheManager.Get(themeName ?? "", x => {
|
||||
var builderFactory = new ShapeTableBuilderFactory();
|
||||
foreach (var bindingStrategy in _bindingStrategies) {
|
||||
Feature strategyDefaultFeature = bindingStrategy.Metadata.ContainsKey("Feature") ?
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace Orchard.DisplayManagement.Descriptors {
|
||||
|
||||
public interface IShapeTableManager : IDependency {
|
||||
public interface IShapeTableManager : ISingletonDependency {
|
||||
ShapeTable GetShapeTable(string themeName);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user