Example project for using memcached as spring cache storage
docker
make
- Compile with
gradle
:make docker_gradle_build
- Build docker image:
make docker_build_web
- Launch service:
make docker_up
- Terminate service:
make docker_stop
- Tail logs:
make docker_logs
(useCtrl
+C
to stop tailing) - Access service (using
ping
API as an example):curl -s -X 'GET' localhost:8080/app/ping
- Build and run application with commands above
- Run
curl -s -X 'GET' localhost:8080/app/data
to fetch all data response(empty) and create a cache entry - Run the same query again (before the expiration window) to verify response is loaded from cache (see logs from
make docker_logs
) - Run
curl -s -X 'POST' localhost:8080/app/data
to create a newData
object - Run
curl -s -X 'PUT' localhost:8080/app/data/<dataId> -H 'content-type: application/json -d '{"payload":"<payload>"}'
to update the entry. - Both steps will bust the cache entry we had. Run the query for getting all data again to get a new entry
- Query
memcached
to see the cache:echo get <cache_name>:<cache_key> | nc localhost 11211