Closed ofirgeller closed 10 years ago
What does your json look like? I tried client.set(key, val, 500) using the example json here with no issues: http://www.json.org/example.html
{"$id":"1","$values":[{"$id":"2","$type":"LZDataBase.Model.Module, LanguagezenDB","Id":4,"Name":"Jarabe de Palo - Agua","LearningSetId":1,"Text":"","Info":"
Agua is a soothing and melodic Spanish rock song.
\n","Artist":"Jarabe de Palo","Genre":"alternative rock","Album":"Grandes éxitos","IsReady":true,"Accent":"Castilian (central and northern Spain)","Module_Sentences":{"$id":"3","$values":[]},"Module_Medias":{"$id":"4","$values":[{"$id":"5","$type":"LZDataBase.Model.Module_Media, LanguagezenDB","ModuleId":4,"MediaId":2279,"Sync":true,"Media":{"$id":"6","$type":"LZDataBase.Model.Media, LanguagezenDB","Id":2279,"FileAfix":2,"StorageURL":"https://languagezenstorage.blob.core.windows.net/media/e9a30f81-48e6-43aa-ab6f-51f69754a966.mp3","MediaType":2,"Tags":"song,jarbe de palo","SourceId":"e9a30f81-48e6-43aa-ab6f-51f69754a966","IsARecording":false,"Duration":240.544543,"Form_Medias":{"$id":"7","$values":[]},"Meaning_Medias":{"$id":"8","$values":[]},"Sentence_Medias":{"$id":"9","$values":[]},"Fact_Medias":{"$id":"10","$values":[]},"Course_Medias":{"$id":"11","$values":[]},"Module_Medias":{"$id":"12","$values":[{"$ref":"5"}]},"MediaSources":{"$id":"13","$values":[]}},"Module":{"$ref":"2"}},{"$id":"14","$type":"LZDataBase.Model.Module_Media, LanguagezenDB","ModuleId":4,"MediaId":2280,"Sync":false,"Media":{"$id":"15","$type":"LZDataBase.Model.Media, LanguagezenDB","Id":2280,"FileAfix":9,"StorageURL":"https://languagezenstorage.blob.core.windows.net/media/d6ee75f6-fdf4-44fc-a1b2-1caca5bbd710.jpg","MediaType":3,"Tags":"disk cover,jarabe de palo","SourceId":"d6ee75f6-fdf4-44fc-a1b2-1caca5bbd710","IsARecording":false,"Form_Medias":{"$id":"16","$values":[]},"Meaning_Medias":{"$id":"17","$values":[]},"Sentence_Medias":{"$id":"18","$values":[]},"Fact_Medias":{"$id":"19","$values":[]},"Course_Medias":{"$id":"20","$values":[]},"Module_Medias":{"$id":"21","$values":[{"$ref":"14"}]},"MediaSources":{"$id":"22","$values":[]}},"Module":{"$ref":"2"}}]},"Course_Modules":{"$id":"23","$values":[]},"Module_FormMeanings":{"$id":"24","$values":[]},"MatchPercentage":0},{"$id":"25","$type":"LZDataBase.Model.Module, LanguagezenDB","Id":6,"Name":"Tito El Bambino - El Amor","LearningSetId":1,"Info":"El amor is an upbeat and award-winning Cumbia pop song about love.
\n","Artist":"Tito El Bambino","Genre":"Bachata (Latin pop)","Album":"El Patrón","IsReady":true,"Accent":"Puerto Rican","Module_Sentences":{"$id":"26","$values":[]},"Module_Medias":{"$id":"27","$values":[{"$id":"28","$type":"LZDataBase.Model.Module_Media, LanguagezenDB","ModuleId":6,"MediaId":2855,"Sync":true,"Media":{"$id":"29","$type":"LZDataBase.Model.Media, LanguagezenDB","Id":2855,"FileAfix":2,"StorageURL":"https://languagezenstorage.blob.core.windows.net/media/8921cf72-813f-4b6e-8c24-eebf68900327.mp3","MediaType":2,"Tags":"tito el bambino, el amor, song","SourceId":"8921cf72-813f-4b6e-8c24-eebf68900327","IsARecording":false,"Duration":246.885746,"Form_Medias":{"$id":"30","$values":[]},"Meaning_Medias":{"$id":"31","$values":[]},"Sentence_Medias":{"$id":"32","$values":[]},"Fact_Medias":{"$id":"33","$values":[]},"Course_Medias":{"$id":"34","$values":[]},"Module_Medias":{"$id":"35","$values":[{"$ref":"28"}]},"MediaSources":{"$id":"36","$values":[]}},"Module":{"$ref":"25"}},{"$id":"37","$type":"LZDataBase.Model.Module_Media, LanguagezenDB","ModuleId":6,"MediaId":2856,"Sync":false,"Media":{"$id":"38","$type":"LZDataBase.Model.Media, LanguagezenDB","Id":2856,"FileAfix":9,"StorageURL":"https://languagezenstorage.blob.core.windows.net/media/73575f4e-63a2-4f40-b601-8be05a080522.jpg","MediaType":3,"Tags":"Tito El Bambino","SourceId":"73575f4e-63a2-4f40-b601-8be05a080522","IsARecording":false,"Form_Medias":{"$id":"39","$values":[]},"Meaning_Medias":{"$id":"40","$values":[]},"Sentence_Medias":{"$id":"41","$values":[]},"Fact_Medias":{"$id":"42","$values":[]},"Course_Medias":{"$id":"43","$values":[]},"Module_Medias":{"$id":"44","$values":[{"$ref":"37"}]},"MediaSources":{"$id":"45","$values":[]}},"Module":{"$ref":"25"}}]},"Course_Modules":{"$id":"46","$values":[]},"Module_FormMeanings":{"$id":"47","$values":[]},"MatchPercentage":0},{"$id":"48","$type":"LZDataBase.Model.Module, LanguagezenDB","Id":8,"Name":"Aventura - Dile al amor","LearningSetId":1,"Info":"Dile al amor is a grammy-nominated and chart-topping Bachata track about love.
\n","Artist":"Aventure","Genre":"Bachat","IsReady":true,"Module_Sentences":{"$id":"49","$values":[]},"Module_Medias":{"$id":"50","$values":[{"$id":"51","$type":"LZDataBase.Model.Module_Media, LanguagezenDB","ModuleId":8,"MediaId":3992,"Sync":true,"Media":{"$id":"52","$type":"LZDataBase.Model.Media, LanguagezenDB","Id":3992,"FileAfix":2,"StorageURL":"https://languagezenstorage.blob.core.windows.net/media/8608712d-b246-44ea-bf0a-179b3b0500cb.mp3","MediaType":2,"Tags":"Dile al amor by Aventura","SourceId":"8608712d-b246-44ea-bf0a-179b3b0500cb","IsARecording":false,"Duration":229.0,"Form_Medias":{"$id":"53","$values":[]},"Meaning_Medias":{"$id":"54","$values":[]},"Sentence_Medias":{"$id":"55","$values":[]},"Fact_Medias":{"$id":"56","$values":[]},"Course_Medias":{"$id":"57","$values":[]},"Module_Medias":{"$id":"58","$values":[{"$ref":"51"}]},"MediaSources":{"$id":"59","$values":[]}},"Module":{"$ref":"48"}},{"$id":"60","$type":"LZDataBase.Model.Module_Media, LanguagezenDB","ModuleId":8,"MediaId":5057,"Sync":false,"Media":{"$id":"61","$type":"LZDataBase.Model.Media, LanguagezenDB","Id":5057,"FileAfix":9,"StorageURL":"https://languagezenstorage.blob.core.windows.net/media/575d6661-0925-483b-b6c0-c45bfec2be7c.jpg","MediaType":3,"Tags":"Aventura The Last album cover","SourceId":"575d6661-0925-483b-b6c0-c45bfec2be7c","IsARecording":false,"Form_Medias":{"$id":"62","$values":[]},"Meaning_Medias":{"$id":"63","$values":[]},"Sentence_Medias":{"$id":"64","$values":[]},"Fact_Medias":{"$id":"65","$values":[]},"Course_Medias":{"$id":"66","$values":[]},"Module_Medias":{"$id":"67","$values":[{"$ref":"60"}]},"MediaSources":{"$id":"68","$values":[]}},"Module":{"$ref":"48"}}]},"Course_Modules":{"$id":"69","$values":[]},"Module_FormMeanings":{"$id":"70","$values":[]},"MatchPercentage":0}]}if you go to the unit tests for set string
Assert.AreEqual("OK", redis.Set("key", "value]}"));
Assert.AreEqual("*3\r\n$3\r\nSET\r\n$3\r\nkey\r\n$5\r\nvalue]}\r\n", mock.GetMessage());
this should work right?
edit:
or not, i did not understand the test it seems.
Thanks. It's an encoding bug when writing to the server. Will push a fix shortly.
is this reflected in a new build on nuget or should i make my own build?
also, thank you very much for the fast response!
Yep. Latest nuget build has the fix.
-----Original Message----- From: "ofirgeller" notifications@github.com Sent: 8/23/2014 1:44 PM To: "ctstone/csredis" csredis@noreply.github.com Cc: "Chris" ctstone@gmail.com Subject: Re: [csredis] error On redisClient.Set(key,val,ttl) (#19)
is this reflected in a new build on nuget or should i make my own build? — Reply to this email directly or view it on GitHub.
tested deployed and working, thanks:)
only happens when:
the val is a string and that string is Json data created using Json.net. the ttl is not null.
,"ExceptionMessage":"ERR Protocol error: expected '$', got ' '","ExceptionType":"CSRedis.RedisException","StackTrace":" at CSRedis.Internal.IO.RedisReader.ReadType()\r\n at CSRedis.Internal.Commands.RedisStatus.Nullable.Parse(RedisReader reader)\r\n at CSRedis.Internal.RedisConnector.Call[T](RedisCommand
1 command)\r\n at CSRedis.RedisClient.Write[T](RedisCommand
1 command)\r\n at CSRedis.RedisClient.Set(String key, Object value, Nullable`1 expirationIf i do the set and the expire in two steps there is no error client.set(key,val); client.Expire(key,ttl);
using this: redisClient.Call("SET",key,val,ttl); also gives the same error.