The invention discloses a flow-based local message classification method and device, and relates to the field of message classification, and the method comprises the steps: carrying out the parallel comparison of a keyword of a to-be-classified message with a keyword temporarily stored in a
shift register, obtaining a comparison result, and generating an index matching result through an
arbiter according to the comparison result; according to the locality principle of a
message flow, historically queried table item information is cached into a dynamic cache table, an
arbiter arbitrates a comparison result of a
shift register, calculates an offset address of the dynamic cache table and obtains a matching result, and whether an original rule table needs to be queried and whether a dynamic cache table memory needs to be updated are determined according to a search result. Under the condition that the matching is unsuccessful, the dynamic cache table memory can guide the same message to directly use the offset address to obtain the table item information in the next search without searching from an original rule table, so that the
hit rate is increased, the matching efficiency is improved, and the storage resources are saved.