Class ContextedRedisGraph
- java.lang.Object
-
- com.redislabs.redisgraph.impl.api.AbstractRedisGraph
-
- com.redislabs.redisgraph.impl.api.ContextedRedisGraph
-
- All Implemented Interfaces:
RedisGraphCacheHolder
,RedisGraph
,RedisGraphContext
,Closeable
,AutoCloseable
public class ContextedRedisGraph extends AbstractRedisGraph implements RedisGraphContext, RedisGraphCacheHolder
An implementation of RedisGraphContext. Allows sending RedisGraph and some Redis commands, within a specific connection context
-
-
Constructor Summary
Constructors Constructor Description ContextedRedisGraph(redis.clients.jedis.Jedis connectionContext)
Generates a new instance with a specific Jedis connection
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
closes the Jedis connectionString
deleteGraph(String graphId)
Deletes the entire graphprotected redis.clients.jedis.Jedis
getConnection()
Overrides the abstract method.redis.clients.jedis.Jedis
getConnectionContext()
Returns implementing class connection contextRedisGraphTransaction
multi()
Creates a new RedisGraphTransaction transactional objectprotected ResultSet
sendQuery(String graphId, String preparedQuery)
Sends the query over the instance only connectionprotected ResultSet
sendQuery(String graphId, String preparedQuery, long timeout)
Sends the query over the instance only connectionprotected ResultSet
sendReadOnlyQuery(String graphId, String preparedQuery)
Sends the read-only query over the instance only connectionprotected ResultSet
sendReadOnlyQuery(String graphId, String preparedQuery, long timeout)
Sends the read-only query over the instance only connectionvoid
setRedisGraphCaches(RedisGraphCaches caches)
String
unwatch()
Removes watch from all keysString
watch(String... keys)
Perfrom watch over given Redis keys-
Methods inherited from class com.redislabs.redisgraph.impl.api.AbstractRedisGraph
callProcedure, callProcedure, callProcedure, query, query, query, query, query, readOnlyQuery, readOnlyQuery, readOnlyQuery, readOnlyQuery
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.redislabs.redisgraph.RedisGraph
callProcedure, callProcedure, callProcedure, query, query, query, query, query, readOnlyQuery, readOnlyQuery, readOnlyQuery, readOnlyQuery
-
-
-
-
Method Detail
-
getConnection
protected redis.clients.jedis.Jedis getConnection()
Overrides the abstract method. Return the instance only connection- Specified by:
getConnection
in classAbstractRedisGraph
- Returns:
-
sendQuery
protected ResultSet sendQuery(String graphId, String preparedQuery)
Sends the query over the instance only connection- Specified by:
sendQuery
in classAbstractRedisGraph
- Parameters:
graphId
- graph to be queriedpreparedQuery
- prepared query- Returns:
- Result set with the query answer
-
sendReadOnlyQuery
protected ResultSet sendReadOnlyQuery(String graphId, String preparedQuery)
Sends the read-only query over the instance only connection- Specified by:
sendReadOnlyQuery
in classAbstractRedisGraph
- Parameters:
graphId
- graph to be queriedpreparedQuery
- prepared query- Returns:
- Result set with the query answer
-
sendQuery
protected ResultSet sendQuery(String graphId, String preparedQuery, long timeout)
Sends the query over the instance only connection- Specified by:
sendQuery
in classAbstractRedisGraph
- Parameters:
graphId
- graph to be queriedtimeout
-preparedQuery
- prepared query- Returns:
- Result set with the query answer
-
sendReadOnlyQuery
protected ResultSet sendReadOnlyQuery(String graphId, String preparedQuery, long timeout)
Sends the read-only query over the instance only connection- Specified by:
sendReadOnlyQuery
in classAbstractRedisGraph
- Parameters:
graphId
- graph to be queriedtimeout
-preparedQuery
- prepared query- Returns:
- Result set with the query answer
-
getConnectionContext
public redis.clients.jedis.Jedis getConnectionContext()
Description copied from interface:RedisGraphContext
Returns implementing class connection context- Specified by:
getConnectionContext
in interfaceRedisGraphContext
- Returns:
- Returns the instance Jedis connection.
-
multi
public RedisGraphTransaction multi()
Creates a new RedisGraphTransaction transactional object- Specified by:
multi
in interfaceRedisGraphContext
- Returns:
- new RedisGraphTransaction
-
watch
public String watch(String... keys)
Perfrom watch over given Redis keys- Specified by:
watch
in interfaceRedisGraphContext
- Parameters:
keys
-- Returns:
- "OK"
-
unwatch
public String unwatch()
Removes watch from all keys- Specified by:
unwatch
in interfaceRedisGraphContext
- Returns:
-
deleteGraph
public String deleteGraph(String graphId)
Deletes the entire graph- Specified by:
deleteGraph
in interfaceRedisGraph
- Parameters:
graphId
- graph to delete- Returns:
- delete running time statistics
-
close
public void close()
closes the Jedis connection- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceRedisGraph
-
setRedisGraphCaches
public void setRedisGraphCaches(RedisGraphCaches caches)
- Specified by:
setRedisGraphCaches
in interfaceRedisGraphCacheHolder
-
-