Mechanisms for storing and searching a hierarchy of items are disclosed
which may be particularly useful for implementing security policies and security
associations, such as, but not limited to Internet Protocol security (IPsec). A
hierarchy of items is stored in a search priority order. Multiple element definitions
and groups of elements are identified. Representations of the element definitions
and elements are stored in a prioritized searchable data structure in decreasing
search priority such that representations of each particular element definition
is stored after representations of a set of particular elements associated with
the particular element definition and before representations of lower priority
element definitions and their associated elements. The element definitions may
include Internet Protocol security policies and the elements may include Internet
Protocol security associations. The searchable data structure may include an associative
memory or a plurality of associative memory entries.