Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Supported Client Libraries

StackExchange.Redis

Image Modified

ServiceStack.Redis

Image Added

Supported Operations

OperationMethods Supported
Insert
  • StackExchange.Redis.IDatabase.StringSet
  • StackExchange.Redis.IDatabaseAsync.StringSetAsync
  • StackExchange.Redis.IDatabase.Add
  • StackExchange.Redis.IDatabase.GeoAdd'
  • StackExchange.Redis.IDatabase.HashSet
  • StackExchange.Redis.IDatabase.SetCombineAndStore
  • ServiceStack.Redis.RedisClient.AddItemToList
  • ServiceStack.Redis.RedisClient.AddItemToSet
  • ServiceStack.Redis.RedisClient.AddRangeToList
  • ServiceStack.Redis.RedisClient.AddRangeToSet
  • ServiceStack.Redis.RedisClient.CreateHashSet
  • ServiceStack.Redis.RedisClient.PushItemToList
Update
  • StackExchange.Redis.IDatabase.StringIncrement
  • StackExchange.Redis.IDatabaseAsync.StringIncrementAsync
  • StackExchange.Redis.IDatabase.KeyMigrate
  • ServiceStack.Redis.RedisClient.IncrementValueInHash
Select
  • StackExchange.Redis.IDatabase.StringGet
  • StackExchange.Redis.IDatabaseAsync.StringGetAsync
  • StackExchange.Redis.IDatabase.GeoRadius
  • StackExchange.Redis.IDatabaseAsync.GeoRadiusAsync
  • StackExchange.Redis.IDatabaseAsync.HashGetAllAsync
  • StackExchange.Redis.IDatabase.HashGetAll
  • Sort
    • StackExchange.Redis.IDatabase.HashScan
    • StackExchange.Redis.IDatabase.SetScan
    • StackExchange.Redis.IDatabase.Get
    • StackExchange.Redis.IDatabase.HashExists
    • .StackExchange.Redis.IDatabase.SetCombineAndStore
    • ServiceStack.Redis.RedisClient.GetHashCount
    • ServiceStack.Redis.RedisClient.GetHashKeys
    • ServiceStack.Redis.RedisClient.GetListCount
    • ServiceStack.Redis.RedisClient.GetSetCount
    Delete 
    • StackExchange.Redis.IDatabase.KeyDelete
    • StackExchange.Redis.IDatabase.Remove
    • StackExchange.Redis.IDatabase.RemoveAll
    • StackExchange.Redis.IDatabase.KeyDump
    • ServiceStack.Redis.RedisClient.RemoveItemFromSet
    • ServiceStack.Redis.RedisClient.RemoveItemFromList
    • ServiceStack.Redis.RedisClient.PopItemFromList

    Objects

    Icon Description

    DotNet Redis Connection

    DotNet Redis Collection

    DotNet Unknown Redis Connection

     

    DotNet Unknown Redis Collection 

    ...

    Link typeSource and destination of link Methods supported
    parentLink

    Between Redis Connection object and Redis Collection object


    useLinkBetween the caller .NET Class / Method objects and Redis Collection objects



     useInsertLink
    • StringSet
    • StringSetAsync
    • Add
    • GeoAdd
    • HashSet
    • SetCombineAndStore
    • AddItemToList
    • AddItemToSet
    • AddRangeToList
    • AddRangeToSet
    • CreateHashSet
    • PushItemToList
    • GetSetCount
     useDeleteLink
    • KeyDelete
    • Remove
    • RemoveAll
    • KeyDump
    • RemoveItemFromSet
    • RemoveItemFromList
    • PopItemFromList

    useSelectLink

    • StringGet
    • StringGetAsync
    • GeoRadius
    • GeoRadiusAsync
    • HashGetAllAsync
    • HashGetAll
    • Sort
    • HashScan
    • SetScan
    • Get
    • GetHashCount
    • GetHashKeys
    • GetListCount
    useUpdateLink
    • StringIncrement
    • StringIncrementAsync
    • IncrementValueInHash

    What results can you expect?

    Once the analysis/snapshot generation has completed, you can view the results in the normal manner (for example via CAST Enlighten). Some examples are shown below.


    Connections:

    Expand
    titleConnection

    ...


    Code Block
    languagec#
    public Issue898()
            {
                mux = ConnectionMultiplexer.Connect("127.0.0.1:6379");
                db = mux.GetDatabase();
            }

    Image Modified

    Insert

    ...

    _operation

    Expand
    titleInsert operation


    Code Block
    languagec#
    public async Task LoadAsync()
            {
                for (int i = 0; i < max; ++i)
                {
                    await db.StringSetAsync(i.ToString(), i).ConfigureAwait(false);
                }
            }

    Image Modified

    Code Block
    languagec#

    ...

    titleSeviceStack
    public void AdditemlistById(string id)
            {
               
                if (this.Pipeline != null)
                    GetRegisteredTypeIdsWithinPipeline(typeIdsSetKey).Remove(id);
                else
                    this.AddItemToList("list_01", id);

    Image Added

    Select_operation

    Expand
    titleSelect Operation


    Code Block
    languagec#
    [Benchmark(OperationsPerInvoke = max)]
            public async Task SampleAsync()
            {
                var rnd = new Random();
    
                for (int i = 0; i < max; ++i)
                {
                    var r = rnd.Next(0, max - 1);
    
                    var rv = await db.StringGetAsync(r.ToString()).ConfigureAwait(false);
                    if (rv != r)
                    {
                        throw new Exception($"Unexpected {rv}, expected {r}");
                    }
                }
            }

    Image Modified

    Update_operation

    Expand
    titleUpdate operation


    Code Block
    languagec#
    public async Task<int> ExecuteIncrByAsync()
            {
                var rand = new Random(12345);
    
                db.KeyDelete(IncrByKey, CommandFlags.FireAndForget);
                int expected = 0;
                for (int i = 0; i < COUNT; i++)
                {
                    int x = rand.Next(50);
                    expected += x;
                    await db.StringIncrementAsync(IncrByKey, x, CommandFlags.FireAndForget).ConfigureAwait(false);
                }
                int actual = (int)await db.StringGetAsync(IncrByKey).ConfigureAwait(false);
                if (actual != expected) throw new InvalidOperationException($"expected: {expected}, actual: {actual}");
                return actual;
            }

    Image Modified


    Delete_operation

    Expand
    titleDelete operation


    Code Block
    languagec#
    public int ExecuteIncrBy()
            {
                var rand = new Random(12345);
    
                db.KeyDelete(IncrByKey, CommandFlags.FireAndForget);
                int expected = 0;
                for (int i = 0; i < COUNT; i++)
                {
                    int x = rand.Next(50);
                    expected += x;
                    db.StringIncrement(IncrByKey, x, CommandFlags.FireAndForget);
                }
                int actual = (int)db.StringGet(IncrByKey);
                if (actual != expected) throw new InvalidOperationException($"expected: {expected}, actual: {actual}");
                return actual;
            }

    Image Modified

    Code Block
    language

    Evolution

    • Previously, only  files consisting of relevant Redis imports were processed further for analysing.
    • Support has been evolved to process a  file when it does not contain Redis import but makes use of its methods (APIs). Assumption here is  file is using same namespace as used in the file containing Redis imports.

    Limitations

    • Connection and Collection names are resolved as known Connection and Collection only in the following situations:
      • Name is hardcoded
      • Name is defined in the variable in the local method
      • Name is defined as C# field

    Future development

    ...

    c#
    public void RemoveitemlistById(string id)
            {
                var typeIdsSetKey = "List_1";
                if (this.Pipeline != null)
                    GetRegisteredTypeIdsWithinPipeline(typeIdsSetKey).Remove(id);
                else
                    this.RemoveItemFromList("list_01", id);
            }

    Image Added


    Evolution

    • Support for ServiceStack.redis library
    • Resolution for Connection, Collection objects and crud links has increased

    Limitations

    • When the name is not resolved, unknown connection/collection object gets created
    • Support List, Set and Hash operation for Servicestack.Rediscollection object gets created

    Future development

    •  Full support for service stack.Redis Native client