Properly cache empty values

This makes nils invalid values for mutating and returns length-zero byte arrays as empty results for cache hits.
return error here instead of bool, and give more detail error msg than "Invalid value"