org.jnosql.diana.memcached.key.MemcachedBucketManagerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of memcached-driver Show documentation
Show all versions of memcached-driver Show documentation
The Eclipse JNoSQL communication layer, Diana, implementation to Memcached
The newest version!
/*
* Copyright (c) 2019 Otávio Santana and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Otavio Santana
*/
package org.jnosql.diana.memcached.key;
import net.spy.memcached.ConnectionFactory;
import net.spy.memcached.MemcachedClient;
import org.jnosql.diana.api.key.BucketManagerFactory;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Queue;
import java.util.Set;
final class MemcachedBucketManagerFactory implements BucketManagerFactory {
private final ConnectionFactory factory;
private final List addresses;
MemcachedBucketManagerFactory(ConnectionFactory factory, List addresses) {
this.factory = factory;
this.addresses = addresses;
}
@Override
public MemcachedBucketManager getBucketManager(String bucketName) {
Objects.requireNonNull(bucketName, "bucketName is required");
try {
MemcachedClient client = new MemcachedClient(factory, addresses);
return new MemcachedBucketManager(client, bucketName);
} catch (IOException e) {
throw new MemcachedException("There is an error when try to create da BucketManager", e);
}
}
@Override
public void close() {
}
@Override
public Map getMap(String bucketName, Class keyValue, Class valueValue) {
throw new UnsupportedOperationException("This method is not supported");
}
@Override
public Queue getQueue(String bucketName, Class clazz) {
throw new UnsupportedOperationException("This method is not supported");
}
@Override
public Set getSet(String bucketName, Class clazz) {
throw new UnsupportedOperationException("This method is not supported");
}
@Override
public List getList(String bucketName, Class clazz) {
throw new UnsupportedOperationException("This method is not supported");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy