1 | package net.spy.memcached.protocol.ascii; |
2 | |
3 | import java.util.HashSet; |
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 GetOperationImpl { |
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(new HashSet<String>(), 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 | getKeys().addAll(o.getKeys()); |
29 | pcb.addCallbacks(o); |
30 | } |
31 | } |