postgresqlhibernatespring-bootredisbroadleaf-commerce

Broadleaf Ehcache to Redis for distributed environment


Currently, we are using Ehcache in local without Terracotta. We are planning to deploy broadleaf customer API in two different instances with a load balancer in the front.

I did a small research and found that terracotta is cost and as we are a startup I can't invest in terracotta. I heard about Redis, which is free and good for the distributed environment.

My Question is,
1. Can we migrate the broadleaf Ehcache to Redis or any other free Java distributed cache?
2. If possible what I have to do in broadleaf? so that it will be easy for us to migrate from Ehcache to new one.


Solution

  • You could but there is a few issues, first Broadleaf uses Ehcache directly without any sort of facade. You would have to exclude the Ehcache dependency and rewrite the Ehcache implementation that directs calls to the underlying cache store. Then there is another couple of problems. Broadleaf caches some stuff that is not serializable one being an inner class that extends Spring's Resource that you have to fix and the SystemPropertyService that uses a JDK Proxy as a null value on cache misses. It can be done, but it is not easy.