ItGo.me - 专注IT技术分享

首页 > Redis > VB.NET 操作 Redis 数据

VB.NET 操作 Redis 数据

时间:2016-08-28来源:网友分享 点击:
本代码介绍在 VB.NET 环境下如何使用 Redis 来存取数据
标签:
代码片段(3)
1. [文件]RedisExample01_demo.zip ~ 236KB    (47)    
2. [文件]RedisExample01_src.zip ~ 736KB    (38)    
3. [代码][ASP/Basic]代码    跳至
Imports ServiceStack.Redis''' <summary>''' The redis store encapsulation class around the ServiceStack redis client''' </summary>''' <remarks>This class is cumulatively constructed across the tutorial''' and is not broken.''' </remarks>Public Class RedisStore#Region " Properties "Private _sourceClient As RedisClientPublic ReadOnly Property SourceClient() As RedisClientGetReturn _sourceClientEnd GetEnd Property#End Region#Region " Constructors "Public Sub New()MyClass.New(False)End SubPublic Sub New(ByVal ForceCheckServer As Boolean)_sourceClient = New RedisClientIf ForceCheckServer AndAlso Not IsServerAlive() ThenThrow New Exception("The server has not been started!")End IfEnd Sub#End RegionPublic Function IsServerAlive() As BooleanTryReturn SourceClient.PingCatch ex As ExceptionReturn FalseEnd TryEnd Function#Region " Functionalities "#Region " Get/Set Keys "Public Function SetKey(ByVal key As String, ByVal value As String) As BooleanReturn SourceClient.Set(key, value)End FunctionPublic Function SetKey(Of T)(ByVal key As String, ByVal value As T) As BooleanReturn SourceClient.Set(Of T)(key, value)End FunctionPublic Function GetKey(ByVal key As String) As StringReturn Helper.GetString(SourceClient.Get(key))End FunctionPublic Function GetKey(Of T)(ByVal key As String) As TReturn SourceClient.Get(Of T)(key)End Function#End Region#End RegionEnd ClassPublic Class HelperPrivate Shared ReadOnly UTF8EncObj As New System.Text.UTF8Encoding()Public Shared Function GetBytes(ByVal source As Object) As Byte()Return UTF8EncObj.GetBytes(source)End FunctionPublic Shared Function GetString(ByVal sourceBytes As Byte()) As StringReturn UTF8EncObj.GetString(sourceBytes)End FunctionEnd Class

VB.NET 操作 Redis 数据

VB.NET 操作 Redis 数据  讨论


Redis 复制原理及分析

1.测试 见master-slave测试帖 2 原理 第一 次、 Slave向Master同步的实现是: Slave向Master发出同步请求( 发送sync命令 ),Master先dump出rdb文件,然后将rdb文件全量传输给slave,然后Master把缓存的写命令...

Bytengine :基于Mongodb、Redis、Go和Python开发的内容存储库

是一个采用 Mongodb, Redis, Go + Python开发可扩展的内容存储库。可以用任何HTTP客户端库访问它的API,所以您可以使用自己擅长的语言进行编码! 将内容存储在伪分层的文件系统,查询使用它内置...

redis的清空hashtable的函数

redis的清空hashtable的函数标签: 代码片段 (1) 1. [代码] [C/C++]代码 跳至 void htruncateCommand(redisClient *c){robj *o;int len = 0;int i =1;if ((o = lookupKeyWrite(c-db, c-argv[i])) == NULL ||checkType(c,o,REDIS_HASH)){addReplyStatu...

本代码介绍在 VB.NET 环境下如何使用 Redis 来存取数据 标签: 代码片段 (3) 1. [文件] RedisExample01_demo.zip~236KB(47) 2. [文件] RedisExample01_src.zip~736KB(38) 3. [代码] [ASP/Basic]代码 跳至 Imports ServiceStack.Redis
------分隔线----------------------------