Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 

README.md

CloudStructures

CloudStructures is the Redis client based on StackExchange.Redis. Now supports .NET Standard!!

StackExchange.Redis is very pure and low level library. It's Redis driver like ADO.NET. It's very difficult to use it as raw. CloudStructures provides simple O/R (Object / Redis) mapper like Dapper for ADO.NET.

Releases

Support framework

  • .NET Standard 2.0

Installation

PM> Install-Package CloudStructures

Data structures of Redis

CloudStructures supports these Redis data types. All methods are async.

Structure Description
RedisBit Bits API
RedisDictionary<TKey, TValue> Hashes API with constrained value type
RedisGeo<T> Geometries API
RedisHashSet<T> like RedisDictionary<T, bool>
RedisHyperLogLog<T> HyperLogLogs API
RedisList<T> Lists API
RedisLua Lua eval API
RedisSet<T> Sets API
RedisSortedSet<T> SortedSets API
RedisString<T> Strings API

Getting started

Following code is simple sample.

// RedisConnection have to be held as static.
public static class RedisServer
{
    public static RedisConnection Connection { get; }
    public static RedisServer()
    {
        var config = new RedisConfig("name", "connectionString");
        Connection = new RedisConnection(config);
    }
}

// A certain data class
public class Person
{
    public string Name { get; set; }
    public int Age { get; set; }
}

// 1. Create redis structure
var key = "test-key";
var defaultExpiry = TimeSpan.FromDays(1);
var redis = new RedisString<Person>(RedisServer.Connection, key, defaultExpiry)

// 2. Call command
var neuecc = new Person("neuecc", 35);
await redis.SetAsync(neuecc);
var result = await redis.GetAsync();

ValueConverter

If you use this library, you must implement IValueConverter to serialize your original class. However, we provides default implementations using MessagePack for C# and Utf8Json. Unless you pass custom IValueConverter to RedisConnection ctor, fallback to Utf8JsonConverter automatically. If you wanna use MessagePack version, you should install following package.

PM> Install-Package CloudStructures.Converters.MessagePack

Authors

Yoshifumi Kawai is software developer in Tokyo, Japan. Awarded Microsoft MVP (C#) since April, 2011. He's the original owner of this project.

Takaaki Suzuki is software developer in Fukui, Japan. Awarded Microsoft MVP (C#) since July, 2012. He's a contributer who led the .NET Standard support.

License

This library is under the MIT License.

You can’t perform that action at this time.