Skip to content

Some additions I have for the Redis client in C# based off StackExchange.Redis and RedLock

License

Notifications You must be signed in to change notification settings

benjamin-wss/redis-jiggery-pokery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redis Jiggery Pokery

Purpose

Redis Jiggery Pokery is meant to provide a familliar repository pattern esque mechanism to interact with Redis. This would abstract the jiggery pokery needed to work with a key-value store like Redis.

You can store your data objects like tables an ORM where a table is represented like an object. However as Redis is a NoSQL database, this does mean that unlike NHibernate, Dapper, Entity Framework, , there are no joins, views or any of that here. Those sort of features would also not be replicated in any way or form as it is defeats the purpose of a key-value store.

This is meant to cover simple usage only. There will be nothing fancy happening at this pooint.

Prerequisites

  1. A running Redis instance. If you want one to test, you may download it from here.
  2. Some C# mojo.

Sample

  public class User
  {
    public Guid UserId 
    { 
      get; 
      set; 
     }
   }
   
   public class UserDataStore()
   {
      private readonly ConfigurationOptions _configurationOptions;
      private readonly RedisGenericDataProvider<User> _redisGenericDataProvider;
      
      public UserDataStore()
      {
        _configurationOptions = new ConfigurationOptions()
        {
          // Url(s) or Redis datastores. In this case we have only one.
          EndPoints = { "localhost" }
        };

        _redisGenericDataProvider = new RedisGenericDataProvider<User>(_configurationOptions);
      }

      public IList<User> GetAll()
      {
        var allItems = _redisGenericDataProvider.GetAllValues();
        return allItems;
      }
   }

About

Some additions I have for the Redis client in C# based off StackExchange.Redis and RedLock

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages