aws / aws/aws-lambda-snapstart-java-rules

Missing rules when using expirable maps/caches from popular open source libraries

未關閉
#37 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Java
星號
53
分支
10
PR 合併指標
30 天內沒有已合併 PR

描述

In case the expirable cache is initialized in the constructor of the Lambda class and some entries are put as well it may happen that the entries are not there anymore after the SnapStart snapshot is restored. The should be a warning of usage of time-based cached with the SnapStart is enabled.

In particular I'm thinking of the usage of 2 popular open source libraries:

- Google Guava ( artifact id **guava** and group id **com.google.guava**) and the code like this

myCache = CacheBuilder.newBuilder().expireAfterAccess(3600, TimeUnit.SECONDS) .build();
myCache.put("key", "value");

- Using artifact id **expiringmap** and the group id **net.jodah** and the code like this

expiredMap = ExpiringMap.builder().expiration(3600, TimeUnit.SECONDS).build();
expiredMap.put("key", "value");

I know that it's difficult to spot such use cases because both open source libraries offer standard and not expirable caches. But the invocation of the methods like **CacheBuilder.newBuilder().expireAfterAccess/expireAfterWrite** or multiple variations of methods **ExpiringMap.builder().expiration*** when creating the cache using these open source tools is a clear indication of the creation of expirable cache.

貢獻指南

開啟貢獻指南

研究方向

首先定位儲存庫中與 SnapStart 相關警告對應的 Java 規則定義和測試。檢視各項檢查如何識別程式庫和方法的使用,然後涵蓋 Guava expireAfterAccess/expireAfterWrite 以及 ExpiringMap 的過期變體。完成標準是相關的可過期快取模式會產生警告,同時非過期快取的使用不受影響。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
aws, java
領域
devtools
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。