【问题标题】:Unable to add a record in Aerospike Cache using Spring Cacheable无法使用 Spring Cacheable 在 Aerospike Cache 中添加记录
【发布时间】:2021-05-31 06:57:20
【问题描述】:

我通过注解@Cacheable 使用Spring Cache 在DAO 层实现缓存。这是我的以下代码。

    @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";

}

在这里,我能够完美地缓存字符串并能够将数据存储在缓存中。 我认为我使用的语法有问题

【问题讨论】:

    标签: java spring spring-mvc caching aerospike


    【解决方案1】:

    spring-data-aerospike 仍处于未完成状态。我们计划将其移至单独的项目 aerospike-spring-cache 并实现缺失的功能。

    【讨论】:

      【解决方案2】:

      从 2.5.0/3.0.0 版本开始,Spring Data Aerospike 中的缓存区域发生了一些重大变化。

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-11-26
        • 1970-01-01
        • 2015-11-26
        • 2018-03-30
        • 1970-01-01
        • 1970-01-01
        • 2016-09-13
        • 1970-01-01
        相关资源
        最近更新 更多