rohanagarwal rohanagarwal - 1 year ago 139
Java Question

Cache and Spring

I want to know about some cache libraries to be used with spring. I want the cache to be centralised distributed as I have multiple servers.This also rules out guava(in-memory cache). Redis/Jedis and Couchbase are two options but with lacking support for java. They need all java objects/beans to be serializable. Guava supports java but is in-process. Redisson seems good but I read that it lacks support and maintenance compared to Jedis.

I want to prevent code changes to a great extent, and thus don't want my beans to implement Serializabe, neither do I want to convert my objects to Json or Strings.

Answer Source

For me your requirements are contrary to each other. You need to choose one of

  1. No serialization of any kind. But that works only for cache in single JVM.
  2. Distributed cache. Data stored outside of application JVM. Possible to many nodes. But that requires serialization of some kind. Be it java serialization, JSON, Arvo, Kryo, Parquet, protocollBuffers.. Data be transfered over the network in serialized form.

No matter what you choose, will help you. It has support for

  • JDK ConcurrentMap-based Cache
  • Ehcache-based Cache
  • Caffeine Cache
  • Guava Cache
  • GemFire-based Cache
  • JSR-107 Cache

Why you believe that Redis/Jedis and Couchbase are lacking support for java? They have very good support, but your objects must be serialized.

For Redis, it is supported as cache abstraction by

Similar project exist for Couchbase

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download