1. A method of associating respective caching properties to each of a plurality of states of a state machine, the method comprising: storing a state machine corresponding to one or more patterns to be detected in a data stream, wherein the state machine comprises a plurality of states; generating a test data stream based on the one or more patterns; traversing the state machine with the test data stream; determining respective hit quantities associated with each of the plurality of states, the hit quantities each indicating a number of accesses to a corresponding state by the traversing with the test data stream; associating a caching priority to at least some of the plurality of states based on the hit quantities of the respective states, wherein a particular caching priority is associated with only a predetermined quantity of states having the highest hit quantities, and wherein the caching priorities further comprise lockable and not lockable flag bits corresponding to initial locking and unlocking priority states based on the respective hit quantities; determining a set of states from the initial locking and unlocking priority states having updated locking priority for an initial cache memory load based on a predefined criteria related to at least one of a frequency of access, a frequency of use, percentage of cache memory available for preloading, and association with predefined signatures; loading the set of states having the updated locking priority into the cache memory before the state machine is traversed based on an input data stream; evaluating the input data stream with reference to the state machine; loading state transition instructions associated with respective states of the state machine into a cache memory as respective states are necessary for evaluation of the input data stream; and retaining the loaded state machine instructions in the cache memory until a state transition instruction with a higher priority is assigned for storage in a memory location of the loaded state machine instruction.