Skip to content

Repository files navigation

NETCore.RedisKit

NuGetNETCore CLRExchange.Redislicense

StackExchange.Redis Tools. Easy use redis in your asp.net core project.

Install with nuget

To install NETCore.RedisKit, run the following command in the Package Manager Console

Install-Package NETCore.RedisKit -Version 2.0.1-beta2

RedisKit Options

Configuration stringConfigurationOptionsDefaultMeaning
endPoints={string}EndPoints--Redis server endPoint string,multi endPoint split with ',' like '127.0.0.1:6379,127.0.0.1:6380'
abortConnect={bool}AbortOnConnectFailtruefalse on Azure)If true, Connect will not create a connection while no servers are available
allowAdmin={bool}AllowAdminfalseEnables a range of commands that are considered risky
channelPrefix={string}ChannelPrefixnullOptional channel prefix for all pub/sub operations
connectRetry={int}ConnectRetry3The number of times to repeat connect attempts during initial Connect
connectTimeout={int}ConnectTimeout200Timeout (ms) for connect operations
configChannel={string}ConfigurationChannel__Booksleeve_MasterChangedBroadcast channel name for communicating configuration changes
defaultDatabase={int?}DefaultDatabasenullDefault database index, from 0 to databases - 1
keepAlive={int}KeepAlive180 Time (seconds) at which to send a message to help keep sockets alive
name={string}ClientNamenullIdentification for the connection within redis
password={string}PasswordnullPassword for the redis server
proxy={proxy type}ProxyProxy.NoneType of proxy in use (if any); for example “twemproxy”
resolveDns={bool}ResolveDnsfalseSpecifies that DNS resolution should be explicit and eager, rather than implicit
serviceName={string}ServiceNamenullNot currently implemented (intended for use with sentinel)
ssl={bool}SslfalseSpecifies that SSL encryption should be used
sslHost={string}SslHostnullEnforces a particular SSL host identity on the server’s certificate
sslProtocols={enum?}SslProtocolsnullSsl/Tls versions supported when using an encrypted connection. Use ‘|’ to provide multiple values.
syncTimeout={int}SyncTimeout200Time (ms) to allow for synchronous operations
tiebreaker={string}TieBreaker__Booksleeve_TieBreakKey to use for selecting a server in an ambiguous master scenario
version={string}DefaultVersion(3.0 in Azure, else 2.0)Redis version level (useful when the server does not make this available)
writeBuffer={int}WriteBuffer4096Size of the output buffer
IsShowLog={bool}IsShowLogfalseCusotm options to show log

Add RedisKit Service

publicvoidConfigureServices(IServiceCollectionservices){// Add framework services.services.AddMvc();// Add redis serviceservices.AddRedisKit(options =>{options.EndPoints="127.0.0.1:6379";});}

RedisService Use

privatereadonlyIRedisService_RedisService;publicHomeController(IRedisService redisService){_RedisService=redisService;}publicIActionResultIndex(){_RedisService.ItemSet("hello","world");_RedisService.ItemGet<string>("hello");returnView();}

RedisProvider Use

privatereadonlyIRedisProvider_RedisProvider;publicValuesController(IRedisProvider redisProvider){_RedisProvider=redisProvider;}// GET: api/values[HttpGet]publicstringGet(){varredis=_RedisProvider.Redis;vardb=redis.GetDatabase();returndb.StringGet("hello");}

LICENSE

MIT

About

StackExchange.Redis Tool

Topics

Resources

Stars

5 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages