Example project for using memcached as spring cache storage
dockermake
- 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+Cto stop tailing) - Access service (using
pingAPI 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/datato 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/datato create a newDataobject - 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
memcachedto see the cache:echo get <cache_name>:<cache_key> | nc localhost 11211