[PATCH] utf8 flag support on perl lib

Tim Bunce Tim.Bunce at pobox.com
Fri Jan 11 13:30:00 UTC 2008


There is no single solution that suits all cases, so let's stop trying
to find one.

Mechanisms not policy: Let's work out what mechanisms we need.

Use of a flag bit will work just fine for people only storing utf8 into
memcached from this one client. It's simple, safe, and natural.

(It would be great to coordinate the use of at least some flag bits
across multiple clients. Adopting a convention for at least zip and
utf8 would be useful.)

Use of a flag bit is only a problem for those using utf8 with memcached
and a mix of clients (like Tomash). For users in this situation
additional mechanisms are required:

1. Explicitly ignore certain flag bits when fetching values because they
   may have been set by another client which assigns different meanings
   to them. (Already affects the F_STORABLE and F_COMPRESS bits.)

2. Explicitly disable use of certain flag bits when storing values
   in order not to confuse other clients that may assign different
   meanings to them. (As above.)

3. Automaticaly upgrade recieved bytes to utf8 if they are valid utf8.

These optional mechanisms need both a global default (for general
convienience) and the ability to override when fetching particular keys
(for fine control).

Tomash, I presume you would be happy enough using #3, though you may
want to enable #1 and #2 as well to be on the safe side, depending on
what clients you use and which flag bits they set.

Tim.


More information about the memcached mailing list