ncw/swift — pull request #16 by groks (2013-10-15 13:49:52+00:00)
Title: Enable serializing Connection to JSON

From the Rackspace Authentication docs at:

http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/content/Sample_Request_Response-d1e64.html

"Tokens are valid for a finite duration; a token's default lifespan is
twenty-four hours ... Clients are encouraged to cache a token until
it expires."

Some environments make reusing a Connection more of a priority than
others, such as Appengine, because:

- small virtual machines or containers started frequently
- limited concurrency within container or machine
- expensive

With this change a Connection can be stored in and retrieved
from memcache.

By exposing the Init() method and by being careful about setting up the
http transport and client, it is also possible to store a Connection in
global memory and copy it for use in another goroutine. (Appengine uses
one goroutine per connection and the urlfetch Transport is connection
specific).