clarified outdated comment
Only delete memcache keys when is needed

flush was deleting request path cache entry AND current cache entry,
and that is not needed.
Extend the array instead of creating a new one
Log when memcache set fails

This can be useful to detect configuration errors or identify when
long directory listings can be stored in the cache.
Reduce memcache calls using the local cache

If the local cache is valid we check the TTL locally instead of
relying on the up-to-date version in memcache.

This improves the performance when listing directories with a
big amount of files (valid is called per file stat).
Enable memcache compression

Compress any cache entry >= 4096 bytes.

Memcache default maximum size for the objects is 1MB and large directory
listings may require more space and storing them in the cache will fail.

Compression will mitigate the problem.
Be more specific in an import error
Use json to serialize cache entries

By default python-memcache is using pickle that has two main problems:

 - can be insecure if an untrusted party has access to the memcache server (unlikely)
 - it's not very memory-efficient

Some tests:

 - 3 dir entries: pickle 781 bytes, json 324 bytes (zlib pickle 307 bytes, zlib json 154 bytes)
 - 10568 dir entries: pickle 2336020 bytes, json 1068348 bytes (zlib pickle 357588 bytes, zlib json 138035 bytes)

So using json instead of pickle is totally worth it!
ready for release 0.22