Skip to content

sasabolic/spring-boot-memcached-demo-java

 
 

Repository files navigation

Spring Boot Memcached Demo in Java

This is an example project showing the usage of Memcached Spring Boot cache library in a Spring Boot Java application. You will have to have Docker and Java 11 installed in order to run this demo.

There is an equivalent demo project written in Kotlin. To see version of this demo in Kotlin go to Spring Boot Memcached Demo in Kotlin.

Testing

To run the application tests execute this command:

./gradlew test

Running with Docker

Build a Docker image for the demo application by running:

./gradlew clean buildDocker

This will create the sb-memcached-demo Docker image in your machine's local Docker image registry. To start a memcached server and the demo application, run:

docker-compose -f src/main/docker/docker-compose.yml up -d

You should now be able to access REST endpoints e.g.

  1. GET http://localhost:8080/books (second request is cached response)

  2. GET http://localhost:8080/books/Kotlin (second request is cached response)

  3. DELETE http://localhost:8080/books/Kotlin (re-cached, next invocation of step 1. request will return list without book with title Kotlin)

To stop and remove the containers, run:

docker-compose -f src/main/docker/docker-compose.yml down

About

This is a demo project showing the usage of Memcached Spring Boot cache library in a Spring Boot JAVA application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 84.1%
  • Dockerfile 15.9%