Git Product home page Git Product logo

regulusredis's Introduction

Foreword

RegulusRedis is a redis client for C#.
It is based on StackExchange.Redis
The main technology is that when the object is stored in database to be split into individual Hash.
Library Link : https://www.nuget.org/packages/RegulusRedis/

Using Client

Build client object

// StackExchange.Redis initial.
var redis = ConnectionMultiplexer.Connect("localhost:6379");
var client = new Regulus.Database.Redis.Client(redis.GetDatabase(), new JsonSeriallzer());

Add a data to database

var testObject = new TestObject();//The class is your custom.
var id = 1;
testObject.Id = id;
testObject.Value = 1345;

client.Add(testObject);

Find data

var testObjects = client.Find<TestObject>(t=> t.Id == 1);

Update a data

var testObject2 = new TestObject();//The class is your custom.
testObject2.Id = 1;
testObject2.Value = 999;
var updatedCount = client.Update(t=> t.Id == id, testObject2);

Update by field

var updatedCount = client.UpdateField<TestObject , int>(t=> t.Id == 1, t=> t.Value , 12345);

Delete a data

var deletedCount = client.Delete<TestObject>(t => t.Id == 1);

Using Mapper

// create
var mapper = new Regulus.Database.Redis.Mapper<TestObject>(client, obj => obj.Id == 1);            
// update field
mapper.Update<int>(obj => obj.Value, 99);
// get field
var result = mapper.Get<int>(obj => obj.Value);

regulusredis's People

Contributors

jiowchern avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.