title: How do you work around memcached's key/value limitations?
body: <p><a href="http://www.danga.com/memcached/" rel="noreferrer">Memcached</a> has length limitations for keys (250?) and values (roughtly 1MB), as well as some (to my knowledge) not very well defined character restrictions for keys. What is the best way to work around those in your opinion? I use the Perl API Cache::Memcached.</p>
  
  <p>What I do currently is store a special string for the main key's value if the original value was too big ("parts:&lt;number>") and in that case, I store &lt;number> parts with keys named 1+&lt;main key>, 2+&lt;main key> etc.. This seems "OK" (but messy) for some cases, not so good for others and it has the intrinsic problem that some of the parts might be missing at any time (so space is wasted for keeping the others and time is wasted reading them).</p>
  
  <p>As for the key limitations, one could probably implement hashing and store the full key (to work around collisions) in the value, but I haven't needed to do this yet.</p>
  
  <p>Has anyone come up with a more elegant way, or even a Perl API that handles arbitrary data sizes (and key values) transparently? Has anyone hacked the memcached server to support arbitrary keys/values?</p>