protected Observable < AsyncN1qlQueryResult > prepareAndExecute ( final N1qlQuery query , final CouchbaseEnvironment env , final long timeout , final TimeUnit timeUnit ) { return prepare ( query . statement ( ) ) . flatMap ( new Func1 < PreparedPayload , Observable < AsyncN1qlQueryResult > > ( ) { @ Override public Observable < AsyncN1qlQueryResult > call ( PreparedPayload payload ) { queryCache . put ( query . statement ( ) . toString ( ) , payload ) ; return executePrepared ( query , payload , env , timeout , timeUnit ) ; } } ) ; }
Issues a N1QL PREPARE puts the plan in cache then EXECUTE it .