首页 > 解决方案 > 咖啡因缓存 - 为数据库中无法访问的值放入缓存键?

问题描述

我的咖啡因缓存完美运行。但是,我想提高它的性能。

事实上,我想从缓存中加载的许多键都不在数据库中。有没有办法让咖啡因将所有这些无法访问的键放在地图中,这样当我再次请求咖啡因缓存时,咖啡因不会再次请求数据库?

例子:

  key FR12333 : exist in DB ==> is put in the cache as ("FR12333","something")

  key FR76663 : exist in DB ==> is put in the cache as ("FR76663","something")

  key FR88888 : DO NOT exist in DB ==> is put in the cache as ("FR88888",null)

有没有办法/选项来做到这一点?

标签: javacaffeine-cache

解决方案


推荐阅读