1

I would like to know if it is possible to use Redis as local or in process cache in java.

I have tried with Redisson (version 3.11.2) but I get an error:

MutableConfiguration<String, CaLpgDataCollectionDto> jcacheConfig = new 
MutableConfiguration<>();
     Config redissonCfg = new Config();
     Configuration<String, CaLpgDataCollectionDto> config = 
RedissonConfiguration.fromConfig(redissonCfg, jcacheConfig);
     CacheManager manager = 
Caching.getCachingProvider().getCacheManager();
     Cache<String, CaLpgDataCollectionDto> cache = manager.createCache("namedCache", config);

Caused by: java.lang.IllegalArgumentException: server(s) address(es) not defined! at org.redisson.config.ConfigSupport.createConnectionManager(ConfigSupport.java:207)

Kind regards.

Hossain
  • 31
  • 6

2 Answers2

1

Yes, sorta, but no. Let me explain:

Redis itself cannot be run not as a server, you cannot use it as an embedded library.

However, you can run it as a subprocess of your process and communicate with it via Unix sockets. However it doesn't make much sense outside of tests.

Not_a_Golfer
  • 47,012
  • 14
  • 126
  • 92
1

Yes, you can use it as a local cache server.

You can set up Redis into your local (Ubuntu) machine or in LAN and by pointing it you can use.

To install click here