trait RedisClient extends Object with IEventEmitter
Redis Client
- Annotations
- @RawJSType() @native()
- Alphabetic
- By Inheritance
- RedisClient
- IEventEmitter
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addListener(eventName: String, listener: Function): RedisClient.this.type
- Definition Classes
- IEventEmitter
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
auth(password: String, callback: RedisCallback[RedisResponse] = js.native): Unit
When connecting to a Redis server that requires authentication, the AUTH command must be sent as the first command after connecting.
When connecting to a Redis server that requires authentication, the AUTH command must be sent as the first command after connecting. This can be tricky to coordinate with reconnections, the ready check, etc. To make this easier, client.auth() stashes password and will send it after each connection, including reconnections. callback is invoked only once, after the response to the very first AUTH command sent. NOTE: Your call to client.auth() should not be inside the ready handler. If you are doing this wrong, client will emit an error that looks something like this Error: Ready check failed: ERR operation not permitted.
- password
the user password
- callback
the optional callback
-
def
batch(commands: Array[RedisCommand] = js.native): RedisMulti
Identical to .multi without transactions.
Identical to .multi without transactions. This is recommended if you want to execute many commands at once but don't have to rely on transactions.
batch([commands])
Example: -
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
command_queue_length: Int
The number of commands that have been sent to the Redis server but not yet replied to.
The number of commands that have been sent to the Redis server but not yet replied to. You can use this to enforce some kind of maximum queue depth for commands while connected.
-
def
connected: Boolean
Boolean tracking the state of the connection to the Redis server.
-
def
del(keys: Array[String], callback: RedisCallback[RedisResponse] = js.native): Unit
Deletes an array of records by their respective keys
Deletes an array of records by their respective keys
- keys
the given array of keys
- callback
the given callback
-
def
del(key: String, callback: RedisCallback[RedisResponse]): Unit
Deletes a record by key
Deletes a record by key
- key
the given key
- callback
the given callback
-
def
del(key: String): Unit
Deletes a key
Deletes a key
- key
the given key
-
val
domain: String
- Definition Classes
- IEventEmitter
-
def
dump(key: String, callback: RedisCallback[RedisResponse] = js.native): Unit
Dumps a record by key
Dumps a record by key
- key
the given key
- callback
the given callback
-
def
duplicate(options: RawOptions = js.native, callback: RedisCallback[RedisResponse]): Any
Duplicate all current options and return a new redisClient instance.
Duplicate all current options and return a new redisClient instance. All options passed to the duplicate function are going to replace the original option. If you pass a callback, duplicate is going to wait until the client is ready and returns it in the callback. If an error occurs in the meanwhile, that is going to return an error instead in the callback.
- options
the optional settings
- callback
the optional callback
-
def
emit(name: String, args: Any*): Any
- Definition Classes
- IEventEmitter
-
def
end(flush: Boolean = js.native): Unit
Forcibly close the connection to the Redis server.
Forcibly close the connection to the Redis server. Note that this does not wait until all replies have been parsed. If you want to exit cleanly, call client.quit() as mentioned above.
You should set flush to true, if you are not absolutely sure you do not care about any other commands. If you set flush to false all still running commands will silently fail.
- flush
indicates whether the want a flush to occur before closing the connection
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exists(key: Array[String], callback: RedisCallback[Int]): Any
Indicates whether a key exists
Indicates whether a key exists
- key
the given key
- callback
the given callback <Error, Integer>
-
def
exists(key: String, callback: RedisCallback[Int]): Any
Indicates whether a key exists
Indicates whether a key exists
- key
the given key
- callback
the given callback <Error, Integer>
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- def get(key: String, callback: RedisCallback[String]): Unit
- def get(key: Buffer, callback: RedisCallback[Buffer]): Unit
- def getAsync(key: String): Promise[String]
- def getAsync(key: Buffer): Promise[Buffer]
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
getMaxListeners(): Int
- Definition Classes
- IEventEmitter
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
hgetall(key: String, callback: RedisCallback[Dictionary[String]]): Unit
Most Redis commands take a single String or an Array of Strings as arguments, and replies are sent back as a single String or an Array of Strings.
Most Redis commands take a single String or an Array of Strings as arguments, and replies are sent back as a single String or an Array of Strings. When dealing with hash values, there are a couple of useful exceptions to this.
- key
the given hash key
- callback
the callback
client.hmset("hosts", "mjr", "1", "another", "23", "home", "1234"); client.hgetall("hosts", function (err, obj) { console.dir(obj); });
Example: - def hkeys(key: String, callback: RedisCallback[Array[String]]): Unit
- def hmset(key: String, keyValuePairs: Array[String], callback: RedisCallback[RedisResponse]): Unit
- def hmset(key: String, keyValuePairs: Array[String]): Unit
- def hmset(key: String, keyValuePairs: String*): Unit
- def hset(key: String, hashKey: String, hashValue: String, callback: RedisCallback[RedisResponse]): Unit
- def hset(args: Array[String], callback: RedisCallback[RedisResponse] = js.native): Unit
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
def
listenerCount(eventName: String): Int
- Definition Classes
- IEventEmitter
-
def
listeners(eventName: String): Array[Function]
- Definition Classes
- IEventEmitter
-
def
monitor(callback: RedisCallback[RedisResponse] = js.native): Unit
Redis supports the MONITOR command, which lets you see all commands received by the Redis server across all client connections, including from other client libraries and other computers.
Redis supports the MONITOR command, which lets you see all commands received by the Redis server across all client connections, including from other client libraries and other computers.
A monitor event is going to be emitted for every command fired from any client connected to the server including the monitoring client itself. The callback for the monitor event takes a timestamp from the Redis server, an array of command arguments and the raw monitoring string.
- callback
the callback
- def mset(args: Array[Any], callback: RedisCallback[RedisResponse]): Unit
- def multi(args: Any*): RedisMulti
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
offline_queue_length: Int
The number of commands that have been queued up for a future connection.
The number of commands that have been queued up for a future connection. You can use this to enforce some kind of maximum queue depth for pre-connection commands.
-
def
on(eventName: String, listener: Function): RedisClient.this.type
- Definition Classes
- IEventEmitter
-
def
once(eventName: String, listener: Function): RedisClient.this.type
- Definition Classes
- IEventEmitter
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
- def publish(message: String*): Unit
-
def
quit(): Unit
This sends the quit command to the redis server and ends cleanly right after all running commands were properly handled.
This sends the quit command to the redis server and ends cleanly right after all running commands were properly handled. If this is called while reconnecting (and therefor no connection to the redis server exists) it is going to end the connection right away instead of resulting in further re-connections! All offline commands are going to be flushed with an error in that case.
-
def
removeAllListeners(): RedisClient.this.type
- Definition Classes
- IEventEmitter
-
def
removeAllListeners(eventName: String): RedisClient.this.type
- Definition Classes
- IEventEmitter
-
def
removeListener(eventName: String, listener: Function): RedisClient.this.type
- Definition Classes
- IEventEmitter
- def rename(fromKey: String, toKey: String, callback: RedisCallback[RedisResponse] = js.native): Unit
-
def
sadd(key: String, value: String): Unit
sadd("bigset", "a member");
Example: - def scan[T](cursor: Int, command0: String, arg0: Any, command1: String, arg1: Any, command2: String, arg3: Any, callback: RedisCallback[T]): Unit
- def scan[T](cursor: Int, command0: String, arg0: Any, command1: String, arg1: Any, callback: RedisCallback[T]): Unit
- def scan[T](cursor: Int, command0: String, arg0: Any, callback: RedisCallback[T]): Unit
- def scan[T](cursor: Int, callback: RedisCallback[T]): Unit
-
def
script(args: String*): Unit
script('load', 'return 1')
Example: -
def
send_command(commandName: String, args: Array[String] = js.native, callback: RedisCallback[RedisResponse] = js.native): Unit
All Redis commands have been added to the client object.
All Redis commands have been added to the client object. However, if new commands are introduced before this library is updated, you can use send_command() to send arbitrary commands to Redis. The command_name has to be lower case.
All commands are sent as multi-bulk commands. args can either be an Array of arguments, or omitted / set to undefined.
- commandName
the command name
- args
the optional command arguments
- callback
the optional callback
-
def
server_info: Dictionary[Any]
After the ready probe completes, the results from the INFO command are saved in the client.server_info object.
-
def
set(args: Array[String], callback: RedisCallback[RedisResponse]): Unit
Sets key-value pairs
Sets key-value pairs
- args
the collection of key-value pairs
- callback
the callback
client.set(["some other key", "some val"]);
Example: -
def
set(args: Array[String]): Unit
Sets key-value pairs
Sets key-value pairs
- args
the collection of key-value pairs
client.set(["some other key", "some val"]);
Example: -
def
set(key: String, value: String, callback: RedisCallback[RedisResponse] = js.native): Unit
Sets a key-value pair
Sets a key-value pair
- key
the given key
- value
the given value
- callback
the callback
client.set("some key", "some val");
Example: -
def
setMaxListeners(n: Int): RedisClient.this.type
- Definition Classes
- IEventEmitter
-
def
stream: ReadStream
The client exposed the used stream in client.stream and if the stream or client had to buffer the command in client.should_buffer.
The client exposed the used stream in client.stream and if the stream or client had to buffer the command in client.should_buffer. In combination this can be used to implement backpressure by checking the buffer state before sending a command and listening to the stream drain event.
- def subscribe(channel: RedisChannel): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
- def unsubscribe(): Unit
-
val
usingDomains: Boolean
- Definition Classes
- IEventEmitter
-
def
valueOf(): Any
- Definition Classes
- Object
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- def zadd(args: Array[Any], callback: RedisCallback[RedisResponse]): Unit
- def zrevrangebyscore(args: Array[Any], callback: RedisCallback[RedisResponse]): Unit