I am using the ServiceStack Cache Client with Redis to cache integers.
I am calling the Get method on a key I know does not exist like this:
int? count;
count = cachClient.Get<int>(myKey);
count always has a value of 0 after this call.
From the documentation, I am expecting the Get method to return null for a non-existant key.
Am I doing something wrong or understanding this incorrectly?
You’ve said in the method call it needs to return type int, which isn’t nullable (and so returns it’s default value 0 instead). Try changing the second line to:
and see if it returns null then.