When using bytes objects as keys, client-side caching doesn't work, because when trying to invalidate the cache, it unconditionally decodes bytes to str objects. This should probably be the other way around (i.e. encode all str keys as utf-8 and only store bytes keys in the cache). This would allow the use of str and bytes keys interchangeably for the vast majority of cases, unless someone is interchangeably using str keys and non-utf-8-encoded bytes keys, in which case they should probably stick with one or the other.