Exemplo n.º 1
0
        /** <inheritDoc /> */
        public ICacheClient <TK, TV> CreateCache <TK, TV>(CacheClientConfiguration configuration)
        {
            IgniteArgumentCheck.NotNull(configuration, "configuration");

            DoOutOp(ClientOp.CacheCreateWithConfiguration,
                    w => ClientCacheConfigurationSerializer.Write(w.Stream, configuration, ServerVersion));

            return(GetCache <TK, TV>(configuration.Name));
        }
Exemplo n.º 2
0
        /** <inheritDoc /> */
        public ICacheClient <TK, TV> GetOrCreateCache <TK, TV>(CacheClientConfiguration configuration)
        {
            IgniteArgumentCheck.NotNull(configuration, "configuration");

            DoOutOp(ClientOp.CacheGetOrCreateWithConfiguration,
                    ctx => ClientCacheConfigurationSerializer.Write(ctx.Stream, configuration, ctx.Features));

            return(GetCache <TK, TV>(configuration.Name));
        }
 /// <summary>
 /// Serializes and deserializes the config.
 /// </summary>
 private static CacheClientConfiguration SerializeDeserialize(CacheClientConfiguration cfg)
 {
     using (var stream = new BinaryHeapStream(128))
     {
         ClientCacheConfigurationSerializer.Write(stream, cfg, ClientSocket.CurrentProtocolVersion, true);
         stream.Seek(0, SeekOrigin.Begin);
         return(new CacheClientConfiguration(stream, ClientSocket.CurrentProtocolVersion));
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Serializes and deserializes the config.
 /// </summary>
 private static CacheClientConfiguration SerializeDeserialize(CacheClientConfiguration cfg)
 {
     using (var stream = new BinaryHeapStream(128))
     {
         ClientCacheConfigurationSerializer.Write(stream, cfg);
         stream.Seek(0, SeekOrigin.Begin);
         return(new CacheClientConfiguration(stream));
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheConfiguration"/> class,
        /// performing a deep copy of specified cache configuration.
        /// </summary>
        /// <param name="other">The other configuration to perfrom deep copy from.</param>
        public CacheClientConfiguration(CacheClientConfiguration other)
        {
            if (other != null)
            {
                using (var stream = IgniteManager.Memory.Allocate().GetStream())
                {
                    ClientCacheConfigurationSerializer.Write(stream, other, ClientSocket.CurrentProtocolVersion, true);

                    stream.SynchronizeOutput();
                    stream.Seek(0, SeekOrigin.Begin);

                    ClientCacheConfigurationSerializer.Read(stream, this, ClientSocket.CurrentProtocolVersion);
                }

                CopyLocalProperties(other);
            }
        }