C# Class NodeNetAsync.Db.Redis.RedisClient

Simple non-binary-safe Redis Async Client.
Exibir arquivo Open project: soywiz/NodeNetAsync Class Usage Examples

Protected Properties

Property Type Description
Encoding System.Text.Encoding
TcpClient NodeNetAsync.Net.TcpSocket

Public Methods

Method Description
AppendAsync ( string Key, string Value ) : Task

Append a value to a key

O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Redis will double the free space available on every reallocation. If key already exists and is a string, this command appends the value at the end of the string. If key does not exist it is created and set as an empty string, so APPEND will be similar to SET in this special case.

AuthAsync ( string Password ) : Task

Authenticate to the server

Request for authentication in a password protected Redis server. Redis can be instructed to require a password before allowing clients to execute commands. This is done using the requirepass directive in the configuration file. If password matches the password in the configuration file, the server replies with the OK status code and starts accepting commands. Otherwise, an error is returned and the clients needs to try a new password. Note: because of the high performance nature of Redis, it is possible to try a lot of passwords in parallel in very short time, so make sure to generate a strong and very long password so that this attack is infeasible.

BackgroundRewriteAofAsync ( ) : System.Threading.Tasks.Task

Asynchronously rewrite the append-only file

Rewrites the append-only file to reflect the current dataset in memory. If BGREWRITEAOF fails, no data gets lost as the old AOF will be untouched.

BackgroundSave ( ) : System.Threading.Tasks.Task

Asynchronously save the dataset to disk

Save the DB in background. The OK code is immediately returned. Redis forks, the parent continues to server the clients, the child saves the DB on disk then exit. A client my be able to check if the operation succeeded using the LASTSAVE command.

CloseAsync ( ) : System.Threading.Tasks.Task

CommandAsync ( ) : Task

Sends a command to the redis server

CreateAndConnectAsync ( string Host, ushort Port = 6379, Encoding Encoding = null, string Password = null ) : Task

GetAsync ( string Key ) : Task

SetAsync ( string Key, string Value ) : System.Threading.Tasks.Task

Protected Methods

Method Description
ConnectAsync ( string Host, ushort Port = 6379, string Password = null ) : System.Threading.Tasks.Task

ReadValueAsync ( ) : Task

RedisClient ( Encoding Encoding = null ) : System

Method Details

AppendAsync() public method

Append a value to a key
O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Redis will double the free space available on every reallocation. If key already exists and is a string, this command appends the value at the end of the string. If key does not exist it is created and set as an empty string, so APPEND will be similar to SET in this special case.
public AppendAsync ( string Key, string Value ) : Task
Key string
Value string
return Task

AuthAsync() public method

Authenticate to the server
Request for authentication in a password protected Redis server. Redis can be instructed to require a password before allowing clients to execute commands. This is done using the requirepass directive in the configuration file. If password matches the password in the configuration file, the server replies with the OK status code and starts accepting commands. Otherwise, an error is returned and the clients needs to try a new password. Note: because of the high performance nature of Redis, it is possible to try a lot of passwords in parallel in very short time, so make sure to generate a strong and very long password so that this attack is infeasible.
public AuthAsync ( string Password ) : Task
Password string
return Task

BackgroundRewriteAofAsync() public method

Asynchronously rewrite the append-only file
Rewrites the append-only file to reflect the current dataset in memory. If BGREWRITEAOF fails, no data gets lost as the old AOF will be untouched.
public BackgroundRewriteAofAsync ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task

BackgroundSave() public method

Asynchronously save the dataset to disk
Save the DB in background. The OK code is immediately returned. Redis forks, the parent continues to server the clients, the child saves the DB on disk then exit. A client my be able to check if the operation succeeded using the LASTSAVE command.
public BackgroundSave ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task

CloseAsync() public method

public CloseAsync ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task

CommandAsync() public method

Sends a command to the redis server
public CommandAsync ( ) : Task
return Task

ConnectAsync() protected method

protected ConnectAsync ( string Host, ushort Port = 6379, string Password = null ) : System.Threading.Tasks.Task
Host string
Port ushort
Password string
return System.Threading.Tasks.Task

CreateAndConnectAsync() static public method

static public CreateAndConnectAsync ( string Host, ushort Port = 6379, Encoding Encoding = null, string Password = null ) : Task
Host string
Port ushort
Encoding System.Text.Encoding
Password string
return Task

GetAsync() public method

public GetAsync ( string Key ) : Task
Key string
return Task

ReadValueAsync() protected method

protected ReadValueAsync ( ) : Task
return Task

RedisClient() protected method

protected RedisClient ( Encoding Encoding = null ) : System
Encoding System.Text.Encoding
return System

SetAsync() public method

public SetAsync ( string Key, string Value ) : System.Threading.Tasks.Task
Key string
Value string
return System.Threading.Tasks.Task

Property Details

Encoding protected_oe property

protected Encoding,System.Text Encoding
return System.Text.Encoding

TcpClient protected_oe property

protected TcpSocket,NodeNetAsync.Net TcpClient
return NodeNetAsync.Net.TcpSocket