Imports System.Net.Sockets
Imports System.Text
Imports vRedis.Commands
Public Class RedisClient
Private client As TcpClient
Private stream As NetworkStream
Private reply As RedisReply
Private command As IRedisCommand
Public ReadOnly Property Host As String
Public ReadOnly Property Port As Integer
Public ReadOnly Property [Return] As Object
Get
Return reply.Value
End Get
End Property
Public Sub New(Optional host As String = "127.0.0.1", Optional port As Integer = 6379)
If IsNothing(host) Then
Throw New ArgumentNullException(NameOf(host))
End If
Me.Host = host
Me.Port = port
client = New TcpClient()
Try
client.Connect(host, port)
stream = client.GetStream()
Catch ex As Exception
Throw New RedisException("An existing connection was forcibly closed by remote host.")
End Try
End Sub
Public Sub Quit()
command = New QuitCommand()
Execute(command)
End Sub
Public Sub Append(key As String, value As String)
comma