It seems it should have been ```$result``` instead of ```$results```.
It doesn't save a separate cache item for each ```$account```, at the moment this shouldn't be a problem since we don't allow a user to view another user's debts. Could be solved by using ```$result[$account->uid][$debt['id']]```.