예제 #1
0
        /// <summary>
        /// Gets or creates the cache.
        /// </summary>
        private ICache <TK, TV> GetOrCreateCache <TK, TV>(CacheConfiguration configuration,
                                                          NearCacheConfiguration nearConfiguration, Op op)
        {
            IgniteArgumentCheck.NotNull(configuration, "configuration");
            IgniteArgumentCheck.NotNull(configuration.Name, "CacheConfiguration.Name");
            configuration.Validate(Logger);

            var cacheTarget = DoOutOpObject((int)op, s =>
            {
                var w = BinaryUtils.Marshaller.StartMarshal(s);

                configuration.Write(w, ClientSocket.CurrentProtocolVersion);

                if (nearConfiguration != null)
                {
                    w.WriteBoolean(true);
                    nearConfiguration.Write(w);
                }
                else
                {
                    w.WriteBoolean(false);
                }
            });

            return(GetCache <TK, TV>(cacheTarget));
        }
예제 #2
0
        /** <inheritdoc /> */
        public ICache <TK, TV> CreateCache <TK, TV>(CacheConfiguration configuration,
                                                    NearCacheConfiguration nearConfiguration)
        {
            IgniteArgumentCheck.NotNull(configuration, "configuration");
            IgniteArgumentCheck.NotNull(configuration.Name, "CacheConfiguration.Name");
            configuration.Validate(Logger);

            using (var stream = IgniteManager.Memory.Allocate().GetStream())
            {
                // Use system marshaller: full footers, always unregistered mode.
                var writer = BinaryUtils.Marshaller.StartMarshal(stream);

                configuration.Write(writer);

                if (nearConfiguration != null)
                {
                    writer.WriteBoolean(true);
                    nearConfiguration.Write(writer);
                }
                else
                {
                    writer.WriteBoolean(false);
                }

                stream.SynchronizeOutput();

                return(Cache <TK, TV>(UU.ProcessorCreateCache(_proc, stream.MemoryPointer)));
            }
        }
예제 #3
0
파일: Ignite.cs 프로젝트: zshamrock/ignite
        /** <inheritdoc /> */
        public ICache <TK, TV> CreateCache <TK, TV>(CacheConfiguration configuration,
                                                    NearCacheConfiguration nearConfiguration)
        {
            IgniteArgumentCheck.NotNull(configuration, "configuration");
            configuration.Validate(Logger);

            using (var stream = IgniteManager.Memory.Allocate().GetStream())
            {
                var writer = Marshaller.StartMarshal(stream);

                configuration.Write(writer);

                if (nearConfiguration != null)
                {
                    writer.WriteBoolean(true);
                    nearConfiguration.Write(writer);
                }
                else
                {
                    writer.WriteBoolean(false);
                }

                stream.SynchronizeOutput();

                return(Cache <TK, TV>(UU.ProcessorCreateCache(_proc, stream.MemoryPointer)));
            }
        }
예제 #4
0
        /// <summary>
        /// Gets or creates near cache.
        /// </summary>
        private ICache <TK, TV> GetOrCreateNearCache0 <TK, TV>(string name, NearCacheConfiguration configuration,
                                                               Op op)
        {
            IgniteArgumentCheck.NotNull(configuration, "configuration");

            var cacheTarget = DoOutOpObject((int)op, w =>
            {
                w.WriteString(name);
                configuration.Write(w);
            });

            return(GetCache <TK, TV>(cacheTarget));
        }
예제 #5
0
        /// <summary>
        /// Gets or creates near cache.
        /// </summary>
        private ICache <TK, TV> GetOrCreateNearCache0 <TK, TV>(string name, NearCacheConfiguration configuration,
                                                               Func <IUnmanagedTarget, string, long, IUnmanagedTarget> func)
        {
            IgniteArgumentCheck.NotNull(configuration, "configuration");

            using (var stream = IgniteManager.Memory.Allocate().GetStream())
            {
                var writer = BinaryUtils.Marshaller.StartMarshal(stream);

                configuration.Write(writer);

                stream.SynchronizeOutput();

                return(Cache <TK, TV>(func(_proc, name, stream.MemoryPointer)));
            }
        }
예제 #6
0
        /// <summary>
        /// Gets or creates near cache.
        /// </summary>
        private ICache <TK, TV> GetOrCreateNearCache0 <TK, TV>(string name, NearCacheConfiguration configuration,
                                                               PlatformCacheConfiguration platformConfiguration,
                                                               Op op)
        {
            IgniteArgumentCheck.NotNull(configuration, "configuration");

            var cacheTarget = DoOutOpObject((int)op, w =>
            {
                w.WriteString(name);
                configuration.Write(w);

                if (platformConfiguration != null)
                {
                    w.WriteBoolean(true);
                    platformConfiguration.Write(w);
                }
                else
                {
                    w.WriteBoolean(false);
                }
            });

            return(GetCache <TK, TV>(cacheTarget));
        }