Skip to content

Commit 290e27e

Browse files
committed
Rename internal cache names, add comments
1 parent 9b66a45 commit 290e27e

6 files changed

Lines changed: 25 additions & 10 deletions

File tree

Orm/Xtensive.Orm/Orm/Entity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public void Lock(LockMode lockMode, LockBehavior lockBehavior)
271271
{
272272
var parameterContext = new ParameterContext();
273273
parameterContext.SetValue(keyParameter, Key.Value);
274-
var source = Session.StorageNode.InternalExecutableProviderCache.GetOrAdd((TypeInfo, lockMode, lockBehavior), ExecutableProviderGenerator, Session);
274+
var source = Session.StorageNode.EntityLockProviderCache .GetOrAdd((TypeInfo, lockMode, lockBehavior), ExecutableProviderGenerator, Session);
275275
using var recordSetReader = source.GetRecordSetReader(Session, parameterContext);
276276
recordSetReader.MoveNext();
277277
}

Orm/Xtensive.Orm/Orm/EntitySetBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ private static Key GetOwnerKey(Persistent owner)
924924
private EntitySetTypeState GetEntitySetTypeState()
925925
{
926926
EnsureOwnerIsNotRemoved();
927-
return Session.StorageNode.InternalEntitySetCache.GetOrAdd(Field, EntitySetTypeStateFactory, this);
927+
return Session.StorageNode.EntitySetTypeStateCache .GetOrAdd(Field, EntitySetTypeStateFactory, this);
928928
}
929929

930930
private static EntitySetTypeState BuildEntitySetTypeState(FieldInfo field, EntitySetBase entitySet)

Orm/Xtensive.Orm/Orm/Internals/Prefetch/EntityGroupTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private QueryTask CreateQueryTask(List<Tuple> currentKeySet)
143143
var parameterContext = new ParameterContext();
144144
parameterContext.SetValue(includeParameter, currentKeySet);
145145
var session = manager.Owner.Session;
146-
Provider = session.StorageNode.InternalRecordSetCache.GetOrAdd(cacheKey, CreateRecordSet);
146+
Provider = session.StorageNode.EntityFetchQueryCache.GetOrAdd(cacheKey, CreateRecordSet);
147147
var executableProvider = session.Compile(Provider);
148148
return new QueryTask(executableProvider, session.GetLifetimeToken(), parameterContext);
149149
}

Orm/Xtensive.Orm/Orm/Internals/Prefetch/EntitySetTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private QueryTask CreateQueryTask()
176176

177177
var session = manager.Owner.Session;
178178
var scope = new CompiledQueryProcessingScope(null, null, parameterContext, false);
179-
QueryProvider = session.StorageNode.InternalItemsQueryCache.GetOrAdd(cacheKey, CreateRecordSetLoadingItems);
179+
QueryProvider = session.StorageNode.EntitySetFetchQueryCache .GetOrAdd(cacheKey, CreateRecordSetLoadingItems);
180180
ExecutableProvider executableProvider;
181181
using (scope.Enter()) {
182182
executableProvider = session.Compile(QueryProvider);

Orm/Xtensive.Orm/Orm/Providers/SessionHandler.References.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public virtual IEnumerable<ReferenceInfo> GetReferencesTo(Entity target, Associa
2929
{
3030
if (association.IsPaired)
3131
return FindReferences(target, association, true);
32-
var (recordSet, parameter) = Session.StorageNode.InternalAssociationCache.GetOrAdd(association, BuildReferencingQuery);
32+
var (recordSet, parameter) = Session.StorageNode.RefsToEntityQueryCache .GetOrAdd(association, BuildReferencingQuery);
3333
var parameterContext = new ParameterContext();
3434
parameterContext.SetValue(parameter, target.Key.Value);
3535
ExecutableProvider executableProvider = Session.Compile(recordSet);

Orm/Xtensive.Orm/Orm/StorageNode.cs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,34 @@ public sealed class StorageNode : ISessionSource
4747
/// </summary>
4848
public TypeIdRegistry TypeIdRegistry { get; private set; }
4949

50-
internal ConcurrentDictionary<(TypeInfo, LockMode, LockBehavior), ExecutableProvider> InternalExecutableProviderCache { get; } =
50+
/// <summary>
51+
/// Caches providers that lock certain type of entity with certain <see cref="LockMode"/> and <see cref="LockBehavior"/>.
52+
/// </summary>
53+
internal ConcurrentDictionary<(TypeInfo, LockMode, LockBehavior), ExecutableProvider> EntityLockProviderCache { get; } =
5154
new ConcurrentDictionary<(TypeInfo, LockMode, LockBehavior), ExecutableProvider>();
5255

53-
internal ConcurrentDictionary<RecordSetCacheKey, CompilableProvider> InternalRecordSetCache { get; } =
56+
/// <summary>
57+
/// Caches uncompiled queries used by <see cref="PrefetchManager"/> to fetch certain entities.
58+
/// </summary>
59+
internal ConcurrentDictionary<RecordSetCacheKey, CompilableProvider> EntityFetchQueryCache { get; } =
5460
new ConcurrentDictionary<RecordSetCacheKey, CompilableProvider>();
5561

56-
internal ConcurrentDictionary<ItemsQueryCacheKey, CompilableProvider> InternalItemsQueryCache { get; } =
62+
/// <summary>
63+
/// Caches uncompiled queries used by <see cref="PrefetchManager"/> to fetch <see cref="EntitySet{TItem}"/> content.
64+
/// </summary>
65+
internal ConcurrentDictionary<ItemsQueryCacheKey, CompilableProvider> EntitySetFetchQueryCache { get; } =
5766
new ConcurrentDictionary<ItemsQueryCacheKey, CompilableProvider>();
5867

59-
internal ConcurrentDictionary<Xtensive.Orm.Model.FieldInfo, EntitySetTypeState> InternalEntitySetCache { get; } =
68+
/// <summary>
69+
/// Caches certain info about EntitySet fields, e.g. queries to fetch current count or items.
70+
/// </summary>
71+
internal ConcurrentDictionary<Xtensive.Orm.Model.FieldInfo, EntitySetTypeState> EntitySetTypeStateCache { get; } =
6072
new ConcurrentDictionary<Xtensive.Orm.Model.FieldInfo, EntitySetTypeState>();
6173

62-
internal ConcurrentDictionary<AssociationInfo, (CompilableProvider, Parameter<Xtensive.Tuples.Tuple>)> InternalAssociationCache { get; } =
74+
/// <summary>
75+
/// Caches queries that get references to entities for certain association.
76+
/// </summary>
77+
internal ConcurrentDictionary<AssociationInfo, (CompilableProvider, Parameter<Xtensive.Tuples.Tuple>)> RefsToEntityQueryCache { get; } =
6378
new ConcurrentDictionary<AssociationInfo, (CompilableProvider, Parameter<Xtensive.Tuples.Tuple>)>();
6479

6580
internal ConcurrentDictionary<SequenceInfo, object> KeySequencesCache { get; } = new ConcurrentDictionary<SequenceInfo, object>();

0 commit comments

Comments
 (0)