mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-11-24 16:53:10 +08:00
On every page load on frontend we were querying for all existing layers to test for the ones that are currently active. Since that information is not bound to change often, we added a cache layer to prevent querying every time. The cache is evicted whenever a Layer gets updated.
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using Orchard.ContentManagement;
|
|
|
|
namespace Orchard.Widgets.Models {
|
|
public class LayerPart : ContentPart<LayerPartRecord> {
|
|
|
|
/// <summary>
|
|
/// The layer's name.
|
|
/// </summary>
|
|
[Required]
|
|
public string Name {
|
|
get { return Retrieve(x => x.Name); }
|
|
set { Store(x => x.Name, value); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// The layer's description.
|
|
/// </summary>
|
|
public string Description {
|
|
get { return Retrieve(x => x.Description); }
|
|
set { Store(x => x.Description, value); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// The layer's rule.
|
|
/// The rule defines when the layer is active (should or not be displayed).
|
|
/// </summary>
|
|
public string LayerRule {
|
|
get { return Retrieve(x => x.LayerRule); }
|
|
set { Store(x => x.LayerRule, value); }
|
|
}
|
|
|
|
public static string AllLayersCacheEvictSignal =
|
|
"LayerPart_AllLayers_EvictCache";
|
|
public static string AllLayersCacheKey =
|
|
"LayerPart_AllLayers_CacheKey";
|
|
}
|
|
} |