Skip to content

2nd level cache GetMany ineffective for collections #3359

Closed
@EngSayed

Description

@EngSayed

I believe there is an issue in second level cache when NHibernate initializing a collection which call GetMany to get all values for array of keys but then when it goes into for loop to Assemble then it again calls GetMany for each item

I have Entity which has a bag collection of EntityFields and both have batch-size=2000 attribute. When I try to load the collection EntityFields then NHibernate calls DefaultInitializeCollectionEventListener.InitializeCollectionFromCache then it gets a 2000 CacheKey which calls GetMany() till that point everything is fine but then it goes inside CacheEntry.Assemble which calls InternalLoad and DoLoad which again tries to load from the cache LoadFromSecondLevelCache and calls again GetMany ... attached the call stack image.

My understanding is that once it found it all in Second Level Cache then it should not keep calling GetMany again for each record one by one, right?

Stack

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions