Exemplo n.º 1
0
        private void CacheItem(BaseReference reference, StorageItem item, bool fromDeserialize)
        {
            reference.Item = item;
            item.AddReference(reference);
            int num = ItemSizes.SizeOf(item);

            base.FreeCacheSpace(num, base.m_cacheSizeBytes);
            if (fromDeserialize)
            {
                this.CacheSetValue(reference.Id, item);
            }
            else
            {
                base.m_totalAuditedBytes += num;
            }
            base.m_cacheSizeBytes += num;
            this.EnqueueItem(item);
            object           item2           = item.Item;
            ISelfReferential selfReferential = item2 as ISelfReferential;

            if (selfReferential != null)
            {
                selfReferential.SetReference(reference);
            }
        }
Exemplo n.º 2
0
        public override IReference <T> GenerateFixedReference <T>(T obj)
        {
            BaseReference baseReference = base.CreateReference((IStorable)(object)obj);

            baseReference.Init(this, this.m_offsetMap.GenerateTempId());
            StorageItem storageItem = (StorageItem)(baseReference.Item = new StorageItem(baseReference.Id, -1, (IStorable)(object)obj, ItemSizes.SizeOf((IStorable)(object)obj)));

            storageItem.AddReference(baseReference);
            storageItem.InQueue         = InQueueState.Exempt;
            storageItem.HasBeenUnPinned = true;
            ISelfReferential selfReferential = ((object)obj) as ISelfReferential;

            if (selfReferential != null)
            {
                selfReferential.SetReference(baseReference);
            }
            return((IReference <T>)baseReference);
        }