CSRedis.Net45 3.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package CSRedis.Net45 --version 3.0.0
NuGet\Install-Package CSRedis.Net45 -Version 3.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CSRedis.Net45" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CSRedis.Net45 --version 3.0.0
#r "nuget: CSRedis.Net45, 3.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CSRedis.Net45 as a Cake Addin
#addin nuget:?package=CSRedis.Net45&version=3.0.0

// Install CSRedis.Net45 as a Cake Tool
#tool nuget:?package=CSRedis.Net45&version=3.0.0

CSRedis.Net4.5

该项目应该不会再更新了,若使用请斟酌!

该项目来自ctstone/csredis2881099/csredis -DotNet Core版本csredis的结合,实际只是2881099/csredis的copy,ctstone/csredis是原作者的。

Nuget引用

PM> Install-Package CSRedis.Net45

普通模式

var csredis = new CSRedis.CSRedisClient("127.0.0.1:6379,password=123,defaultDatabase=13,poolsize=50,ssl=false,writeBuffer=10240,prefix=key前辍");

使用

函数名与 redis-cli 的命令相同 redis-cli中文版

RedisHelper.Set("test1", "123123", 60);
RedisHelper.Get("test1");

使用CacheShell

//不加缓存的时候,要从数据库查询
var user =  _userManager.GetUserById(1);

//一般的缓存代码,如不封装还挺繁琐的
var cacheValue = RedisHelper.Get("test1");
if (!string.IsNullOrEmpty(cacheValue)) {
	try {
		return JsonConvert.DeserializeObject(cacheValue);
	} catch {
		//出错时删除key
		RedisHelper.Remove("test1");
		throw;
	}
}
var user =  _userManager.GetUserById(1);
RedisHelper.Set("test1", JsonConvert.SerializeObject(user), 10); //缓存10秒

//使用CacheShell效果同上,以下示例使用 string 和 hash 缓存数据
var t1 = RedisHelper.CacheShell("test1", 10, () =>  _userManager.GetUserById(1));
var t2 = RedisHelper.CacheShell("test", "1", 10, () =>  _userManager.GetUserById(1));
var t3 = RedisHelper.CacheShell("test", new [] { "1", "2" }, 10, notCacheFields => new [] {
  ("1",  _userManager.GetUserById(1)),
  ("2",  _userManager.GetUserById(2))
});
Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 1,076 9/15/2018