MemcacheSetRequest.Item.Builder itemBuilder = MemcacheSetRequest.Item.newBuilder();
requestedKeys.add(entry.getKey());
itemBuilder.setKey(makePbKey(entry.getKey()));
ValueAndFlags vaf;
if (policy == MemcacheSetRequest.SetPolicy.CAS) {
CasValues value = (CasValues) entry.getValue();
if (value == null) {
throw new IllegalArgumentException(entry.getKey() + " has a null for CasValues");
}
vaf = serializeValue(value.getNewValue());
if (!(value.getOldValue() instanceof IdentifiableValueImpl)) {
throw new IllegalArgumentException(
entry.getKey() + " CasValues has an oldValue instance of an unapproved " +
"IdentifiableValue implementation. Perhaps you implemented your own " +
"version of IdentifiableValue? If so, don't do this.");
}
itemBuilder.setCasId(((IdentifiableValueImpl) value.getOldValue()).getCasId());
if (value.getExipration() != null) {
itemBuilder.setExpirationTime(value.getExipration().getSecondsValue());
} else {
itemBuilder.setExpirationTime(expires == null ? 0 : expires.getSecondsValue());
}
} else {
vaf = serializeValue(entry.getValue());