Skip to content

Instantly share code, notes, and snippets.

@bibarsov
Created December 12, 2019 13:51
Show Gist options
  • Save bibarsov/112ecead963963a29180bb77afdf3dc1 to your computer and use it in GitHub Desktop.
Save bibarsov/112ecead963963a29180bb77afdf3dc1 to your computer and use it in GitHub Desktop.
Couchbase snippets
public static void main(String[] args) {
    CouchbaseCluster cluster = CouchbaseCluster.create(
        DefaultCouchbaseEnvironment.create(), 
        "localhost"//nodes
    );
    CouchbaseTemplate couchbaseTemplate = new CouchbaseTemplate(
        cluster.clusterManager(
            "user",//username
            "auth-example"//password
        ).info(),
        cluster.openBucket(
            "auth",//name
            "authauth"//password
        )
    );

    StateTokenDao stateTokenDao = new StateTokenDao(couchbaseTemplate);
    stateTokenDao.createStateToken(new StateToken("blablabla"));
    System.out.println(stateTokenDao.findAndRemoveStateToken("blablabla"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment