0
我試圖使用Spring @Cacheable
註釋。作爲緩存註釋的參數的鍵的含義
讓我們看一下:
@Cacheable(value = "employee", key = "#surname")
public Person findEmployeeBySurname(String firstName, String surname, int age) {
return new Person(firstName, surname, age);
}
我說得對不對,如果我加2人同姓那麼只有一個將被保存在緩存中,並且該方法將返回有時不正確的結果?
什麼時候應該指定這個參數?
如果我沒有明確地指定(如我理解,當我使用CasheEvict和CashPut註釋時應該知道它),Spring如何創建密鑰?
這是所有在文檔中解釋:http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#cache-annotations-cacheable –
@JB Nizet關於春天框架有多少SO問題通過參考文件覆蓋? – gstackoverflow
我還沒有計算出任何統計數據。你想說什麼? –