The invention discloses a control method and a control device of a cache resource of a shared cache type 
Ethernet switch, and relates to the communication field. The method includes following steps: receiving a data 
package and simultaneously performing hash calculation, then obtaining a flow index of the data 
package, and retrieving a data flow array according to the flow index to obtain flow information; retrieving a 
queue array according to a 
queue index to obtain the length of a current 
queue and a 
flow number of the queue; updating a used cache variable value of the flow information according to the length of the data 
package; carrying out different judging treatments of different flow behaviors according to a comparative result of an occupied cache value and a current credit value of the flow information with an average cache value, an 
attack flow credit threshold value, an 
attack flow cache value of a 
system; and updating the used cache value, the current credit value, an active flow count of the queue, the length of the queue in the flow information after forwarding the data package. The control method and the control device of the cache resource of the shared cache type 
Ethernet switch can respond timely according to a current use condition of the cache, discover an 
attack behavior rapidly, prevent the attack behavior from consuming the cache resources, and 
control network congestion effectively.