mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-31 18:46:55 +08:00
#19854: Randomized queries should not be cached
Work Item: 19854 --HG-- branch : 1.x
This commit is contained in:
parent
af71604f8c
commit
24f66bb022
@ -24,6 +24,8 @@ namespace Orchard.ContentManagement {
|
||||
protected readonly List<Tuple<IAlias, Action<IHqlExpressionFactory>>> _wheres = new List<Tuple<IAlias, Action<IHqlExpressionFactory>>>();
|
||||
protected readonly List<Tuple<IAlias, Action<IHqlSortFactory>>> _sortings = new List<Tuple<IAlias, Action<IHqlSortFactory>>>();
|
||||
|
||||
private bool cacheable;
|
||||
|
||||
public IContentManager ContentManager { get; private set; }
|
||||
|
||||
public DefaultHqlQuery(
|
||||
@ -168,11 +170,13 @@ namespace Orchard.ContentManagement {
|
||||
|
||||
public IEnumerable<ContentItem> Slice(int skip, int count) {
|
||||
ApplyHqlVersionOptionsRestrictions(_versionOptions);
|
||||
var hql = ToHql(false);
|
||||
cacheable = true;
|
||||
|
||||
var hql = ToHql(false);
|
||||
|
||||
var query = _session
|
||||
.CreateQuery(hql)
|
||||
.SetCacheable(true)
|
||||
.SetCacheable(cacheable)
|
||||
;
|
||||
|
||||
if (skip != 0) {
|
||||
@ -215,6 +219,7 @@ namespace Orchard.ContentManagement {
|
||||
sort.Item2(sortFactory);
|
||||
|
||||
if (!sortFactory.Randomize) {
|
||||
cacheable = false;
|
||||
sb.Append(", ");
|
||||
sb.Append(sort.Item1.Name).Append(".").Append(sortFactory.PropertyName);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user