朗读如何在点燃中起作用 [英] how read-through work in ignite

查看:91
本文介绍了朗读如何在点燃中起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的缓存为空,因此sql查询返回null. 通读意味着如果丢失了缓存,则Ignite将自动进入底层的db(或持久性存储)以加载相应的数据.

my cache is empty so sql queries return null. The read-through means that if the cache is missed, then Ignite will automatically get down to the underlying db(or persistent store) to load the corresponding data.

如果在基础数据库表中插入了新数据,我必须关闭缓存服务器以自动从数据库表中加载新插入的数据,否则它将自动同步?

If there are new data inserted into the underlying db table ,i have to down cache server to load the newly inserted data from the db table automatically or it will sync automatically ?

与Spring的@Cacheable相同,或工作方式不同.
在我看来,答案是否定的.缓存SQL查询无法工作,因为缓存中没有数据,但是当我尝试使用cache.get时,得到以下结果:

Is work same as Spring's @Cacheable or work differently.
It looks to me that the answer is no. Cache SQL query don't work as no data in cache but when i tried cache.get in i got following results :

情况1:

 System.out.println("data == " + cache.get(new PersonKey("Manish", "Singh")).getPhones());

结果==>数据== 1235

result ==> data == 1235

情况2:

PersonKey per = new PersonKey();
per.setFirstname("Manish");
System.out.println("data == " + cache.get(per).getPhones());

抛出错误:-如下 错误图片

throws error:- as following error image, image2

推荐答案

当存在一组已知的要读取的键时,可以应用通读语义.对于SQL来说不是这种情况,因此,如果您的数据位于任意的第三方存储区(RDBMS,Cassandra,HBase等)中,则必须在运行查询之前将数据预加载到内存中.

Read-through semantics can be applied when there is a known set of keys to read. This is not the case with SQL, so in case your data is in an arbitrary 3rd party store (RDBMS, Cassandra, HBase, ...), you have to preload the data into memory prior to running queries.

但是,Ignite提供了本机持久性存储[1],它消除了此限制.它允许使用任何Ignite API而不占用任何内存,并且还包括SQL查询.使用时,数据将按需提取到内存中.

However, Ignite provides native persistence storage [1] which eliminates this limitation. It allows to use any Ignite APIs without having anything in memory, and this includes SQL queries as well. Data will be fetched into memory on demand while you're using it.

[1] https://apacheignite.readme.io/docs/distributed-持久存储

这篇关于朗读如何在点燃中起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆