Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            DotNet_GridCacheAccess.Initialize(new DotNet_GridCacheConfiguration());
            var gridCache = new SophisGridCacheBasicService();
            //var obj = gridCache.get("/root/sophis", "TestHeartBeatServerPARD013447_15628");
            var forexWritten = Forex.CreateBuilder()
                               .SetCommon(CommonFields.CreateBuilder().SetId("EUR").SetName("EUR").SetTimestamp(misysdatamodel.DateTime.DefaultInstance).SetSourceRef("tt").SetInstanceRef("zzz").Build())
                               .AddQuotes(Forex.Types.ForexQuote.CreateBuilder().SetLast(12).Build())
                               .Build();

            gridCache.put(_region, "forex1", new Sophis.GridCache.Contract.SophisGridCacheObject()
            {
                Bytes = forexWritten.ToByteArray()
            });
            gridCache.put(_region, "forex2", new Sophis.GridCache.Contract.SophisGridCacheObject()
            {
                Bytes = forexWritten.ToByteArray()
            });
            var objs = gridCache.getList(_region, new[] { "forex1", "forex2" });

            if (objs != null)
            {
                foreach (var obj in objs)
                {
                    var forexRead = Forex.ParseFrom(obj.Value.Bytes);
                    Console.WriteLine("Got: {0}", forexRead.ToString());
                }
            }
            else
            {
                Console.WriteLine("Not found :(");
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var cfg = new IgniteClientConfiguration
            {
                Host = "127.0.0.1"
            };

            using (IIgniteClient client = Ignition.StartClient(cfg))
            {
                var cache = client.GetCache <string, Forex>("myCache");

                var forexWritten = Forex.CreateBuilder()
                                   .SetCommon(CommonFields.CreateBuilder().SetId("EUR").SetName("EUR").SetTimestamp(misysdatamodel.DateTime.DefaultInstance).SetSourceRef("tt").SetInstanceRef("zzz").Build())
                                   .AddQuotes(Forex.Types.ForexQuote.CreateBuilder().SetLast(12).Build())
                                   .Build();

                cache.Put("EUR", forexWritten);
                var f = cache.Get("EUR");

                //for (int i = 0; i < 10; i++)
                //    cache.Put(i, i.ToString());

                //for (int i = 0; i < 10; i++)
                //    Console.WriteLine("Got [key={0}, val={1}]", i, cache.Get(i));
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var cfg = new IgniteConfiguration
            {
                CacheConfiguration = new[]
                {
                    new CacheConfiguration
                    {
                        Name          = "myCache",
                        QueryEntities = new[]
                        {
                            new QueryEntity
                            {
                                KeyType   = typeof(string),
                                ValueType = typeof(Forex),
                                Fields    = new[]
                                {
                                    new QueryField {
                                        Name = "FINANCING", FieldType = typeof(bool)
                                    }
                                }
                            }
                        }
                    }
                }
            };

            using (var ignite = Ignition.Start(cfg))
            {
                var cache = ignite.GetOrCreateCache <string, Forex>("myCache");

                var forexWritten = Forex.CreateBuilder()
                                   .SetCommon(CommonFields.CreateBuilder().SetId("EUR").SetName("EUR").SetTimestamp(misysdatamodel.DateTime.DefaultInstance).SetSourceRef("tt").SetInstanceRef("zzz").Build())
                                   .SetFinancing(true)
                                   .AddQuotes(Forex.Types.ForexQuote.CreateBuilder().SetLast(12).Build())
                                   .Build();

                cache.Put("EUR", forexWritten);
                var f = cache.Get("EUR");

                var   ff    = cache.Query(new SqlQuery(typeof(Forex), "FINANCING = TRUE")).GetAll();
                int   count = ff.Count;
                Forex f1    = ff.First().Value;

                // Store keys in cache (values will end up on different cache nodes).
                //for (int i = 0; i < 10; i++)
                //    cache.Put(i, $"toto {i}");

                //for (int i = 0; i < 10; i++)
                //    Console.WriteLine("Got [key={0}, val={1}]", i, cache.Get(i));
            }
        }