[agent] fix bug a class could be cached with the same name but different keys