All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.spy.memcached.protocol.binary.OptimizedGetImpl Maven / Gradle / Ivy

There is a newer version: 2.8.4
Show newest version
package net.spy.memcached.protocol.binary;

import java.util.Collections;

import net.spy.memcached.ops.GetOperation;
import net.spy.memcached.ops.VBucketAware;
import net.spy.memcached.protocol.ProxyCallback;

/**
 * Optimized Get operation for folding a bunch of gets together.
 */
final class OptimizedGetImpl extends MultiGetOperationImpl {

	private final ProxyCallback pcb;

	/**
	 * Construct an optimized get starting with the given get operation.
	 */
	public OptimizedGetImpl(GetOperation firstGet) {
		super(Collections.emptySet(), new ProxyCallback());
		pcb=(ProxyCallback)getCallback();
		addOperation(firstGet);
	}

	/**
	 * Add a new GetOperation to get.
	 */
	public void addOperation(GetOperation o) {
		pcb.addCallbacks(o);
		for(String k : o.getKeys()) {
			addKey(k);
			setVBucket(k, ((VBucketAware)o).getVBucket(k));
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy