[英]How do I use Spring's @Cacheable with Aerospike as the 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.