private synchronized void updateCachedValue(short key,Object value) throws IOException{
if (cachedValueWriter == null){
cachedValueWriter = new CachedValueWriter();
}
CachedValue cv = new CachedValue();
cv.setId(key);
cv.setValue(value);
cachedBytesOut.reset();
cachedValueWriter.writePacket(cv,cachedDataOut);
cachedDataOut.flush();
byte[] data = cachedBytesOut.getData();
int count = cachedBytesOut.size();
getTransportDataOut().writeByte(cv.getPacketType());
getTransportDataOut().writeInt(count);
getTransportDataOut().write(data,0,count);
}