Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheConfiguration"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal CacheConfiguration(IBinaryRawReader reader)
        {
            AtomicityMode        = (CacheAtomicityMode)reader.ReadInt();
            AtomicWriteOrderMode = (CacheAtomicWriteOrderMode)reader.ReadInt();
            Backups           = reader.ReadInt();
            CacheMode         = (CacheMode)reader.ReadInt();
            CopyOnRead        = reader.ReadBoolean();
            EagerTtl          = reader.ReadBoolean();
            EnableSwap        = reader.ReadBoolean();
            EvictSynchronized = reader.ReadBoolean();
            EvictSynchronizedConcurrencyLevel = reader.ReadInt();
            EvictSynchronizedKeyBufferSize    = reader.ReadInt();
            EvictSynchronizedTimeout          = reader.ReadLongAsTimespan();
            Invalidate                   = reader.ReadBoolean();
            KeepBinaryInStore            = reader.ReadBoolean();
            LoadPreviousValue            = reader.ReadBoolean();
            LockTimeout                  = reader.ReadLongAsTimespan();
            LongQueryWarningTimeout      = reader.ReadLongAsTimespan();
            MaxConcurrentAsyncOperations = reader.ReadInt();
            MaxEvictionOverflowRatio     = reader.ReadFloat();
            MemoryMode                   = (CacheMemoryMode)reader.ReadInt();
            Name                        = reader.ReadString();
            OffHeapMaxMemory            = reader.ReadLong();
            ReadFromBackup              = reader.ReadBoolean();
            RebalanceBatchSize          = reader.ReadInt();
            RebalanceDelay              = reader.ReadLongAsTimespan();
            RebalanceMode               = (CacheRebalanceMode)reader.ReadInt();
            RebalanceThrottle           = reader.ReadLongAsTimespan();
            RebalanceTimeout            = reader.ReadLongAsTimespan();
            SqlEscapeAll                = reader.ReadBoolean();
            SqlOnheapRowCacheSize       = reader.ReadInt();
            StartSize                   = reader.ReadInt();
            WriteBehindBatchSize        = reader.ReadInt();
            WriteBehindEnabled          = reader.ReadBoolean();
            WriteBehindFlushFrequency   = reader.ReadLongAsTimespan();
            WriteBehindFlushSize        = reader.ReadInt();
            WriteBehindFlushThreadCount = reader.ReadInt();
            WriteSynchronizationMode    = (CacheWriteSynchronizationMode)reader.ReadInt();
            ReadThrough                 = reader.ReadBoolean();
            WriteThrough                = reader.ReadBoolean();
            EnableStatistics            = reader.ReadBoolean();
            CacheStoreFactory           = reader.ReadObject <IFactory <ICacheStore> >();

            var count = reader.ReadInt();

            QueryEntities = count == 0 ? null : Enumerable.Range(0, count).Select(x => new QueryEntity(reader)).ToList();

            NearConfiguration = reader.ReadBoolean() ? new NearCacheConfiguration(reader) : null;

            EvictionPolicy      = EvictionPolicyBase.Read(reader);
            AffinityFunction    = AffinityFunctionSerializer.Read(reader);
            ExpiryPolicyFactory = ExpiryPolicySerializer.ReadPolicyFactory(reader);

            count = reader.ReadInt();
            PluginConfigurations = count == 0
                ? null
                : Enumerable.Range(0, count).Select(x => reader.ReadObject <ICachePluginConfiguration>()).ToList();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheConfiguration"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        internal CacheConfiguration(IBinaryRawReader reader)
        {
            // Make sure system marshaller is used.
            Debug.Assert(((BinaryReader)reader).Marshaller == BinaryUtils.Marshaller);

            AtomicityMode     = (CacheAtomicityMode)reader.ReadInt();
            Backups           = reader.ReadInt();
            CacheMode         = (CacheMode)reader.ReadInt();
            CopyOnRead        = reader.ReadBoolean();
            EagerTtl          = reader.ReadBoolean();
            Invalidate        = reader.ReadBoolean();
            KeepBinaryInStore = reader.ReadBoolean();
            LoadPreviousValue = reader.ReadBoolean();
            LockTimeout       = reader.ReadLongAsTimespan();
#pragma warning disable 618
            LongQueryWarningTimeout = reader.ReadLongAsTimespan();
#pragma warning restore 618
            MaxConcurrentAsyncOperations = reader.ReadInt();
            Name                        = reader.ReadString();
            ReadFromBackup              = reader.ReadBoolean();
            RebalanceBatchSize          = reader.ReadInt();
            RebalanceDelay              = reader.ReadLongAsTimespan();
            RebalanceMode               = (CacheRebalanceMode)reader.ReadInt();
            RebalanceThrottle           = reader.ReadLongAsTimespan();
            RebalanceTimeout            = reader.ReadLongAsTimespan();
            SqlEscapeAll                = reader.ReadBoolean();
            WriteBehindBatchSize        = reader.ReadInt();
            WriteBehindEnabled          = reader.ReadBoolean();
            WriteBehindFlushFrequency   = reader.ReadLongAsTimespan();
            WriteBehindFlushSize        = reader.ReadInt();
            WriteBehindFlushThreadCount = reader.ReadInt();
            WriteBehindCoalescing       = reader.ReadBoolean();
            WriteSynchronizationMode    = (CacheWriteSynchronizationMode)reader.ReadInt();
            ReadThrough                 = reader.ReadBoolean();
            WriteThrough                = reader.ReadBoolean();
            EnableStatistics            = reader.ReadBoolean();
            MemoryPolicyName            = reader.ReadString();
            PartitionLossPolicy         = (PartitionLossPolicy)reader.ReadInt();
            GroupName                   = reader.ReadString();
            CacheStoreFactory           = reader.ReadObject <IFactory <ICacheStore> >();

            var count = reader.ReadInt();
            QueryEntities = count == 0 ? null : Enumerable.Range(0, count).Select(x => new QueryEntity(reader)).ToList();

            NearConfiguration = reader.ReadBoolean() ? new NearCacheConfiguration(reader) : null;

            EvictionPolicy      = EvictionPolicyBase.Read(reader);
            AffinityFunction    = AffinityFunctionSerializer.Read(reader);
            ExpiryPolicyFactory = ExpiryPolicySerializer.ReadPolicyFactory(reader);

            count = reader.ReadInt();
            PluginConfigurations = count == 0
                ? null
                : Enumerable.Range(0, count).Select(x => reader.ReadObject <ICachePluginConfiguration>()).ToList();
        }
        /// <summary>
        /// Reads data into this instance from the specified reader.
        /// </summary>
        /// <param name="reader">The reader.</param>
        private void Read(BinaryReader reader)
        {
            // Make sure system marshaller is used.
            Debug.Assert(reader.Marshaller == BinaryUtils.Marshaller);

            AtomicityMode     = (CacheAtomicityMode)reader.ReadInt();
            Backups           = reader.ReadInt();
            CacheMode         = (CacheMode)reader.ReadInt();
            CopyOnRead        = reader.ReadBoolean();
            EagerTtl          = reader.ReadBoolean();
            Invalidate        = reader.ReadBoolean();
            KeepBinaryInStore = reader.ReadBoolean();
            LoadPreviousValue = reader.ReadBoolean();
            LockTimeout       = reader.ReadLongAsTimespan();
#pragma warning disable 618
            LongQueryWarningTimeout = reader.ReadLongAsTimespan();
#pragma warning restore 618
            MaxConcurrentAsyncOperations = reader.ReadInt();
            Name                            = reader.ReadString();
            ReadFromBackup                  = reader.ReadBoolean();
            RebalanceBatchSize              = reader.ReadInt();
            RebalanceDelay                  = reader.ReadLongAsTimespan();
            RebalanceMode                   = (CacheRebalanceMode)reader.ReadInt();
            RebalanceThrottle               = reader.ReadLongAsTimespan();
            RebalanceTimeout                = reader.ReadLongAsTimespan();
            SqlEscapeAll                    = reader.ReadBoolean();
            WriteBehindBatchSize            = reader.ReadInt();
            WriteBehindEnabled              = reader.ReadBoolean();
            WriteBehindFlushFrequency       = reader.ReadLongAsTimespan();
            WriteBehindFlushSize            = reader.ReadInt();
            WriteBehindFlushThreadCount     = reader.ReadInt();
            WriteBehindCoalescing           = reader.ReadBoolean();
            WriteSynchronizationMode        = (CacheWriteSynchronizationMode)reader.ReadInt();
            ReadThrough                     = reader.ReadBoolean();
            WriteThrough                    = reader.ReadBoolean();
            EnableStatistics                = reader.ReadBoolean();
            DataRegionName                  = reader.ReadString();
            PartitionLossPolicy             = (PartitionLossPolicy)reader.ReadInt();
            GroupName                       = reader.ReadString();
            CacheStoreFactory               = reader.ReadObject <IFactory <ICacheStore> >();
            SqlIndexMaxInlineSize           = reader.ReadInt();
            OnheapCacheEnabled              = reader.ReadBoolean();
            StoreConcurrentLoadAllThreshold = reader.ReadInt();
            RebalanceOrder                  = reader.ReadInt();
            RebalanceBatchesPrefetchCount   = reader.ReadLong();
            MaxQueryIteratorsCount          = reader.ReadInt();
            QueryDetailMetricsSize          = reader.ReadInt();
            QueryParallelism                = reader.ReadInt();
            SqlSchema                       = reader.ReadString();

            QueryEntities = reader.ReadCollectionRaw(r => new QueryEntity(r));

            NearConfiguration = reader.ReadBoolean() ? new NearCacheConfiguration(reader) : null;

            EvictionPolicy      = EvictionPolicyBase.Read(reader);
            AffinityFunction    = AffinityFunctionSerializer.Read(reader);
            ExpiryPolicyFactory = ExpiryPolicySerializer.ReadPolicyFactory(reader);

            KeyConfiguration = reader.ReadCollectionRaw(r => new CacheKeyConfiguration(r));

            var count = reader.ReadInt();

            if (count > 0)
            {
                PluginConfigurations = new List <ICachePluginConfiguration>(count);
                for (int i = 0; i < count; i++)
                {
                    if (reader.ReadBoolean())
                    {
                        // FactoryId-based plugin: skip.
                        reader.ReadInt();                             // Skip factory id.
                        var size = reader.ReadInt();
                        reader.Stream.Seek(size, SeekOrigin.Current); // Skip custom data.
                    }
                    else
                    {
                        // Pure .NET plugin.
                        PluginConfigurations.Add(reader.ReadObject <ICachePluginConfiguration>());
                    }
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NearCacheConfiguration"/> class.
 /// </summary>
 internal NearCacheConfiguration(IBinaryRawReader reader)
 {
     NearStartSize  = reader.ReadInt();
     EvictionPolicy = EvictionPolicyBase.Read(reader);
 }