Coder Social home page Coder Social logo

nsipid / respclient Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neuecc/respclient

0.0 2.0 0.0 1.58 MB

RespClient is a minimal RESP(REdis Serialization Protocol) client for C# and PowerShell.

License: MIT License

Batchfile 0.20% PowerShell 1.91% C# 97.89%

respclient's Introduction

Build status

RespClient

RespClient is a minimal RESP(REdis Serialization Protocol) client for C# and PowerShell.

What's the diferrence between other .NET Redis Client

.NET has several Redis Client, BookSleeve (and it's wrapper CloudStructures), ServiceStack.Redis, etc. There are heavy for command line usage. RespClient is focusing on simple command usage like Redis-Cli. It's higher match for PowerShell.

Install

Binary is registered at NuGet, RespClient.

# Standalone PowerShell Cmdlet and .NET Client, requires System.Management.Automation
PM> Install-Package RespClient

PowerShell Cmdlet

# Module is provided by dll 
Import-Module RespClient.dll

# Connect to RedisServer. Connection is effective during powershell session.
# other parameter, -Host, -Port, -Timeout
Connect-RedisServer 127.0.0.1

# Send Command to RedisServer. Return value was decoded UTF8 string.
Send-RedisCommand "set test abcde"

# Support pipeline mode.
Begin-RedisPipeline
Send-RedisCommand "set test fghijk"
Send-RedisCommand "incr testb"
Send-RedisCommand "incr testc"
Send-RedisCommand "get test"
Execute-RedisPipeline

# Cleanup Connection explicitly 
Disconnect-RedisServer

RespClient(.NET)

If use raw RespClient, you can send binary value and choose other decoder(besides Encoding.UTF8).

using (var client = new Redis.Protocol.RespClient())
{
    // string command
    client.SendCommand("set a 100", Encoding.UTF8.GetString);

    // binary safe command
    client.SendCommand("set", new[] { Encoding.UTF8.GetBytes("test"), Encoding.UTF8.GetBytes("abcde") }, Encoding.UTF8.GetString);

    // use pipeline
    var results = client.UsePipeline()
        .QueueCommand("incr a")
        .QueueCommand("incrby b 10")
        .QueueCommand("get a", Encoding.UTF8.GetString)
        .Execute();
} // disconnect on dispose

respclient's People

Contributors

guitarrapc avatar neuecc avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.