Problems with Lists when using StackExchange.Redis C# client in Azure WorkerRole

2,244 views
Skip to first unread message

Serge Cherevko

unread,
Aug 28, 2014, 11:33:31 AM8/28/14
to redi...@googlegroups.com
I keep getting the error when try to do anything with lists:
StackExchange.Redis.RedisServerException was caught
  HResult=-2146233088
  Message=WRONGTYPE Operation against a key holding the wrong kind of value
  Source=StackExchange.Redis
  StackTrace:
       at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in c:\TeamCity\buildAgent\work\58bc9a6df18a3782\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 1795
       at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) in c:\TeamCity\buildAgent\work\58bc9a6df18a3782\StackExchange.Redis\StackExchange\Redis\RedisBase.cs:line 79
       at StackExchange.Redis.RedisDatabase.ListLeftPush(RedisKey key, RedisValue[] values, CommandFlags flags) in c:\TeamCity\buildAgent\work\58bc9a6df18a3782\StackExchange.Redis\StackExchange\Redis\RedisDatabase.cs:line 623

like
long zzz = cacheRedis.ListLength(redisKey)
or
cacheRedis.ListLeftPush(redisKey, redisValue[]);

Can anybody help here? 

     

Jan-Erik Rediger

unread,
Aug 28, 2014, 11:45:14 AM8/28/14
to redi...@googlegroups.com
the output includes the actual error message from Redis:

> * Message=WRONGTYPE Operation against a key holding the wrong kind of value*

This should explain it. Whatever "redisKey" is in your code, it is not a
list in Redis and thus you can't use LLEN (ListLength) to get the
length.

If you're unsure what type the value has "redisKey" points to use "TYPE
keyname" (probably something like `cacheRedis.Type(redisKey)` in your
code)


On Thu, Aug 28, 2014 at 08:33:31AM -0700, Serge Cherevko wrote:
> I keep getting the error when try to do anything with lists:
> *StackExchange.Redis.RedisServerException was caught*
> * HResult=-2146233088*
> * Message=WRONGTYPE Operation against a key holding the wrong kind of
> value*
> * Source=StackExchange.Redis*
> * StackTrace:*
> * at
> StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message
> message, ResultProcessor`1 processor, ServerEndPoint server) in
> c:\TeamCity\buildAgent\work\58bc9a6df18a3782\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line
> 1795*
> * at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message,
> ResultProcessor`1 processor, ServerEndPoint server) in
> c:\TeamCity\buildAgent\work\58bc9a6df18a3782\StackExchange.Redis\StackExchange\Redis\RedisBase.cs:line
> 79*
> * at StackExchange.Redis.RedisDatabase.ListLeftPush(RedisKey key,
> RedisValue[] values, CommandFlags flags) in
> c:\TeamCity\buildAgent\work\58bc9a6df18a3782\StackExchange.Redis\StackExchange\Redis\RedisDatabase.cs:line
> 623*
>
> like
>
> *long zzz = cacheRedis.ListLength(redisKey)*
>
> or
>
> *cacheRedis.ListLeftPush(redisKey, redisValue[]);*
>
>
> Can anybody help here?
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
> To post to this group, send email to redi...@googlegroups.com.
> Visit this group at http://groups.google.com/group/redis-db.
> For more options, visit https://groups.google.com/d/optout.

Marc Gravell

unread,
Aug 28, 2014, 1:03:43 PM8/28/14
to Jan-Erik Rediger, redi...@googlegroups.com

Everything Jan-Erik said. Just for completeness: it is `.KeyType(key)`. The "Key*" method-name prefix includes all the methods that don't depend on the data type - rename, delete exists, type, etc.

Marc (StackExchange.Redis)

Reply all
Reply to author
Forward
0 new messages