Couchbase Spring Cache Demo
Example Spring Boot app using couchbase-spring-cache library, which is an "An implementation for Spring Cache based on Couchbase Java SDK 2.x".
Observations:
- Java Serialization is used to store values as a binary document. Therefore they will only be readable by similar JVM's on the other end.
- Document keys are made up of
cache::<cache-name>::<key>
Integration Tests
Run Integration Tests
A couchbase test server is required in order to run the integration tests. Instructions to set up such a server are provided in Docker Couchbase Test Server.
./gradlew test
Docker Couchbase Test Server
-
spin up container
docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 couchbase:6.0.0
-
Visit http://localhost:8091 on the host machine to see the Web Console
-
Walk through the Setup wizard and accept the default values.
- You may need to disable analytics if the defaults won't run in your environment.
-
Add a
dog_cache
bucket with default settings. -
Navigate to
Security -> Add User
to create a new user calleddog_cache
, with passwordpassword
, andApplication Access
permissions ondog_cache
bucket.
For further information on the couchbase container, see dockerhub.com/couchbase.