Commit a5924d38 by mahaisong

fix:redis测试部分完成

parent e8daefb8
1.Testredis 是form 用的简单的pool
2.TestRedisCMD 是CMD程序,用的是palas改造的。(里面代码有改动,不能再复制回去。但是调用方法接口都没改变,可以直接使用)
\ No newline at end of file
......@@ -5,6 +5,15 @@ VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Redis_UnitTestProject", "Redis_UnitTestProject\Redis_UnitTestProject.csproj", "{C32E6371-E9F9-41B3-BA4C-31627BF0B64D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRedis", "TestRedis\TestRedis.csproj", "{DF44A0D5-4D64-4391-81BA-200ED75F6C5D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRedisCMD", "TestRedisCMD\TestRedisCMD.csproj", "{9559A4C8-B83A-4E8D-8C1C-65563A409240}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C3218F35-6CF9-49FC-A0BB-326C1F77679C}"
ProjectSection(SolutionItems) = preProject
ReadMe.txt = ReadMe.txt
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -15,6 +24,14 @@ Global
{C32E6371-E9F9-41B3-BA4C-31627BF0B64D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C32E6371-E9F9-41B3-BA4C-31627BF0B64D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C32E6371-E9F9-41B3-BA4C-31627BF0B64D}.Release|Any CPU.Build.0 = Release|Any CPU
{DF44A0D5-4D64-4391-81BA-200ED75F6C5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF44A0D5-4D64-4391-81BA-200ED75F6C5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF44A0D5-4D64-4391-81BA-200ED75F6C5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF44A0D5-4D64-4391-81BA-200ED75F6C5D}.Release|Any CPU.Build.0 = Release|Any CPU
{9559A4C8-B83A-4E8D-8C1C-65563A409240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9559A4C8-B83A-4E8D-8C1C-65563A409240}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9559A4C8-B83A-4E8D-8C1C-65563A409240}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9559A4C8-B83A-4E8D-8C1C-65563A409240}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
D:\smallproject\8.2RedisKafka_UnitTestProject\Redis_UnitTestProject\bin\Debug\Redis_UnitTestProject.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\Redis_UnitTestProject\bin\Debug\Redis_UnitTestProject.pdb
D:\smallproject\8.2RedisKafka_UnitTestProject\Redis_UnitTestProject\bin\Debug\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\Redis_UnitTestProject\bin\Debug\zh-Hans\Microsoft.VisualStudio.QualityTools.UnitTestFramework.resources.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\Redis_UnitTestProject\obj\Debug\Redis_UnitTestProject.csprojResolveAssemblyReference.cache
D:\smallproject\8.2RedisKafka_UnitTestProject\Redis_UnitTestProject\obj\Debug\Redis_UnitTestProject.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\Redis_UnitTestProject\obj\Debug\Redis_UnitTestProject.pdb
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
\ No newline at end of file
namespace TestRedis
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Text = "Form1";
}
#endregion
}
}
using ServiceStack.Redis;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TestRedis
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
//string key = "p";
// RedisBase.Core 实质上 是 RedisManager.GetClient() 是IRedisClient--- PooledRedisClientManager.GetClient()
//注意,此方法没有归还redis的clinet--需改进
RedisBase.Core.FlushAll();
//RedisBase.Core.AddItemToList
// (key,"1");
//RedisBase.Core.AddItemToList
// (key, "2");
//long keycount=RedisBase.Core.GetListCount(key);
//string a = RedisBase.Core.GetItemFromList(key, 0)
//RedisBase.Core.AddItemToList(key, "456");
//RedisBase.Core.Add<String>("ptest", "123456");
string key = "ptes";
//RedisBase.Core.Set<int>(key, 1);
//long newvalue = 0;
//int b = RedisBase.Core.Get<int>(key);
//try
//{
// //事务本身是2步走,不能拆开。
// //1.得到旧值
// //2.+1,更新为新值
// newvalue= RedisBase.Core.IncrementValue(key);
//}
//catch (Exception ex)
//{
// MessageBox.Show(ex.ToString());
//}
//放置1个对象,同时每个线程去操作对象。
Parallel.For(0, 10000, (index) =>
{
RedisBase.Core.IncrementValue(key);
});
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TestRedis
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("TestRedis")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestRedis")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("df44a0d5-4d64-4391-81ba-200ed75f6c5d")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestRedis.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestRedis.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestRedis.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
using ServiceStack.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestRedis
{
/// <summary>
/// RedisBase类,是redis操作的基类,继承自IDisposable接口,主要用于释放内存
/// </summary>
public abstract class RedisBase : IDisposable
{
public static IRedisClient Core { get; private set; }
private bool _disposed = false;
static RedisBase()
{
Core = RedisManager.GetClient();
}
protected virtual void Dispose(bool disposing)
{
if (!this._disposed)
{
if (disposing)
{
Core.Dispose();
Core = null;
}
}
this._disposed = true;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// 保存数据DB文件到硬盘
/// </summary>
public void Save()
{
Core.Save();
}
/// <summary>
/// 异步保存数据DB文件到硬盘
/// </summary>
public void SaveAsync()
{
Core.SaveAsync();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestRedis
{
public sealed class RedisConfig
{
public static string WriteServerConStr
{
get
{
return string.Format("{0}", "127.0.0.1:6379");
}
}
public static string ReadServerConStr
{
get
{
return string.Format("{0}", "127.0.0.1:6379");
}
}
public static int MaxWritePoolSize
{
get
{
return 50;
}
}
public static int MaxReadPoolSize
{
get
{
return 200;
}
}
public static bool AutoStart
{
get
{
return true;
}
}
}
}
using ServiceStack.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestRedis
{
class RedisManager
{
private static PooledRedisClientManager prcm;
/// <summary>
/// 静态构造方法,初始化链接池管理对象
/// </summary>
static RedisManager()
{
CreateManager();
}
/// <summary>
/// 创建链接池管理对象
/// </summary>
private static void CreateManager()
{
string[] WriteServerConStr = SplitString(RedisConfig.WriteServerConStr, ",");
string[] ReadServerConStr = SplitString(RedisConfig.ReadServerConStr, ",");
prcm = new PooledRedisClientManager(ReadServerConStr, WriteServerConStr,
new RedisClientManagerConfig
{
MaxWritePoolSize = RedisConfig.MaxWritePoolSize,
MaxReadPoolSize = RedisConfig.MaxReadPoolSize,
AutoStart = RedisConfig.AutoStart,
});
}
private static string[] SplitString(string strSource, string split)
{
return strSource.Split(split.ToArray());
}
/// <summary>
/// 客户端缓存操作对象
/// </summary>
public static IRedisClient GetClient()
{
if (prcm == null)
CreateManager();
return prcm.GetClient();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestRedis
{
class RedisHash : RedisBase
{
#region 添加
/// <summary>
/// 向hashid集合中添加key/value
/// </summary>
public static bool SetEntryInHash(string hashid, string key, string value)
{
return RedisBase.Core.SetEntryInHash(hashid, key, value);
}
/// <summary>
/// 如果hashid集合中存在key/value则不添加返回false,如果不存在在添加key/value,返回true
/// </summary>
public static bool SetEntryInHashIfNotExists(string hashid, string key, string value)
{
return RedisBase.Core.SetEntryInHashIfNotExists(hashid, key, value);
}
/// <summary>
/// 存储对象T t到hash集合中
/// </summary>
public static void StoreAsHash<T>(T t)
{
RedisBase.Core.StoreAsHash<T>(t);
}
#endregion
#region 获取
/// <summary>
/// 获取对象T中ID为id的数据。
/// </summary>
public static T GetFromHash<T>(object id)
{
return RedisBase.Core.GetFromHash<T>(id);
}
/// <summary>
/// 获取所有hashid数据集的key/value数据集合
/// </summary>
public static Dictionary<string, string> GetAllEntriesFromHash(string hashid)
{
return RedisBase.Core.GetAllEntriesFromHash(hashid);
}
/// <summary>
/// 获取hashid数据集中的数据总数
/// </summary>
public static long GetHashCount(string hashid)
{
return RedisBase.Core.GetHashCount(hashid);
}
/// <summary>
/// 获取hashid数据集中所有key的集合
/// </summary>
public static List<string> GetHashKeys(string hashid)
{
return RedisBase.Core.GetHashKeys(hashid);
}
/// <summary>
/// 获取hashid数据集中的所有value集合
/// </summary>
public static List<string> GetHashValues(string hashid)
{
return RedisBase.Core.GetHashValues(hashid);
}
/// <summary>
/// 获取hashid数据集中,key的value数据
/// </summary>
public static string GetValueFromHash(string hashid, string key)
{
return RedisBase.Core.GetValueFromHash(hashid, key);
}
/// <summary>
/// 获取hashid数据集中,多个keys的value集合
/// </summary>
public static List<string> GetValuesFromHash(string hashid, string[] keys)
{
return RedisBase.Core.GetValuesFromHash(hashid, keys);
}
#endregion
#region 删除
#endregion
/// <summary>
/// 删除hashid数据集中的key数据
/// </summary>
public static bool RemoveEntryFromHash(string hashid, string key)
{
return RedisBase.Core.RemoveEntryFromHash(hashid, key);
}
#region 其它
/// <summary>
/// 判断hashid数据集中是否存在key的数据
/// </summary>
public static bool HashContainsEntry(string hashid, string key)
{
return RedisBase.Core.HashContainsEntry(hashid, key);
}
/// <summary>
/// 给hashid数据集key的value加countby,返回相加后的数据
/// </summary>
public static double IncrementValueInHash(string hashid, string key, double countBy)
{
return RedisBase.Core.IncrementValueInHash(hashid, key, countBy);
}
#endregion
}
}
\ No newline at end of file
using ServiceStack.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestRedis
{
class RedisList : RedisBase
{
#region 赋值
/// <summary>
/// 从左侧向list中添加值
/// </summary>
public static void LPush(string key, string value)
{
RedisBase.Core.PushItemToList(key, value);
}
/// <summary>
/// 从左侧向list中添加值,并设置过期时间
/// </summary>
public static void LPush(string key, string value, DateTime dt)
{
RedisBase.Core.PushItemToList(key, value);
RedisBase.Core.ExpireEntryAt(key, dt);
}
/// <summary>
/// 从左侧向list中添加值,设置过期时间
/// </summary>
public static void LPush(string key, string value, TimeSpan sp)
{
RedisBase.Core.PushItemToList(key, value);
RedisBase.Core.ExpireEntryIn(key, sp);
}
/// <summary>
/// 从左侧向list中添加值
/// </summary>
public static void RPush(string key, string value)
{
RedisBase.Core.PrependItemToList(key, value);
}
/// <summary>
/// 从右侧向list中添加值,并设置过期时间
/// </summary>
public static void RPush(string key, string value, DateTime dt)
{
RedisBase.Core.PrependItemToList(key, value);
RedisBase.Core.ExpireEntryAt(key, dt);
}
/// <summary>
/// 从右侧向list中添加值,并设置过期时间
/// </summary>
public static void RPush(string key, string value, TimeSpan sp)
{
RedisBase.Core.PrependItemToList(key, value);
RedisBase.Core.ExpireEntryIn(key, sp);
}
/// <summary>
/// 添加key/value
/// </summary>
public static void Add(string key, string value)
{
RedisBase.Core.AddItemToList(key, value);
}
/// <summary>
/// 添加key/value ,并设置过期时间
/// </summary>
public static void Add(string key, string value, DateTime dt)
{
RedisBase.Core.AddItemToList(key, value);
RedisBase.Core.ExpireEntryAt(key, dt);
}
/// <summary>
/// 添加key/value。并添加过期时间
/// </summary>
public static void Add(string key, string value, TimeSpan sp)
{
RedisBase.Core.AddItemToList(key, value);
RedisBase.Core.ExpireEntryIn(key, sp);
}
/// <summary>
/// 为key添加多个值
/// </summary>
public static void Add(string key, List<string> values)
{
RedisBase.Core.AddRangeToList(key, values);
}
/// <summary>
/// 为key添加多个值,并设置过期时间
/// </summary>
public static void Add(string key, List<string> values, DateTime dt)
{
RedisBase.Core.AddRangeToList(key, values);
RedisBase.Core.ExpireEntryAt(key, dt);
}
/// <summary>
/// 为key添加多个值,并设置过期时间
/// </summary>
public static void Add(string key, List<string> values, TimeSpan sp)
{
RedisBase.Core.AddRangeToList(key, values);
RedisBase.Core.ExpireEntryIn(key, sp);
}
#endregion
#region 获取值
/// <summary>
/// 获取list中key包含的数据数量
/// </summary>
public static long Count(string key)
{
return RedisBase.Core.GetListCount(key);
}
/// <summary>
/// 获取key包含的所有数据集合
/// </summary>
public static List<string> Get(string key)
{
return RedisBase.Core.GetAllItemsFromList(key);
}
/// <summary>
/// 获取key中下标为star到end的值集合
/// </summary>
public static List<string> Get(string key, int star, int end)
{
return RedisBase.Core.GetRangeFromList(key, star, end);
}
#endregion
#region 阻塞命令
/// <summary>
/// 阻塞命令:从list中keys的尾部移除一个值,并返回移除的值,阻塞时间为sp
/// </summary>
public static string BlockingPopItemFromList(string key, TimeSpan? sp)
{
return RedisBase.Core.BlockingDequeueItemFromList(key, sp);
}
/// <summary>
/// 阻塞命令:从list中keys的尾部移除一个值,并返回移除的值,阻塞时间为sp
/// </summary>
public static ItemRef BlockingPopItemFromLists(string[] keys, TimeSpan? sp)
{
return RedisBase.Core.BlockingPopItemFromLists(keys, sp);
}
/// <summary>
/// 阻塞命令:从list中keys的尾部移除一个值,并返回移除的值,阻塞时间为sp
/// </summary>
public static string BlockingDequeueItemFromList(string key, TimeSpan? sp)
{
return RedisBase.Core.BlockingDequeueItemFromList(key, sp);
}
/// <summary>
/// 阻塞命令:从list中keys的尾部移除一个值,并返回移除的值,阻塞时间为sp
/// </summary>
public static ItemRef BlockingDequeueItemFromLists(string[] keys, TimeSpan? sp)
{
return RedisBase.Core.BlockingDequeueItemFromLists(keys, sp);
}
/// <summary>
/// 阻塞命令:从list中key的头部移除一个值,并返回移除的值,阻塞时间为sp
/// </summary>
public static string BlockingRemoveStartFromList(string keys, TimeSpan? sp)
{
return RedisBase.Core.BlockingRemoveStartFromList(keys, sp);
}
/// <summary>
/// 阻塞命令:从list中key的头部移除一个值,并返回移除的值,阻塞时间为sp
/// </summary>
public static ItemRef BlockingRemoveStartFromLists(string[] keys, TimeSpan? sp)
{
return RedisBase.Core.BlockingRemoveStartFromLists(keys, sp);
}
/// <summary>
/// 阻塞命令:从list中一个fromkey的尾部移除一个值,添加到另外一个tokey的头部,并返回移除的值,阻塞时间为sp
/// </summary>
public static string BlockingPopAndPushItemBetweenLists(string fromkey, string tokey, TimeSpan? sp)
{
return RedisBase.Core.BlockingPopAndPushItemBetweenLists(fromkey, tokey, sp);
}
#endregion
#region 删除
/// <summary>
/// 从尾部移除数据,返回移除的数据
/// </summary>
public static string PopItemFromList(string key)
{
return RedisBase.Core.PopItemFromList(key);
}
/// <summary>
/// 移除list中,key/value,与参数相同的值,并返回移除的数量
/// </summary>
public static long RemoveItemFromList(string key, string value)
{
return RedisBase.Core.RemoveItemFromList(key, value);
}
/// <summary>
/// 从list的尾部移除一个数据,返回移除的数据
/// </summary>
public static string RemoveEndFromList(string key)
{
return RedisBase.Core.RemoveEndFromList(key);
}
/// <summary>
/// 从list的头部移除一个数据,返回移除的值
/// </summary>
public static string RemoveStartFromList(string key)
{
return RedisBase.Core.RemoveStartFromList(key);
}
#endregion
#region 其它
/// <summary>
/// 从一个list的尾部移除一个数据,添加到另外一个list的头部,并返回移动的值
/// </summary>
public static string PopAndPushItemBetweenLists(string fromKey, string toKey)
{
return RedisBase.Core.PopAndPushItemBetweenLists(fromKey, toKey);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestRedis
{
class RedisSet : RedisBase
{
#region 添加
/// <summary>
/// key集合中添加value值
/// </summary>
public static void Add(string key, string value)
{
RedisBase.Core.AddItemToSet(key, value);
}
/// <summary>
/// key集合中添加list集合
/// </summary>
public static void Add(string key, List<string> list)
{
RedisBase.Core.AddRangeToSet(key, list);
}
#endregion
#region 获取
/// <summary>
/// 随机获取key集合中的一个值
/// </summary>
public static string GetRandomItemFromSet(string key)
{
return RedisBase.Core.GetRandomItemFromSet(key);
}
/// <summary>
/// 获取key集合值的数量
/// </summary>
public static long GetCount(string key)
{
return RedisBase.Core.GetSetCount(key);
}
/// <summary>
/// 获取所有key集合的值
/// </summary>
public static HashSet<string> GetAllItemsFromSet(string key)
{
return RedisBase.Core.GetAllItemsFromSet(key);
}
#endregion
#region 删除
/// <summary>
/// 随机删除key集合中的一个值
/// </summary>
public static string PopItemFromSet(string key)
{
return RedisBase.Core.PopItemFromSet(key);
}
/// <summary>
/// 删除key集合中的value
/// </summary>
public static void RemoveItemFromSet(string key, string value)
{
RedisBase.Core.RemoveItemFromSet(key, value);
}
#endregion
#region 其它
/// <summary>
/// 从fromkey集合中移除值为value的值,并把value添加到tokey集合中
/// </summary>
public static void MoveBetweenSets(string fromkey, string tokey, string value)
{
RedisBase.Core.MoveBetweenSets(fromkey, tokey, value);
}
/// <summary>
/// 返回keys多个集合中的并集,返还hashset
/// </summary>
public static HashSet<string> GetUnionFromSets(string[] keys)
{
return RedisBase.Core.GetUnionFromSets(keys);
}
/// <summary>
/// keys多个集合中的并集,放入newkey集合中
/// </summary>
public static void StoreUnionFromSets(string newkey, string[] keys)
{
RedisBase.Core.StoreUnionFromSets(newkey, keys);
}
/// <summary>
/// 把fromkey集合中的数据与keys集合中的数据对比,fromkey集合中不存在keys集合中,则把这些不存在的数据放入newkey集合中
/// </summary>
public static void StoreDifferencesFromSet(string newkey, string fromkey, string[] keys)
{
RedisBase.Core.StoreDifferencesFromSet(newkey, fromkey, keys);
}
#endregion
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestRedis
{
public class RedisString : RedisBase
{
#region 赋值
/// <summary>
/// 设置key的value
/// </summary>
public static bool Set(string key, string value)
{
return RedisBase.Core.Set<string>(key, value);
}
/// <summary>
/// 设置key的value并设置过期时间
/// </summary>
public static bool Set(string key, string value, DateTime dt)
{
return RedisBase.Core.Set<string>(key, value, dt);
}
/// <summary>
/// 设置key的value并设置过期时间
/// </summary>
public static bool Set(string key, string value, TimeSpan sp)
{
return RedisBase.Core.Set<string>(key, value, sp);
}
/// <summary>
/// 设置多个key/value
/// </summary>
public static void Set(Dictionary<string, string> dic)
{
RedisBase.Core.SetAll(dic);
}
#endregion
#region 追加
/// <summary>
/// 在原有key的value值之后追加value
/// </summary>
public static long Append(string key, string value)
{
return RedisBase.Core.AppendToValue(key, value);
}
#endregion
#region 获取值
/// <summary>
/// 获取key的value值
/// </summary>
public static string Get(string key)
{
return RedisBase.Core.GetValue(key);
}
/// <summary>
/// 获取多个key的value值
/// </summary>
public static List<string> Get(List<string> keys)
{
return RedisBase.Core.GetValues(keys);
}
/// <summary>
/// 获取多个key的value值
/// </summary>
public static List<T> Get<T>(List<string> keys)
{
return RedisBase.Core.GetValues<T>(keys);
}
#endregion
#region 获取旧值赋上新值
/// <summary>
/// 获取旧值赋上新值
/// </summary>
public static string GetAndSetValue(string key, string value)
{
return RedisBase.Core.GetAndSetValue(key, value);
}
#endregion
#region 辅助方法
/// <summary>
/// 获取值的长度
/// </summary>
public static long GetCount(string key)
{
return RedisBase.Core.GetStringCount(key);
}
/// <summary>
/// 自增1,返回自增后的值
/// </summary>
public static long Incr(string key)
{
return RedisBase.Core.IncrementValue(key);
}
/// <summary>
/// 自增count,返回自增后的值
/// </summary>
public static double IncrBy(string key, double count)
{
return RedisBase.Core.IncrementValueBy(key, count);
}
/// <summary>
/// 自减1,返回自减后的值
/// </summary>
public static long Decr(string key)
{
return RedisBase.Core.DecrementValue(key);
}
/// <summary>
/// 自减count ,返回自减后的值
/// </summary>
/// <param name="key"></param>
/// <param name="count"></param>
/// <returns></returns>
public static long DecrBy(string key, int count)
{
return RedisBase.Core.DecrementValueBy(key, count);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestRedis
{
class RedisZSet : RedisBase
{
#region 添加
/// <summary>
/// 添加key/value,默认分数是从1.多*10的9次方以此递增的,自带自增效果
/// </summary>
public static bool AddItemToSortedSet(string key, string value)
{
return RedisBase.Core.AddItemToSortedSet(key, value);
}
/// <summary>
/// 添加key/value,并设置value的分数
/// </summary>
public static bool AddItemToSortedSet(string key, string value, double score)
{
return RedisBase.Core.AddItemToSortedSet(key, value, score);
}
/// <summary>
/// 为key添加values集合,values集合中每个value的分数设置为score
/// </summary>
public static bool AddRangeToSortedSet(string key, List<string> values, double score)
{
return RedisBase.Core.AddRangeToSortedSet(key, values, score);
}
/// <summary>
/// 为key添加values集合,values集合中每个value的分数设置为score
/// </summary>
public static bool AddRangeToSortedSet(string key, List<string> values, long score)
{
return RedisBase.Core.AddRangeToSortedSet(key, values, score);
}
#endregion
#region 获取
/// <summary>
/// 获取key的所有集合
/// </summary>
public static List<string> GetAllItemsFromSortedSet(string key)
{
return RedisBase.Core.GetAllItemsFromSortedSet(key);
}
/// <summary>
/// 获取key的所有集合,倒叙输出
/// </summary>
public static List<string> GetAllItemsFromSortedSetDesc(string key)
{
return RedisBase.Core.GetAllItemsFromSortedSetDesc(key);
}
/// <summary>
/// 获取可以的说有集合,带分数
/// </summary>
public static IDictionary<string, double> GetAllWithScoresFromSortedSet(string key)
{
return RedisBase.Core.GetAllWithScoresFromSortedSet(key);
}
/// <summary>
/// 获取key为value的下标值
/// </summary>
public static long GetItemIndexInSortedSet(string key, string value)
{
return RedisBase.Core.GetItemIndexInSortedSet(key, value);
}
/// <summary>
/// 倒叙排列获取key为value的下标值
/// </summary>
public static long GetItemIndexInSortedSetDesc(string key, string value)
{
return RedisBase.Core.GetItemIndexInSortedSetDesc(key, value);
}
/// <summary>
/// 获取key为value的分数
/// </summary>
public static double GetItemScoreInSortedSet(string key, string value)
{
return RedisBase.Core.GetItemScoreInSortedSet(key, value);
}
/// <summary>
/// 获取key所有集合的数据总数
/// </summary>
public static long GetSortedSetCount(string key)
{
return RedisBase.Core.GetSortedSetCount(key);
}
/// <summary>
/// key集合数据从分数为fromscore到分数为toscore的数据总数
/// </summary>
public static long GetSortedSetCount(string key, double fromScore, double toScore)
{
return RedisBase.Core.GetSortedSetCount(key, fromScore, toScore);
}
/// <summary>
/// 获取key集合从高分到低分排序数据,分数从fromscore到分数为toscore的数据
/// </summary>
public static List<string> GetRangeFromSortedSetByHighestScore(string key, double fromscore, double toscore)
{
return RedisBase.Core.GetRangeFromSortedSetByHighestScore(key, fromscore, toscore);
}
/// <summary>
/// 获取key集合从低分到高分排序数据,分数从fromscore到分数为toscore的数据
/// </summary>
public static List<string> GetRangeFromSortedSetByLowestScore(string key, double fromscore, double toscore)
{
return RedisBase.Core.GetRangeFromSortedSetByLowestScore(key, fromscore, toscore);
}
/// <summary>
/// 获取key集合从高分到低分排序数据,分数从fromscore到分数为toscore的数据,带分数
/// </summary>
public static IDictionary<string, double> GetRangeWithScoresFromSortedSetByHighestScore(string key, double fromscore, double toscore)
{
return RedisBase.Core.GetRangeWithScoresFromSortedSetByHighestScore(key, fromscore, toscore);
}
/// <summary>
/// 获取key集合从低分到高分排序数据,分数从fromscore到分数为toscore的数据,带分数
/// </summary>
public static IDictionary<string, double> GetRangeWithScoresFromSortedSetByLowestScore(string key, double fromscore, double toscore)
{
return RedisBase.Core.GetRangeWithScoresFromSortedSetByLowestScore(key, fromscore, toscore);
}
/// <summary>
/// 获取key集合数据,下标从fromRank到分数为toRank的数据
/// </summary>
public static List<string> GetRangeFromSortedSet(string key, int fromRank, int toRank)
{
return RedisBase.Core.GetRangeFromSortedSet(key, fromRank, toRank);
}
/// <summary>
/// 获取key集合倒叙排列数据,下标从fromRank到分数为toRank的数据
/// </summary>
public static List<string> GetRangeFromSortedSetDesc(string key, int fromRank, int toRank)
{
return RedisBase.Core.GetRangeFromSortedSetDesc(key, fromRank, toRank);
}
/// <summary>
/// 获取key集合数据,下标从fromRank到分数为toRank的数据,带分数
/// </summary>
public static IDictionary<string, double> GetRangeWithScoresFromSortedSet(string key, int fromRank, int toRank)
{
return RedisBase.Core.GetRangeWithScoresFromSortedSet(key, fromRank, toRank);
}
/// <summary>
/// 获取key集合倒叙排列数据,下标从fromRank到分数为toRank的数据,带分数
/// </summary>
public static IDictionary<string, double> GetRangeWithScoresFromSortedSetDesc(string key, int fromRank, int toRank)
{
return RedisBase.Core.GetRangeWithScoresFromSortedSetDesc(key, fromRank, toRank);
}
#endregion
#region 删除
/// <summary>
/// 删除key为value的数据
/// </summary>
public static bool RemoveItemFromSortedSet(string key, string value)
{
return RedisBase.Core.RemoveItemFromSortedSet(key, value);
}
/// <summary>
/// 删除下标从minRank到maxRank的key集合数据
/// </summary>
public static long RemoveRangeFromSortedSet(string key, int minRank, int maxRank)
{
return RedisBase.Core.RemoveRangeFromSortedSet(key, minRank, maxRank);
}
/// <summary>
/// 删除分数从fromscore到toscore的key集合数据
/// </summary>
public static long RemoveRangeFromSortedSetByScore(string key, double fromscore, double toscore)
{
return RedisBase.Core.RemoveRangeFromSortedSetByScore(key, fromscore, toscore);
}
/// <summary>
/// 删除key集合中分数最大的数据
/// </summary>
public static string PopItemWithHighestScoreFromSortedSet(string key)
{
return RedisBase.Core.PopItemWithHighestScoreFromSortedSet(key);
}
/// <summary>
/// 删除key集合中分数最小的数据
/// </summary>
public static string PopItemWithLowestScoreFromSortedSet(string key)
{
return RedisBase.Core.PopItemWithLowestScoreFromSortedSet(key);
}
#endregion
#region 其它
/// <summary>
/// 判断key集合中是否存在value数据
/// </summary>
public static bool SortedSetContainsItem(string key, string value)
{
return RedisBase.Core.SortedSetContainsItem(key, value);
}
/// <summary>
/// 为key集合值为value的数据,分数加scoreby,返回相加后的分数
/// </summary>
public static double IncrementItemInSortedSet(string key, string value, double scoreBy)
{
return RedisBase.Core.IncrementItemInSortedSet(key, value, scoreBy);
}
/// <summary>
/// 获取keys多个集合的交集,并把交集添加的newkey集合中,返回交集数据的总数
/// </summary>
public static long StoreIntersectFromSortedSets(string newkey, string[] keys)
{
return RedisBase.Core.StoreIntersectFromSortedSets(newkey, keys);
}
/// <summary>
/// 获取keys多个集合的并集,并把并集数据添加到newkey集合中,返回并集数据的总数
/// </summary>
public static long StoreUnionFromSortedSets(string newkey, string[] keys)
{
return RedisBase.Core.StoreUnionFromSortedSets(newkey, keys);
}
#endregion
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DF44A0D5-4D64-4391-81BA-200ED75F6C5D}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TestRedis</RootNamespace>
<AssemblyName>TestRedis</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ServiceStack.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Common.5.0.2\lib\net45\ServiceStack.Common.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Interfaces.5.0.2\lib\net45\ServiceStack.Interfaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack.Redis, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Redis.5.0.2\lib\net45\ServiceStack.Redis.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack.Text, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Text.5.0.2\lib\net45\ServiceStack.Text.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RedisBase.cs" />
<Compile Include="TYPE\RedisHash.cs" />
<Compile Include="RedisConfig.cs" />
<Compile Include="TYPE\RedisList.cs" />
<Compile Include="RedisManager.cs" />
<Compile Include="TYPE\RedisSet.cs" />
<Compile Include="TYPE\RedisString.cs" />
<Compile Include="TYPE\RedisZSet.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\bin\Debug\TestRedis.exe.config
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\bin\Debug\TestRedis.exe
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\bin\Debug\TestRedis.pdb
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\bin\Debug\ServiceStack.Common.dll
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\bin\Debug\ServiceStack.Interfaces.dll
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\bin\Debug\ServiceStack.Redis.dll
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\bin\Debug\ServiceStack.Text.dll
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\bin\Debug\ServiceStack.Common.xml
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\bin\Debug\ServiceStack.Interfaces.xml
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\bin\Debug\ServiceStack.Redis.xml
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\bin\Debug\ServiceStack.Text.xml
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\obj\Debug\TestRedis.Properties.Resources.resources
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\obj\Debug\TestRedis.csproj.GenerateResource.Cache
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\obj\Debug\TestRedis.exe
C:\Users\admin\Documents\Visual Studio 2015\Projects\Test\TestRedis\TestRedis\obj\Debug\TestRedis.pdb
C:\Users\admin\Desktop\TestRedis\TestRedis\bin\Debug\TestRedis.exe.config
C:\Users\admin\Desktop\TestRedis\TestRedis\obj\Debug\TestRedis.exe
C:\Users\admin\Desktop\TestRedis\TestRedis\obj\Debug\TestRedis.pdb
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\bin\Debug\TestRedis.exe.config
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\obj\Debug\TestRedis.exe
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\obj\Debug\TestRedis.pdb
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\bin\Debug\TestRedis.exe
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\bin\Debug\TestRedis.pdb
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\bin\Debug\ServiceStack.Common.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\bin\Debug\ServiceStack.Interfaces.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\bin\Debug\ServiceStack.Redis.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\bin\Debug\ServiceStack.Text.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\bin\Debug\ServiceStack.Common.xml
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\bin\Debug\ServiceStack.Interfaces.xml
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\bin\Debug\ServiceStack.Redis.xml
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\bin\Debug\ServiceStack.Text.xml
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\obj\Debug\TestRedis.csprojResolveAssemblyReference.cache
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\obj\Debug\TestRedis.Properties.Resources.resources
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedis\obj\Debug\TestRedis.csproj.GenerateResource.Cache
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ServiceStack.Common" version="5.0.2" targetFramework="net45" />
<package id="ServiceStack.Interfaces" version="5.0.2" targetFramework="net45" />
<package id="ServiceStack.Redis" version="5.0.2" targetFramework="net45" />
<package id="ServiceStack.Text" version="5.0.2" targetFramework="net45" />
</packages>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="Host" value="127.0.0.1" />
<add key="Port" value="6379" />
</appSettings>
</configuration>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TestRedisCMD
{
public class AppConfigSetting
{
private static string host= "";
public static string Host
{
get
{
try
{
host = ConfigurationManager.AppSettings["Host"].ToString();
}
catch
{
MessageBox.Show("请配置Host!");
}
return host;
}
}
private static string port = "";
public static string Port
{
get
{
try
{
port = ConfigurationManager.AppSettings["Port"].ToString();
}
catch
{
MessageBox.Show("请配置port!");
}
return port;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TestRedisCMD;
namespace TestRedisCMD
{
class Program
{
static void Main(string[] args)
{
//string key = "p";
// RedisBase.Core 实质上 是 RedisManager.GetClient() 是IRedisClient--- PooledRedisClientManager.GetClient()
//注意,此方法没有归还redis的clinet--需改进
//RedisBase.Core.FlushAll();
//RedisBase.Core.AddItemToList
// (key,"1");
//RedisBase.Core.AddItemToList
// (key, "2");
//long keycount=RedisBase.Core.GetListCount(key);
//string a = RedisBase.Core.GetItemFromList(key, 0)
//RedisBase.Core.AddItemToList(key, "456");
//RedisBase.Core.Add<String>("ptest", "123456");
string key = "ptes";
//RedisBase.Core.Set<int>(key, 1);
//long newvalue = 0;
//int b = RedisBase.Core.Get<int>(key);
//try
//{
// //事务本身是2步走,不能拆开。
// //1.得到旧值
// //2.+1,更新为新值
// newvalue= RedisBase.Core.IncrementValue(key);
//}
//catch (Exception ex)
//{
// MessageBox.Show(ex.ToString());
//}
//放置1个对象,同时每个线程去操作对象。
//Parallel.For(0, 1000, (index) =>
//{
// try
// {
// long value = RedisBase.Core.IncrementValue(key);
// Console.WriteLine("index:" + index + " value:" + value);
// }
// catch (Exception exe)
// {
// MessageBox.Show(exe.ToString());
// }
//});
//初始化库
RedisPool pool = RedisConnectionManager.Instance.GetRedisPool(null, 15);
RedisClientInfo rcInfo1 = pool.BorrowInstance();
rcInfo1.client.FlushDb();
pool.ReturnInstance(rcInfo1);
#region 并行Task
Console.WriteLine(DateTime.Now);
var task = Task.WhenAll(Task.Run(() =>
{
Parallel.For(0, 10000, (index) =>
{
try
{
RedisClientInfo rcInfo = pool.BorrowInstance();
long value = rcInfo.client.Incr(key);
Console.WriteLine("index:" + index + " value:" + value+"__________");
pool.ReturnInstance(rcInfo);
Thread.Sleep(1);
}
catch (Exception exe)
{
MessageBox.Show(exe.ToString());
}
});
Thread.Sleep(1000);
}), Task.Run(() =>
{
Parallel.For(0, 10000, (index) =>
{
try
{
RedisClientInfo rcInfo = pool.BorrowInstance();
long value = rcInfo.client.Incr(key);
Console.WriteLine("B————————index:" + index + " value:" + value);
pool.ReturnInstance(rcInfo);
Thread.Sleep(1);
}
catch (Exception exe)
{
MessageBox.Show(exe.ToString());
}
});
Thread.Sleep(2000);
}),Task.Run(()=> {
Parallel.For(0, 10000, (index) =>
{
try
{
RedisClientInfo rcInfo = pool.BorrowInstance();
long value = rcInfo.client.Incr(key);
Console.WriteLine("index:" + index + " value:" + value);
pool.ReturnInstance(rcInfo);
Thread.Sleep(1);
}
catch (Exception exe)
{
MessageBox.Show(exe.ToString());
}
});
Thread.Sleep(2000);
}));//多个task并行执行,不阻塞
task.ContinueWith((ctw) =>//当task完成后,执行这个回调
{
Console.WriteLine("并行完成" + DateTime.Now);
});
Console.WriteLine(DateTime.Now);
#endregion
Console.ReadLine();
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("TestRedisCMD")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestRedisCMD")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("9559a4c8-b83a-4e8d-8c1c-65563a409240")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestRedisCMD
{
public class RedisConfig
{
public string readWriteHosts { get; set; }
public int readWritePort { get; set; }
public string readOnlyHosts { get; set; }
public int MaxPoolSize { get; set; }
public string Password { get; set; }
public long initalDb { get; set; }
public int? poolTimeOut { get; set; }
public long clientTimeOut { set; get; }
}
}

using ServiceStack.Redis;
using StackExchange.Redis;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
namespace TestRedisCMD
{
public class RedisConnectionManager
{
private static object _redisConnectLock = new object();
private static RedisConnectionManager _instance;
public static RedisConnectionManager Instance
{
get
{
if (_instance == null)
{
lock (_redisConnectLock)
{
if (_instance == null)
{
_instance = new RedisConnectionManager();
}
}
}
return _instance;
}
}
#region 老方法
private ConcurrentDictionary<String, PooledRedisClientManager> _manager2 = new ConcurrentDictionary<string, PooledRedisClientManager>();
/// <summary>
/// 暂时就只用一个RedisClient
/// </summary>
/// <returns></returns>
public IRedisClient GetRedisClient(String type = "Old", long initialDb = 0)
{
var manager = _manager2.GetOrAdd(type + initialDb, CreateNewManager(type, initialDb));
IRedisClient client = manager.GetClient();
return client;
}
private PooledRedisClientManager CreateNewManager(String type, long initialDb = 0)
{
String host = AppConfigSetting.Host;
Int32 port = int.Parse(AppConfigSetting.Port);
return new PooledRedisClientManager(initialDb, String.Format("{0}:{1}", host, port));
}
private object lockauth = new object();
private ConcurrentDictionary<String, RedisPool> _redisPoolCache = new ConcurrentDictionary<string, RedisPool>();
/// <summary>
/// 获取一个redis线程池
/// </summary>
/// <param name="type"></param>
/// <param name="initialDb"></param>
/// <returns></returns>
public RedisPool GetRedisPool(String type = "Old", long initialDb = 0, string Host = "", int Port = 6701, string Permissions = "")
{
RedisPool pool;
try
{
Monitor.Enter(this.lockauth);
if (!this._redisPoolCache.ContainsKey(type + initialDb))
{
RedisConfig redisConfig = new RedisConfig
{
readWriteHosts = AppConfigSetting.Host,
readWritePort = int.Parse(AppConfigSetting.Port),
MaxPoolSize = 200,
clientTimeOut = 0xea60L,
initalDb = initialDb
};
this._redisPoolCache[type + initialDb] = new RedisPool(redisConfig);
}
pool = this._redisPoolCache[type + initialDb];
}
catch (Exception)
{
pool = null;
}
finally
{
Monitor.Exit(this.lockauth);
}
return pool;
}
#endregion
#region 新方法
private ConcurrentDictionary<string, ConnectionMultiplexer> _concurrectConnection = new ConcurrentDictionary<string, ConnectionMultiplexer>();
/// <summary>
/// 获取 Redis 的Database,推荐使用,使用该方法时不要释放和销毁
/// </summary>
/// <param name="type"></param>
/// <param name="initialDb"></param>
/// <param name="Host"></param>
/// <param name="Port"></param>
/// <returns></returns>
public IDatabase GetRedisDatabase(String type = "Old", int initialDb = 0, string Host = "", string Port = "")
{
return GetRedisConnectionMultiplexer(type, Host, Port).GetDatabase(initialDb);
}
/// <summary>
/// 获取 Redis 的连接,推荐使用,使用该方法时不要释放和销毁
/// </summary>
/// <param name="type"></param>
/// <param name="Host"></param>
/// <param name="Port"></param>
/// <returns></returns>
public ConnectionMultiplexer GetRedisConnectionMultiplexer(String type = "Old", string Host = "", string Port = "")
{
if (!_concurrectConnection.ContainsKey(type))
{
lock (type)
{
if (!_concurrectConnection.ContainsKey(type))
{
string readWriteHosts = AppConfigSetting.Host;
string readWritePorts = AppConfigSetting.Port;
//支持多Uri模式,要求多个链接使用 | 分隔,在分隔后数量相同的情况下按照顺序一一对应,如果其中一方仅有一个则使用它对应对方所有部分
string[] urls = readWriteHosts.Split('|');
string[] ports = readWritePorts.Split('|');
List<string> Uris = new List<string>();
if (urls.Length == ports.Length)
{
for (int i = 0; i < urls.Length; i++)
{
String formattedUrl = urls[i];
Uris.Add(String.Format("{0}:{1}", formattedUrl, ports[i]));
}
}
else if (urls.Length > 1 && ports.Length == 1)
{
for (int i = 0; i < urls.Length; i++)
{
String formattedUrl = urls[i];
Uris.Add(String.Format("{0}:{1}", formattedUrl, ports[0]));
}
}
else if (urls.Length == 1 && ports.Length > 1)
{
String formattedUrl = urls[0];
for (int i = 0; i < ports.Length; i++)
{
Uris.Add(String.Format("{0}:{1}", formattedUrl, ports[i]));
}
}
else
{
throw new Exception("The elasticsearch config pool setting is error.");
}
_concurrectConnection[type] = ConnectionMultiplexer.Connect(string.Join(",", Uris));
}
}
}
return _concurrectConnection[type];
}
#endregion
}
}

using ServiceStack.Redis;
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Data;
using System.Linq;
using System.Windows;
using System.Windows.Forms;
namespace TestRedisCMD
{
public class RedisPool
{
/// <summary>
/// the thrift config
/// </summary>
private RedisConfig config;
/// <summary>
/// the thrift connection pool.
/// </summary>
private ConcurrentStack<RedisClientInfo> objectPool { get; set; }
/// <summary>
/// auto reset event.
/// </summary>
private AutoResetEvent resetEvent;
/// <summary>
/// actived object count.
/// </summary>
//private volatile int activedCount = 0;
private ConcurrentDictionary<string, RedisClientInfo> activedClients = new ConcurrentDictionary<string, RedisClientInfo>();
/// <summary>
/// locker on borrow.
/// </summary>
private object locker = new object();
private object locker2 = new object();
private object lockauth = new object();
/// <summary>
/// init method.
/// </summary>
/// <param name="redisConfig"></param>
public RedisPool(RedisConfig redisConfig)
{
config = redisConfig;
CreateResetEvent();
CreateThriftPool();
}
int clientNullCount = 0;
/// <summary>
/// 获取一个redis链接
/// </summary>
/// <returns></returns>
public RedisClientInfo BorrowInstance()
{
try
{
RedisClientInfo info;
Monitor.Enter(this.lockauth);
Redis:
if (activedClients.Count > 0)
{
var delayKeys = activedClients.Where(f => f.Value.delayTime <= DateTime.Now).Select(f => f.Key);
foreach (string delayKey in delayKeys)
{
RedisClientInfo clientInfo;
if (activedClients.TryRemove(delayKey, out clientInfo))
clientInfo.client.Dispose();
}
}
if (objectPool.Count == 0)
{
if (activedClients.Count >= config.MaxPoolSize)
{
MessageBox.Show("Redis pool is full.");
resetEvent.WaitOne();
}
else
PushObject(CreateInstance());
}
RedisClientInfo redisClient = null;
bool result = objectPool.TryPop(out redisClient);
if (!result)
{
goto Redis;
}
if (redisClient == null)
{
clientNullCount = clientNullCount + 1;
if (clientNullCount > 2)
{
MessageBox.Show("RedisPool中BorrowInstance 方法中的RedisClientInfo 未将对象引用设置到对象的实例");
}
else
{
goto Redis;
}
}
//每借出一个client均需要将它缓存,并根据配置标识其最后超时时间
redisClient.lastActiveTime = DateTime.Now;
if (config.clientTimeOut > 0)
redisClient.delayTime = redisClient.lastActiveTime.AddMilliseconds(config.clientTimeOut);
else
redisClient.delayTime = redisClient.lastActiveTime.AddMinutes(10);
activedClients[redisClient.hashId] = redisClient;
return redisClient;
}
catch (Exception)
{
return null;
}
finally
{
Monitor.Exit(this.lockauth);
}
}
/// <summary>
/// 还回一个链接
/// </summary>
/// <param name="instance"></param>
public void ReturnInstance(RedisClientInfo instance)
{
if (objectPool.Count >= config.MaxPoolSize)
DestoryInstance(instance);
else
{
//归还后需要移除掉缓存中的部分
RedisClientInfo clientInfo;
activedClients.TryRemove(instance.hashId, out clientInfo);
PushObject(instance);
resetEvent.Set();
}
}
/// <summary>
/// 重置最后使用时间
/// </summary>
/// <returns></returns>
public DateTime RenewRedisClient(string hashId)
{
RedisClientInfo clientInfo;
try
{
if (activedClients.TryGetValue(hashId, out clientInfo))
{
clientInfo.lastActiveTime = DateTime.Now;
if (config.clientTimeOut > 0)
clientInfo.delayTime = clientInfo.lastActiveTime.AddMilliseconds(config.clientTimeOut);
else
clientInfo.delayTime = DateTime.MaxValue;
activedClients[hashId] = clientInfo;
return clientInfo.delayTime;
}
}
catch { }
return DateTime.MinValue;
}
/// <summary>
/// create an auto reset event.
/// </summary>
private void CreateResetEvent()
{
if (resetEvent == null)
{
resetEvent = new AutoResetEvent(false);
}
}
/// <summary>
/// create the thrift pool.
/// </summary>
private void CreateThriftPool()
{
if (objectPool == null)
{
objectPool = new ConcurrentStack<RedisClientInfo>();
}
}
/// <summary>
/// push an instance to object pool.
/// </summary>
/// <param name="transport"></param>
private void PushObject(RedisClientInfo transport)
{
objectPool.Push(transport);
}
public static int count = 0;
/// <summary>
/// create an instance
/// </summary>
/// <returns></returns>
private RedisClientInfo CreateInstance()
{
try
{
RedisClientInfo redisClientInfo = new RedisClientInfo();
RedisClient socket = new RedisClient(config.readWriteHosts, config.readWritePort, config.Password, config.initalDb);
redisClientInfo.client = socket;
redisClientInfo.lastActiveTime = DateTime.Now;
redisClientInfo.hashId = Guid.NewGuid().ToString();
count++;
return redisClientInfo;
}
catch (Exception ex)
{
MessageBox.Show("redis创建链接错误:" + ex.ToString());
}
return null;
}
/// <summary>
/// destory the instance.
/// </summary>
/// <param name="instance"></param>
private void DestoryInstance(RedisClientInfo instance)
{
instance.client.Dispose();
//instance.
}
}
/// <summary>
/// Redis 客户端信息,用于管理超时未归还的部分,超时不使用未归还的将直接被销毁
/// </summary>
public class RedisClientInfo
{
/// <summary>
/// Hash ID
/// </summary>
public string hashId { set; get; }
public RedisClient client { set; get; }
public DateTime delayTime { set; get; }
public DateTime lastActiveTime { set; get; }
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9559A4C8-B83A-4E8D-8C1C-65563A409240}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TestRedisCMD</RootNamespace>
<AssemblyName>TestRedisCMD</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack, Version=3.9.71.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.3.9.71\lib\net35\ServiceStack.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack.Common, Version=3.9.71.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Common.3.9.71\lib\net35\ServiceStack.Common.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Common.3.9.71\lib\net35\ServiceStack.Interfaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack.OrmLite, Version=3.9.14.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.OrmLite.SqlServer.3.9.14\lib\ServiceStack.OrmLite.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack.OrmLite.SqlServer, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.OrmLite.SqlServer.3.9.14\lib\ServiceStack.OrmLite.SqlServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack.Redis, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>.\ServiceStack.Redis.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.ServiceInterface, Version=3.9.71.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.3.9.71\lib\net35\ServiceStack.ServiceInterface.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ServiceStack.Text, Version=3.9.71.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Text.3.9.71\lib\net35\ServiceStack.Text.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="StackExchange.Redis, Version=1.2.6.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\StackExchange.Redis.1.2.6\lib\net45\StackExchange.Redis.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AppConfigSetting.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RedisAccess.cs" />
<Compile Include="RedisConfig.cs" />
<Compile Include="RedisConnectionManager.cs" />
<Compile Include="RedisPool.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="ServiceStack.Redis.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="Host" value="127.0.0.1" />
<add key="Port" value="6379" />
</appSettings>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="Host" value="127.0.0.1" />
<add key="Port" value="6379" />
</appSettings>
</configuration>
\ No newline at end of file
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\TestRedisCMD.exe.config
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\TestRedisCMD.exe
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\TestRedisCMD.pdb
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\Newtonsoft.Json.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.Common.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.Interfaces.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.OrmLite.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.OrmLite.SqlServer.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.Redis.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.ServiceInterface.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.Text.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\StackExchange.Redis.dll
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\Newtonsoft.Json.xml
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.xml
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.Common.xml
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.Interfaces.xml
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.OrmLite.pdb
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.OrmLite.SqlServer.pdb
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\ServiceStack.Text.xml
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\bin\Debug\StackExchange.Redis.xml
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\obj\Debug\TestRedisCMD.exe
D:\smallproject\8.2RedisKafka_UnitTestProject\TestRedisCMD\obj\Debug\TestRedisCMD.pdb
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net45" />
<package id="ServiceStack" version="3.9.71" targetFramework="net45" />
<package id="ServiceStack.Common" version="3.9.71" targetFramework="net45" />
<package id="ServiceStack.Interfaces" version="5.1.0" targetFramework="net45" />
<package id="ServiceStack.OrmLite.SqlServer" version="3.9.14" targetFramework="net45" />
<package id="ServiceStack.Redis" version="3.9.71" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.71" targetFramework="net45" />
<package id="StackExchange.Redis" version="1.2.6" targetFramework="net45" />
</packages>
\ No newline at end of file
The MIT License (MIT)
Copyright (c) 2007 James Newton-King
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment