Public Class SubscriptionMessageEventArgs
Public Property Key As String
Public Property value As String
''' Initializes a new instance of the SubscriptionMessageEventArgs class.
Public Sub New(ByVal key As String, ByVal value As String)
Me.Key = key
Me.value = value
''' The redis store encapsulation class around the ServiceStack redis client
''' <remarks>This class is cumulatively constructed across the tutorial and is not broken.</remarks>
Public Class RedisStore
#Region " Properties "
Private _sourceClient As RedisClient
Public ReadOnly Property SourceClient() As RedisClient
#Region " Event "
Public Event OnSubscriptionMessage As EventHandler(Of SubscriptionMessageEventArgs)
#Region " Constructors "
Public Sub New()
Public Sub New(ByVal ForceCheckServer As Boolean)
_sourceClient = New RedisClient
If ForceCheckServer AndAlso Not IsServerAlive() Then
Throw New Exception("The server has not been started!")
Public Function IsServerAlive() As Boolean
Catch ex As Exception
#Region " Functionalities "
#Region " Get/Set Keys "
Public Function SetKey(ByVal key As String, ByVal value As String) As Boolean
Return SourceClient.Set(key, value)
Public Function SetKey(Of T)(ByVal key As String, ByVal value As T) As Boolean
Return SourceClient.Set(Of T)(key, value)
Public Function GetKey(ByVal key As String) As String
Public Function GetKey(Of T)(ByVal key As String) As T
Return SourceClient.Get(Of T)(key)
#Region " Pub/Sub "
Public Sub Subscribe(ByVal ParamArray channels() As String)
Dim SubClient As IRedisSubscription = SourceClient.CreateSubscription
SubClient.OnMessage = New Action(Of String, String)(AddressOf OnMessage)
Private Sub OnMessage(ByVal channel As String, ByVal value As String)
RaiseEvent OnSubscriptionMessage(Me, New SubscriptionMessageEventArgs(channel, value))
Public Sub Publish(ByVal channel As String, ByVal value As String)
Public Class Helper
Private Shared ReadOnly UTF8EncObj As New System.Text.UTF8Encoding()
Public Shared Function GetBytes(ByVal source As Object) As Byte()
Public Shared Function GetString(ByVal sourceBytes As Byte()) As String
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Hariharan leapt into the field of programming after being introduced to C in his second year at college. A fan of basketball and chess, the logical thought process behind programming and the concepts of linking real principles onto a concrete platform pushed him deep into this field. On finishing his bachelor's majoring in Electrical and Electronics engineering with Soft Computing, Numerical Analysis and Biomedical Engineering as minor, he did a six month stint at India's second largest IT company- Infosys Technologies. He left Infosys armed with strong concepts of SDL Cycles and process development, gained domain knowledge in Java and had explored Visual basic, C++, C# and kept his mind open for more. Currently working in a startup as the product designer, his arsenal of technologies has doubled to accommodate the challenges his job demands.
Off work, he enjoys learning new languages (non-programming) and is currently teaching himself German and Spanish. He also enjoys travelling around and exploring new ideas, places and relationships.
Currently attempting to extend his education to post graduation.