I'm using ServiceStack Redis. I have an struct
and I want to storage it in Redis. But when I try to get it, it always return the default value. But if I change the struct
for class
it works ok. Any ideas?
public struct PersonStruct
{
public string Name { get; set; }
public int Year { get; set; }
}
Unit test (It always pass, because redis return the default for the struct)
var obj = new PersonStruct() {Name = "SomeName", Year = 1235};
_redis.Set(key, obj, TimeSpan.FromMinutes(2));
var result = _redis.Get<PersonStruct>(key);
Assert.AreEqual(default(PersonStruct), result);