Optimal Cache Partitioning in Reliable Data Transport for Wireless Sensor Networks