Esempio n. 1
0
 public PrefetchingBehavior(PrefetchingUser prefetchingUser, WorkContext context, BaseBatchSizeAutoTuner autoTuner)
 {
     this.context    = context;
     this.autoTuner  = autoTuner;
     PrefetchingUser = prefetchingUser;
     MemoryStatistics.RegisterLowMemoryHandler(this);
 }
Esempio n. 2
0
        public PrefetchingBehavior CreatePrefetchingBehavior(
            PrefetchingUser user,
            BaseBatchSizeAutoTuner autoTuner,
            string prefetchingUserDescription,
            HashSet <string> entityNames = null,
            bool isDefault = false)
        {
            lock (this)
            {
                var newPrefetcher =
                    new PrefetchingBehavior(user,
                                            workContext,
                                            autoTuner ?? new IndependentBatchSizeAutoTuner(workContext, user),
                                            prefetchingUserDescription,
                                            entityNames,
                                            isDefault,
                                            GetPrefetchintBehavioursCount,
                                            GetPrefetchingBehaviourSummary);

                prefetchingBehaviors = new List <PrefetchingBehavior>(prefetchingBehaviors)
                {
                    newPrefetcher
                };

                return(newPrefetcher);
            }
        }
Esempio n. 3
0
        public PrefetchingBehavior CreatePrefetchingBehavior(PrefetchingUser user, BaseBatchSizeAutoTuner autoTuner, string prefetchingUserDescription)
        {
            lock (this)
            {
                var newPrefetcher = new PrefetchingBehavior(user, workContext, autoTuner ?? new IndependentBatchSizeAutoTuner(workContext, user), prefetchingUserDescription);

                prefetchingBehaviors = new List <PrefetchingBehavior>(prefetchingBehaviors)
                {
                    newPrefetcher
                };

                return(newPrefetcher);
            }
        }
Esempio n. 4
0
        public PrefetchingBehavior GetPrefetchingBehavior(PrefetchingUser user, BaseBatchSizeAutoTuner autoTuner)
        {
            PrefetchingBehavior value;

            if (prefetchingBehaviors.TryGetValue(user, out value))
            {
                return(value);
            }
            lock (this)
            {
                if (prefetchingBehaviors.TryGetValue(user, out value))
                {
                    return(value);
                }

                value = new PrefetchingBehavior(workContext, autoTuner ?? new IndependentBatchSizeAutoTuner(workContext));

                prefetchingBehaviors = new Dictionary <PrefetchingUser, PrefetchingBehavior>(prefetchingBehaviors)
                {
                    { user, value }
                };
                return(value);
            }
        }
Esempio n. 5
0
 public PrefetchingBehavior(PrefetchingUser prefetchingUser, WorkContext context, BaseBatchSizeAutoTuner autoTuner)
 {
     this.context    = context;
     this.autoTuner  = autoTuner;
     PrefetchingUser = prefetchingUser;
 }