-
It was my (&my coworkers) assumption that if RedisValue is constructed by the SE library (and comes from network / real redis) and contains result of an operation that essentially returns Redis string (i.e. sequence of byte[s]) it's internal storage type would always be raw. To my surprise, that probably isn't always the case? While locally it seems to hold true, when we run against Azure Cache for Redis (without any proxy), we noticed that implicitly converting one of the (as it returns ![]() Looking at the code, it could be one of these two cases: Any thoughts / guidance? cc @mgravell |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
It doesn't assume that you want a string, and for non-numeric values: byte[] is the lowest common denominator that can handle all values in a lossless way. In scenarios where you need to control memory usage, the Lease methods are usually good choices - StringGetLeaseAsync etc. this gives you a buffer that is then pooled. Alternatively, when I finish the V3 rework, it should have hooks to allow a wide range of custom things at the caller's discretion, in advanced cases. |
Beta Was this translation helpful? Give feedback.
It doesn't assume that you want a string, and for non-numeric values: byte[] is the lowest common denominator that can handle all values in a lossless way.
In scenarios where you need to control memory usage, the Lease methods are usually good choices - StringGetLeaseAsync etc. this gives you a buffer that is then pooled. Alternatively, when I finish the V3 rework, it should have hooks to allow a wide range of custom things at the caller's discretion, in advanced cases.