With the sharp growth of cloud services and their possible combinations, the scale of data center network traffic has an inevitable explosive increasing in recent years. Software defined network (SDN) provides a scalable and flexible structure to simplify network traffic management. It has been shown that Ternary Content Addressable Memory (TCAM) management plays an important role on the performance of SDN. However, previous literatures, in point of view on rule placement strategies, are still insufficient to provide high scalability for processing large flow sets with a limited TCAM size. So caching is a brand new method for TCAM management which can provide better performance than rule placement. In this paper, we propose FDRC, an efficient flow-driven rule caching algorithm to optimize the cache replacement in SDN-based networks. Different from the previous packet-driven caching algorithm, FDRC is characterized by trying to deal with the challenges of limited cache size constraint and unpredictable flows. In particular, we design a caching algorithm with low-complexity to achieve high cache hit ratio by prefetching and special replacement strategy for predictable and unpredictable flows, respectively. By conducting extensive simulations, we demonstrate that our proposed caching algorithm significantly outperforms FIFO and least recently used (LRU) algorithms under various network settings.