java - 在 Java 中缓存地图
问题描述
我正在编写一个 methodA(),它通过访问 Amazon S3 中的对象返回一个 Map<String, String> ,并且这个方法每小时会被调用几次(大约数千次)。我想每天(而不是每次方法调用)都从 S3 获取对象,并将此映射保存在本地缓存中以供所有方法调用使用。我的方法应该是什么?
解决方案
A map can solve this issue but you also have to make sure to evict your cache if necessary.
If you more than one instance of your application you should maybe think about a shared cache i.e. a redis database.
推荐阅读
- reactjs - 在打字稿(reactjs)中对axios响应调用已知函数时获取fn.Name不是函数错误
- python - 不支持在 python 中使用 pem 文件加密 json,提供 RSA 密钥格式
- c++ - grpc 找不到 protobuf 库
- react-native - React Native、IBECONS、RSSI 值到距离的转换
- python - 无法将自定义值传递给 AWS Lambda 函数
- anylogic - selectOutput5,链接到单选按钮
- android - 我的 Json 包含图像我想在图像视图中显示它
- css - 使用 Vue 过渡组来动画 CSS 网格中的列变化
- reactjs - 反应路由器,当搜索参数更改时防止滚动到顶部
- javascript - 如何在不使用 MathJax 刷新页面的情况下动态呈现 Tex 和 LaTex 公式?