fix Redis bool cache key prefix#646
Conversation
|
Heya @Sahil-4555 Thanks, I went through all the changes. They're technically clean. Most of this is micro-optimization though (sprintf -> string concat, Replace -> TrimPrefix, %x -> hex.EncodeToString, bytes.Equal, ...) and I don't think it's worth merging just for that. The wins are in the ns range, but these all run inside page handlers that take milliseconds for processing and db queries anyway, so it won't make any measurable difference. Two things did stand out as actual fixes rather than perf:
Could you pull the GetBool fix out into its own small PR? I'd happily merge that. The rest I'd rather leave out to keep the churn down. |
54b4ec0 to
482c753
Compare
Done. let me know if there are any other feedback points. |
Summary
Fixes
RedisCache.GetBoolto use the configured Redis key prefix when reading values.SetBoolwrites bool values using the prefixed key, butGetBoolpreviously looked up the raw unprefixed key. This meant bool values stored throughSetBoolwould not be found when a Redis prefix was configured.Changes
GetBoolto read from the same prefixed key format used bySetBool.