点燃返回正确值的缓存大小,但同时尝试访问其返回空值的缓存 [英] Ignite cache size returning correct value but while trying to access the cache its returning null value

查看:0
本文介绍了点燃返回正确值的缓存大小,但同时尝试访问其返回空值的缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够从另一个应用程序连接到我的Ignite集群,缓存大小()方法打印的值是正确的,但在使用缓存GET("key")方法时返回空值,尽管该键存在于缓存中。

这是一个基于Scala Spark的应用程序。

logInfo("advancedCompanyDao.getOfficialNameCache().size() >>> " +advancedCompanyDao.getOfficialNameCache().size())
logInfo("advancedCompanyDao.getAlternateNameCache() >>> " + advancedCompanyDao.getAlternateNameCache().size())
logInfo("Cache example1 >>> " +advancedCompanyDao.getOfficialNameCache().get("4297903978"))
logInfo("Cache example2 >>> " +advancedCompanyDao.getAlternateNameCache().get("4297903978"))
logInfo("Cache example3 >>> " +advancedCompanyDao.getOfficialNameCache().get("5062823677"))
logInfo("Cache example4 >>> " +advancedCompanyDao.getAlternateNameCache().get("5062823677"))
logInfo("Cache example5 >>> " +advancedCompanyDao.getOfficialNameCache().get("4295877382"))
logInfo("Cache example6 >>> " +advancedCompanyDao.getAlternateNameCache().get("4295877382"))

实际结果:

19/10/25 07:35:39 INFO accessor.UnifiedAccessor: advancedCompanyDao.getOfficialNameCache().size() >>> 59103193
19/10/25 07:35:39 INFO accessor.UnifiedAccessor: advancedCompanyDao.getAlternateNameCache() >>> 50993511
19/10/25 07:35:39 INFO accessor.UnifiedAccessor: Cache example2 >>> null
19/10/25 07:35:39 INFO accessor.UnifiedAccessor: Cache example3 >>> null

推荐答案

为什么确定缓存中存在密钥?

在查询字符串时,出现的键可能是Long(或Integer)。

这篇关于点燃返回正确值的缓存大小,但同时尝试访问其返回空值的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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