Skip to content

arpitaggarwal/couchbase-spring-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

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

About

couchbase-spring-cache

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages