Announcement Announcement Module
Collapse
No announcement yet.
Spring + Ehcache : Not able to get the cache back from cacheManager without key Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring + Ehcache : Not able to get the cache back from cacheManager without key

    I am using Spring + Ehcache for my cache layer and it is working. But for some reason I wanna manipulate the cache manually.

    Code:
    @Cacheable(value = "productAll")
    public List<Product> getAllProduct()
    
    @CacheEvict(value = "product", key = "#product.id")
    public Product saveProduct(Product product) 
    
    @Cacheable(value = "product")
    public Product getProductById(Long id)
    These works fine.. but when I try to manually update the productAll cache in the saveProduct function. I am not able to get the cache back from the cache manager

    Code:
    Cache cache = cacheManager.getCache("productAll");
    cache.get("");
    What is the key that I should use in this case when no key is provided when we cache in the getProductAll method?

    Please advise Thanks in advance!
Working...
X