Questions tagged [jcache]

JCACHE :JSR 107- Java Temporary Caching API. Specifies API and semantics for temporary, in-memory caching of Java objects, including object creation, shared access, spooling, invalidation, and consistency across JVM's. source: https://jcp.org/en/jsr/detail?id=107

Introduction

Cache is the API being defined in JSR107. It defines a standard Java Caching API for use by developers and a standard SPI ("Service Provider Interface") for use by implementers.

Maven Dependency:

<dependency>
    <groupId>javax.cache</groupId>
    <artifactId>cache-api</artifactId>
    <version>1.0.0</version>
</dependency>

Gradle dependency:

compile 'javax.cache:cache-api:1.0.0'

The specification is available online.

184 questions
3
votes
1 answer

JCache CacheStatisticis with Cache Size

I have used JCache with EhCache as provider. Using the MBean I am able to get cache statistics but there is missing attributes like size of the cache. I see LiveCacheStatistics provide that but how to get instance of it from…
utk
  • 31
  • 3
3
votes
2 answers

How to log cache hits through @Cacheable annotation?

There is a method in a class like this down below : @Override @Transactional @Cacheable(value = "products", key = "#id") public Product getProduct(long id) throws ApplicationException { Product product = null; try { …
Anish B.
  • 9,111
  • 3
  • 21
  • 41
3
votes
3 answers

Getting IllegalArgumentException while using jcache with hazelcast

I am trying to use jcache with hazelcast server provider. But getting this exception. java.lang.IllegalArgumentException: Cannot find cache named 'xyzCache' for Builder throws caches=[xyzCache] | key='' | keyGenerator='' | cacheManager='' |…
Deepak Gupta
  • 197
  • 1
  • 8
3
votes
3 answers

Spring Ehcache3 cause exception with with key-type and value-type

I try to use ehcache3 on project with spring 4.3. I configured cache manager:
3
votes
1 answer

Disable / Switch off Ehcache3

Anybody knows how to switch off ehcache 3 in an application? (e.g. for testing purposes or fall back scenarios in production) For ehcache 2 this was possible with: net.sf.ehcache.disabled=true as described here How to disable all caches in ehcache3…
timguy
  • 2,063
  • 2
  • 21
  • 40
3
votes
2 answers

javax.cache store by reference vs. store by value

I am new to java caching, I try to understand the difference between store by value vs. store by reference. I have below cited paragraph in java.cache documentation " The purpose of copying entries as they are stored in a Cache and again when they…
Acton
  • 255
  • 4
  • 13
3
votes
1 answer

Does Hazelcast honor a default cache configuration

In the hazelcast documentation there are a few brief references to a cache named "default" - for instance, here: http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#jcache-declarative-configuration Later, there is another mention of…
Wes W
  • 133
  • 6
3
votes
1 answer

How do I tell Spring Cache to cache the exceptions in @Cacheable annotation?

I need 3 separate caches: Response with some data Null Exception I've already defined the two caches @Caching(cacheable = { @Cacheable(value = "SomeCache", key = "#a1", unless = "#result == null"), @Cacheable(value = "SomeNullCache", key…
Evgeny Mironenko
  • 389
  • 3
  • 5
  • 26
2
votes
0 answers

Spring Ehcache 3.x configuration via XML

I'm trying to inject Ehcache (v3.9) javax.cache.CacheManager (JSR-107 JCache API) using Spring XML context. Initial attempt:
dsavickas
  • 1,360
  • 1
  • 9
  • 12
2
votes
1 answer

IllegalStateException: No service found for persistable resource: disk [ehCache 3]

I wanted to make cache available after application restart and added following row in config: 100 After it I have following stacktrace when I start the application: org.springframework.beans.factory.BeanCreationException:…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
2
votes
1 answer

JCache key exception

I have a method that has to be cached. I have a SpringBoot 2.1.7 application with a JSR-107 (JCache) cache. Cache implementation used: EHCache 3.8.0. @Override @HystrixCommand(fallbackMethod = "fallbackGetAllUserProfiles") @Timed(histogram = true,…
Sven
  • 2,343
  • 1
  • 18
  • 29
2
votes
1 answer

Hibernate JCache 5.4.3.Final doesn't work with JCache 5.4.2.Final configuration

I am using JCache with Hibernate like : org.hibernate
GOXR3PLUS
  • 6,877
  • 9
  • 44
  • 93
2
votes
1 answer

How to get Advanced Cache or configure Transaction Manager from Infinispan cache when it is configured as JCache?

I have a JCache cache and my caching provider is Infinispan. I need to use it as transactional cache. In Infinispan if we configure Transaction Manager, I can get it as cache.getAdvancedCache().getTransactionManager(). Since my cache is JCache, I do…
2
votes
2 answers

Mixing declarative and imperative JCache configurations

I'm trying to setup (J)caches in a mix of declarative and imperative configuration, as the JCache standard doesn't provide a means to limit the max size a cache can occupy. I want to do it as much "provider independent" as possible, so I have the…
JPS
  • 526
  • 7
  • 19
2
votes
1 answer

How create a cache key with JCache?

I have a Spring Boot application using Spring Caching annotations. Now I want to migrate to JSR-107 (JCache) annotations. This is my method: @Cacheable(value = "results", key = "#input.id") public CalculatorResult calculate(CalculatorInput input,…
lauer
  • 167
  • 10
1
2
3
12 13