首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >点燃返回正确值的高速缓存大小,但同时尝试访问其返回空值的高速缓存

点燃返回正确值的高速缓存大小,但同时尝试访问其返回空值的高速缓存
EN

Stack Overflow用户
提问于 2019-10-25 20:53:08
回答 1查看 68关注 0票数 0

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

它是一个基于scala spark的应用程序。

代码语言:javascript
复制
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"))

实际结果:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2019-10-25 21:11:49

为什么确定缓存中存在key?

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58558907

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档