r/javaexamples • u/AcanthisittaEmpty985 • Feb 27 '26
Groovy web server with redis and mysql under 60 lines of code
Hi
It's a proof of concept, but it works, with Java 11+ and Groovy 5.0.2
It retrieves values from a GET request.
First it looks into a redis server used as a cache.
First it looks into a redis server used as a cache.
If the data is there, it returns to the client
If not, it access to MySQL to look for the data
If the data is there, it is stored into redis and returned to the client
If not, nothing is returned
Only 60 lines of code, so nothing snappy, but it works
It uses Javalin, Jedis and MySQL driver
1
Upvotes