I have this if else statement where I don't know how to remove the code duplication
if(array_key_exists($key,$cachetable))
{
if($cachetable[$key] != $newdata[$key])
{
//data existed but is not valid
//update the cachetable
$cachetable[$key] == $newdata[$key]
}
}
else
{
//data didn't existed before in cache so add it now
//update the cachetable
$cachetable[$key] == $newdata[$key]
}