Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>On the <a href="https://github.com/ServiceStack/ServiceStack.Redis/" rel="nofollow">ServiceStack.Redis</a> client you can use <code>GetValues</code> or <code>GetValuesMap</code> (both string and T apis are available) for fetching multiple values (uses <a href="http://redis.io/commands/mget" rel="nofollow">MGET</a>) in a single call. Only existing items are returned, which you can detect with <code>GetValues</code> if you have <strong>Id</strong>'s on your models or <code>GetValuesMap</code> which returns a dictionary of existing keys and their values.</p> <p>From this, you can determine and fetch all the missing Ids from the database. If you're just going to fetch the existing values from Redis anyway, then this is the most optimal strategy since you can fetch all the values and determine the existing keys with 1 call.</p> <h2>Alternative 'Single Call' options</h2> <h3>Use Pipelining or Transactions</h3> <p>If for some reason you really only want to check the existence of keys in Redis without fetching them, then you can use a Transaction / or Pipeline (both are pipelined) to queue up multiple operations that gets sent to Redis in 1 socket write. Here's an example of this from <a href="http://www.servicestack.net/RedisStackOverflow/" rel="nofollow">RedisStackOverflow</a> demo that queues up 30 operations that <a href="https://github.com/ServiceStack/ServiceStack.Examples/blob/master/src/RedisStackOverflow/RedisStackOverflow.ServiceInterface/IRepository.cs#L180" rel="nofollow">gets send and executed in a single batch</a>.</p> <h3>Use LUA Scripting</h3> <p>If you have Redis >v2.5x you can create and execute composite operations using <a href="http://redis.io/commands/eval" rel="nofollow">Redis's server-side LUA support</a>. You can use these APIs from <a href="https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/Redis/IRedisClient.cs" rel="nofollow">IRedisClient</a> in ServiceStack.Redis client to execute server-side LUA scripts:</p> <pre><code>string GetEvalStr(string body, int numOfArgs, params string[] args); int GetEvalInt(string body, int numOfArgs, params string[] args); List&lt;string&gt; GetEvalMultiData(string body, int numOfArgs, params string[] args); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload