Skip to content
couchbase-spring-cache
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
README.md
pom.xml

README.md

couchbase-spring-cache

Steps to run the Application

  1. Install (if not) Java 8 and Maven

  2. Modify Couchbase Cache configuration in cache.properties

  3. Move to couchbase-spring-cache directory and run mvn spring-boot:run command - It build and deploy the project on default embedded Tomcat server running on port 9901

  4. Get employee from Couchbase Cache as http://localhost:9901/employee/get

Application Configuration

  • Databases Path - /Users/ArpitAggarwal/Library/Application Support/Couchbase/var/lib/couchbase/data

  • Indexes Path - /Users/ArpitAggarwal/Library/Application Support/Couchbase/var/lib/couchbase/data

  • hostname - 127.0.0.1

  • username - Administrator

  • password - password

Download Couchbase Server

Managing connections

If the first one in the list fails the other ones can be tried. After initial contact is made, the bootstrap list provided by the user is thrown away and replaced with a list provided by the server (which contains all nodes of the cluster).

List<String> nodes = Arrays.asList("192.168.56.101", "192.168.56.102");
Cluster cluster = CouchbaseCluster.create(nodes);

Create PRIMARY INDEX on bucket

CREATE PRIMARY INDEX `default-primary-index` ON `default` USING GSI;

Select all indexes

SELECT * FROM system:indexes WHERE name="default-primary-index";

GET all KEYS

http://127.0.0.1:8092/bucket_name/_design/cache/_view/view_name?connection_timeout=60000&inclusive_end=true&limit=1000&skip=0&stale=false

Couchbase Workbench

It provides a rich graphical user interface to prepare and execute simple to complex N1QL queries, you can found tutorial to learn N1QL queries here - http://query.pub.couchbase.com/tutorial/#1

Sources:

  1. http://blog.couchbase.com/2015/december/couchbase-spring-cache

  2. http://docs.spring.io/spring/docs/current/spring-framework-reference/html/cache.html

  3. http://docs.couchbase.com/developer/java-2.0/managing-connections.html

You can’t perform that action at this time.