Fix rule cache. Taking into consideration changes to the attributes of rules.

@dwightguth please review.