簡體   English   中英

無法使用 Spring Cacheable 在 Aerospike Cache 中添加記錄

[英]Unable to add a record in Aerospike Cache using Spring Cacheable

我正在通過使用注釋@Cacheable 使用 Spring Cache 在 DAO 層中實現 A Cache。 這是我的以下代碼。

    @Override
@Cacheable(value="saleSegmentCache3")
public List<SaleSegment> findBySuborder(String pincode,long subcatID) {
    // TODO Auto-generated method stub
    System.out.println("String is printing");
    return ssRepo.findSaleSegmentsByPincodeAndSubcategoryIdAndSegmentType(pincode,subcatID, SaleSegmentType.SUBCAT_PINCODE);
}

在這里,我能夠檢索數據,但無法將數據放入緩存中。 我再使用一個例子:

    @Override
@Cacheable(value="saleSegmentCache3" ,key="#soData")
public String findBySuborderTemp(String soData) {
    // TODO Auto-generated method stub
    System.out.println("String XYZZZZZZZ");
    return "MyString";

}

在這里,我能夠完美地緩存字符串並將數據存儲在緩存中。 我認為我使用的語法有問題

spring-data-aerospike仍處於未完成狀態。 我們計划將其移至單獨的項目aerospike-spring-cache並實現缺失的功能。

從 2.5.0/3.0.0 版本開始,Spring Data Aerospike 中的緩存區域發生了一些重大變化。

您可以在這篇中等文章中看到使用 @Cacheable 的示例以及更多內容: https ://medium.com/aerospike-developer-blog/caching-with-spring-boot-and-aerospike-17b91267d6c

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM