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
14
votes
3 answers

When to use Java Cache and how it differs from HashMap?

I've gone through javax.cache.Cache to understand it's usage and behavior. It's stated that, JCache is a Map-like data structure that provides temporary storage of application data. JCache and HashMap stores the elements in the local Heap memory…
Kamal Chandraprakash
  • 1,872
  • 18
  • 28
9
votes
1 answer

Limit cache size using JCache configuration API

I am using JCache API to configure caches in my application that uses spring caching with Ehcache 3. cacheManager.createCache("users", new MutableConfiguration() .setStoreByValue(false) …
abhijitab
  • 101
  • 1
  • 3
9
votes
1 answer

Google App Engine - JCache or Memcache API?

Are there any advantages and/or disadvantages to using either JCache (JSR 107) or the Memcache API with Google App Engine? If so, what are they?
Taylor Leese
  • 51,004
  • 28
  • 112
  • 141
8
votes
2 answers

Configuring caching for Hibernate with Spring Boot 2.1+

Context and question I'm trying to configure EHCache with Hibernate in Spring Boot 2.2, but it seems I'm doing something wrong. I've looked at several tutorials and SO questions but didn't find something that matched fully my approach. I chose the…
Chop
  • 4,267
  • 5
  • 26
  • 58
7
votes
2 answers

Is the JCache API (JSR 107) part of Java EE?

Been googling for a long time and can't seen to find any information on this. I'm not 100% sure if it is part of the Java EE platform but my gut feeling it is not. Although, it seems most Java EE compliant application containers do use/ or allow…
SoftwareDeveloper
  • 1,094
  • 2
  • 15
  • 26
6
votes
1 answer

does JCache (JSR107) allow different expiry durations for different entries?

Assume I want to cache the results of expensive method calls. These cache entries should have a different expiry duration (aka TTL). Is this possible with JCache if the entries are put into the same Cache instance? I am aware that I can assign a…
Stefan Armbruster
  • 39,465
  • 6
  • 87
  • 97
6
votes
2 answers

Spring cache/jsr107: list/collection argument as part of the key

I have a service which calls external system to retrieve some kind of objects by their external id as well as submit them back to update. Rather than retrieving objects one by one there is a more generic purpose methods: public interface…
Vadim Kirilchuk
  • 3,532
  • 4
  • 32
  • 49
5
votes
1 answer

JCache with multiple caching providers?

I intentionally have a couple of different caching providers in my classpath. I have Hazelcast for distributed cache and Caffeine for a local cache. I am trying to use JCache (JSR107) annotations for caching my values. I have already created a…
Eric B.
  • 23,425
  • 50
  • 169
  • 316
5
votes
3 answers

Cache is closed causing an exception while running test suite

I'm experiencing a problem similar to the described in this question. I have a test suite that runs fine in development environment. One of the tests fails when executed in Bitbucket Pipelines with the following…
naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
5
votes
1 answer

How to create a Jcache in Spring Java config?

I have a problem setting up a jcache with spring cache abstraction. @Configuration @EnableCaching public class CacheConfig { @Bean(name = "caffeineCachingProvider") public CachingProvider caffeineCachingProvider() { return new…
marknorkin
  • 3,904
  • 10
  • 46
  • 82
4
votes
1 answer

Infinispan-10.0.1.Final: No marshaller registered for Java type java.util.UUID

After upgrading infinispan-jcache from 9.4.16.Final --> 10.0.1.Final, I am unable to use the cache due to marshaller error. See https://infinispan.org/blog/ I want it working with javax.cache.*,which was the case with v9.4.16.Final. No infinispan…
4
votes
1 answer

How can I clear multiple caches using JCache annotation @CacheRemoveAll?

I have a method who's execution should clear two caches in my Spring+JCache+ehcache 3.5 project. I tried: @CacheRemoveAll(cacheName = "cache1") @CacheRemoveAll(cacheName = "cache2") public void methodToBeCalled(){ } and @CacheRemoveAll(cacheName =…
admdev
  • 448
  • 2
  • 9
4
votes
0 answers

How to set up Spring to use ehcache with xml? and how to use JCache API to cache only one object without a key?

I'm trying to setup a Spring-MVC 4.2 xml-configured project to use JCache using xml-configured ehcache 3.5 implementation. How can I use @Cacheable from Spring or @CacheResult from JCache to call a method that doesn't have any parameters and returns…
admdev
  • 448
  • 2
  • 9
4
votes
1 answer

Easiest way to connect Hazelcast JCache implementation to JSR107 annotations

Hazelcast is - among other things - an implementation for JCache. The JSR-107 (JCache) specification, along with a programmatic API also specifies annotations, so that caching can be done using CDI. The Hazelcast Blog even gives an example, but also…
Jan Dörrenhaus
  • 6,581
  • 2
  • 34
  • 45
3
votes
2 answers

JCache create cache that holds a list of items per key (Generics)

I want to have a cache that holds a list of items. This is my bean definition: public Cache> getMyCacheManager(CacheManager manager) { Cache> cache = manager.getCache("myCache"); if…
Sven
  • 2,343
  • 1
  • 18
  • 29
1
2 3
12 13