bacongobbler/docker-registry-driver-swift — pull request #6 by mbdas (2014-06-16 19:42:36+00:00)
Title: Fixing redis issue and optimizations with head requests

Before I start thanks for creating and maintaining this driver. It was good to not start from scratch.
This PR is trying to address the following

1. When caching(redis) was enabled in registry config, docker push failed. On close inspection of the registry code, it is clear that methods like "stream_read", stream_write, exists, get_size are supposed to not use the cache and directly look at the store. And the other important point is the redis cache is only to be used for all the meta data small files but not the layers. Hence, get_content() and put_content() methods decorated by the lru_* methods are only invoked for non layer operations. On the other hand stream_* methods are only for the actual layers. I wish this was documented. Anyways, so since the current implementation was invoking get_content/put_content for stream_read/stream_write it was bringing the cache into play when involving layers and caused the failure. Updated the exists and get_size method accordingly as well.

2. For exists and get_size implemented head request instead of get since the swift client supports it. This helps is not retrieving the entire content but get the same headers as get. I think the boto/s3 driver does the same.

After the changes things are looking fine. I am looking forward to add some more optimizations that the current S3 driver has.