Optimisation for referenced programs cache