// Path: bundle/src/main/java/com/bazaarvoice/dropwizard/caching/ResponseStore.java
// public abstract class ResponseStore {
//     public static final ResponseStore NULL_STORE = new ResponseStore() {
//         @Override
//         public Optional<CachedResponse> get(String key) {
//             return Optional.absent();
//         }
// 
//         @Override
//         public void put(String key, CachedResponse response) {
//             // Do nothing
//         }
// 
//         @Override
//         public void invalidate(String key) {
//             // Do nothing
//         }
//     };
// 
//     public abstract Optional<CachedResponse> get(String key);
// 
//     public abstract void put(String key, CachedResponse response);
// 
//     public abstract void invalidate(String key);
// }
// 
// Path: bundle/src/main/java/com/bazaarvoice/dropwizard/caching/ResponseStoreFactory.java
// @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
// public interface ResponseStoreFactory extends Discoverable {
//     public static final ResponseStoreFactory NULL_STORE_FACTORY = new ResponseStoreFactory() {
//         @Override
//         public ResponseStore createStore() {
//             return ResponseStore.NULL_STORE;
//         }
//     };
// 
//     public abstract ResponseStore createStore();
// }


import java.util.Arrays;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
import com.bazaarvoice.dropwizard.caching.ResponseStore;
import com.bazaarvoice.dropwizard.caching.ResponseStoreFactory;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.net.HostAndPort;
import net.spy.memcached.BinaryConnectionFactory;
import net.spy.memcached.MemcachedClient;
import java.io.IOException;
import java.net.InetSocketAddress;

    @JsonIgnore
    public void setServers(List<InetSocketAddress> servers) {
        checkNotNull(servers);
        _servers = ImmutableList.copyOf(servers);
    }

    /**
     * InetSocketAddress deserialization is broken in jackson 2.3.3, so using HostAndPort instead.
     * See: https://github.com/FasterXML/jackson-databind/issues/444
     * Fix will be in 2.3.4, but not released yet (as of 2014-Jul-10).
     */
    @JsonProperty
    void setServers(HostAndPort[] servers) {
        checkNotNull(servers);

        _servers = FluentIterable
                .from(Arrays.asList(servers))
                .transform(new Function<HostAndPort, InetSocketAddress>() {
                    public InetSocketAddress apply(HostAndPort input) {
                        return new InetSocketAddress(input.getHostText(), input.getPort());
                    }
                })
                .toList();
    }

    @Override
    public ResponseStore createStore() {
        try {
            if (getServers().size() == 0) {
// Path: bundle/src/main/java/com/bazaarvoice/dropwizard/caching/ResponseStore.java
// public abstract class ResponseStore {
//     public static final ResponseStore NULL_STORE = new ResponseStore() {
//         @Override
//         public Optional<CachedResponse> get(String key) {
//             return Optional.absent();
//         }
// 
//         @Override
//         public void put(String key, CachedResponse response) {
//             // Do nothing
//         }
// 
//         @Override
//         public void invalidate(String key) {
//             // Do nothing
//         }
//     };
// 
//     public abstract Optional<CachedResponse> get(String key);
// 
//     public abstract void put(String key, CachedResponse response);
// 
//     public abstract void invalidate(String key);
// }
// 
// Path: bundle/src/main/java/com/bazaarvoice/dropwizard/caching/ResponseStoreFactory.java
// @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
// public interface ResponseStoreFactory extends Discoverable {
//     public static final ResponseStoreFactory NULL_STORE_FACTORY = new ResponseStoreFactory() {
//         @Override
//         public ResponseStore createStore() {
//             return ResponseStore.NULL_STORE;
//         }
//     };
// 
//     public abstract ResponseStore createStore();
// }


// Path: memcached/src/main/java/com/bazaarvoice/dropwizard/caching/memcached/MemcachedResponseStoreFactory.java
import java.util.Arrays;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
import com.bazaarvoice.dropwizard.caching.ResponseStore;
import com.bazaarvoice.dropwizard.caching.ResponseStoreFactory;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.net.HostAndPort;
import net.spy.memcached.BinaryConnectionFactory;
import net.spy.memcached.MemcachedClient;
import java.io.IOException;
import java.net.InetSocketAddress;


    @JsonIgnore
    public void setServers(List<InetSocketAddress> servers) {
        checkNotNull(servers);
        _servers = ImmutableList.copyOf(servers);
    }

    /**
     * InetSocketAddress deserialization is broken in jackson 2.3.3, so using HostAndPort instead.
     * See: https://github.com/FasterXML/jackson-databind/issues/444
     * Fix will be in 2.3.4, but not released yet (as of 2014-Jul-10).
     */
    @JsonProperty
    void setServers(HostAndPort[] servers) {
        checkNotNull(servers);

        _servers = FluentIterable
                .from(Arrays.asList(servers))
                .transform(new Function<HostAndPort, InetSocketAddress>() {
                    public InetSocketAddress apply(HostAndPort input) {
                        return new InetSocketAddress(input.getHostText(), input.getPort());
                    }
                })
                .toList();
    }

    @Override
    public ResponseStore createStore() {
        try {
            if (getServers().size() == 0) {
                return ResponseStore.NULL_STORE;