1 | package net.spy.memcached.protocol.binary; |
2 | |
3 | import java.util.Collections; |
4 | |
5 | import net.spy.memcached.ops.GetOperation; |
6 | import net.spy.memcached.protocol.ProxyCallback; |
7 | |
8 | /** |
9 | * Optimized Get operation for folding a bunch of gets together. |
10 | */ |
11 | final class OptimizedGetImpl extends MultiGetOperationImpl { |
12 | |
13 | private final ProxyCallback pcb; |
14 | |
15 | /** |
16 | * Construct an optimized get starting with the given get operation. |
17 | */ |
18 | public OptimizedGetImpl(GetOperation firstGet) { |
19 | super(Collections.<String>emptySet(), new ProxyCallback()); |
20 | pcb=(ProxyCallback)getCallback(); |
21 | addOperation(firstGet); |
22 | } |
23 | |
24 | /** |
25 | * Add a new GetOperation to get. |
26 | */ |
27 | public void addOperation(GetOperation o) { |
28 | pcb.addCallbacks(o); |
29 | for(String k : o.getKeys()) { |
30 | addKey(k); |
31 | } |
32 | } |
33 | |
34 | } |