Code Monkey home page Code Monkey logo

alibabacloud.tairsdk's Introduction

AlibabaCloud-CSharp-sdk

English | 简体中文

A client packaged based on StackExchange.Redis that operates Tair For Redis Modules.

  • TairString, is a string that contains s version number.(Open sourced)
  • TairHash, is a hash that allows you to specify the expiration time and verison number of a field.(Open sourced)
  • TairZset, allows you to sort data of the double type based on multiple dimensions. (Open sourced)
  • TairDoc, to perform create, read, update, and delete (CRUD) operations on JSON data.
  • TairGis, allowing you to query points, linestrings, and polygons. (Open Sourced)
  • TairBloom, is a Bloom filter that supports dynamic scaling.
  • TairRoaring, is a more efficient and balanced type of compressed bitmaps recognized by the industry.
  • TairSearch, is a full-text search module developed in-house based on Redis modules.
  • TairCpc, is a data structure developed based on the compressed probability counting (CPC) sketch.
  • TairTs, is a time series data structure that is developed on top of Redis modules.

Example

Connection

private static readonly ConnectionMultiplexer connDC = ConnectionMultiplexer.Connect("localhost");
private readonly TairString tair = new(connDC, 0);

Use ConnectionMultiplexer.Connect to create a ConnectionMultiplexer instance. Connection can be passed a configuration string or a ConfigurationOptions object. Once a ConnectionMultiplexer instance is created, a redis database (whether standalone or clustered) can be accessed.

Next, create the corresponding Module object, and then access the database. In addition, redis supports multiple databases, so when new an object, specify the corresponding database through the second parameter. (Clusters do not support this feature)

Async

For StackExchange.Redis, use ExecuteAsync to return the result as Task<RedisResult> type, you can use the following methods to get the real result

var ret1 = tairStringAsync.exset("key", "value");
Console.WriteLine(ResultHelper.Long(ret1.Result));//output "OK"

.Result is used to get the result of Async execution, ResultHelper.Long is used to convert RedisResult to the result required by the user.

API

An example of TairString is as follows:

using System.Text;
using Alibaba.TairSDK.TairString;
using StackExchange.Redis;

namespace TestString
{
    public class Program
    {
        private static readonly ConnectionMultiplexer connDC = ConnectionMultiplexer.Connect("localhost:6379");
        private static readonly TairString tair = new(connDC, 0);
        
        static void Main(string[] args)
        {
            var bkey = Encoding.UTF8.GetBytes("bkey");
            var bvalue = Encoding.UTF8.GetBytes("bvalue");
            var key = "key";
            var value = "value";

            //string
            var ret = tair.exset(key, value);
            Console.WriteLine(ret);
            var result = tair.exget(key);
            Console.WriteLine(result.getValue());
            Console.WriteLine(result.getVersion());
            

            //binary
            ret = tair.exset(bkey, bvalue);
            Console.WriteLine(ret);
            var bresult = tair.exget(bkey);
            Console.WriteLine(Encoding.UTF8.GetString(bresult.getValue()));
            Console.WriteLine(bresult.getVersion());
        }
    } 

}

Package Status

Package NuGet Stable Downloads
AlibabaCloud.TairSDK AlibabaCloud.TairSDK AlibabaCloud.TairSDK

Tair All SDK

language GitHub
Java https://github.com/alibaba/alibabacloud-tairjedis-sdk
Python https://github.com/alibaba/tair-py
Go https://github.com/alibaba/tair-go
.Net https://github.com/alibaba/AlibabaCloud.TairSDK

alibabacloud.tairsdk's People

Contributors

alibaba-oss avatar yangbodong22011 avatar ztxiuyuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

alibabacloud.tairsdk's Issues

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.