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的短链接设计思路

[Markdown阅读][1]今天上班的时候收到一个需要短链接的需求,之前的做法都是使用了新浪的短链接API(https://api.weibo.com/2/short_url/shorten.json)。但一是外网访问,二可能是新浪有所限制(毕竟是免...

Redis 指令手册中文版

连接控制 QUIT 关闭连接 AUTH (仅限启用时)简单的密码验证 适合全体类型的命令 EXISTS key 判断一个键是否存在;存在返回 1;否则返回0; DEL key 删除某个key,或是一系列key;DEL key1 key2 key3 key4 TYPE key 返回...

Cacti监控Redis实现过程

Cacti 是一套基于PHP,MySQL,SNMP及RRDTool开发的网络流量监测图形分析工具。被广泛的用于对服务器的运维监控中,Cacti提供了一种插件 式的管理,只要按要求写好特定的模板,那么你就可以对任何服...

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