简体   繁体   English

无法使用 Spring Cacheable 在 Aerospike Cache 中添加记录

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

I am implementing A Cache in DAO layer using Spring Cache by using annotation @Cacheable.我正在通过使用注释@Cacheable 使用 Spring Cache 在 DAO 层中实现 A Cache。 This is my following Code .这是我的以下代码。

    @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);
}

Over here i am able to retreive the data , but i am not being able to put the data into Cache.在这里,我能够检索数据,但无法将数据放入缓存中。 I am using one more example :我再使用一个例子:

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

}

Here i am able to Cache the String Perfectly and able to store the data in the cache .在这里,我能够完美地缓存字符串并将数据存储在缓存中。 I think Something is wrong with the syntax that i have used我认为我使用的语法有问题

spring-data-aerospike is still in unfinished state. spring-data-aerospike仍处于未完成状态。 We are planning to move it to the separate project aerospike-spring-cache and implement missing functionality.我们计划将其移至单独的项目aerospike-spring-cache并实现缺失的功能。

There were some big changes in the Cache area in Spring Data Aerospike - starting from versions 2.5.0/3.0.0.从 2.5.0/3.0.0 版本开始,Spring Data Aerospike 中的缓存区域发生了一些重大变化。

You can see an example of using @Cacheable and much more in this medium article: https://medium.com/aerospike-developer-blog/caching-with-spring-boot-and-aerospike-17b91267d6c您可以在这篇中等文章中看到使用 @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