A method of controlling a content addressable memory (CAM) device. A data
structure is generated that specifies (i) a prioritized set of rules and
(ii) storage locations within the CAM device for one or more match
clauses of each of the rules. A new rule having a specified priority is
recorded in the data structure. Candidate storage locations within the
CAM device are identified within the CAM device for the match clauses of
each of the rules having a lower priority than the new rule. The
candidate storage locations are compared with the storage locations
specified by the data structure. Each match clause for which the
candidate storage location does not match the specified storage location
is stored in the CAM device.