An essential aspect of the network paradigm called Named Data Networking (NDN) is that all nodes in the network have the ability to cache contents natively. The focus of this work relies on efficiently choosing which content should be removed from a full cache to allow storing another one. We propose a new caching replacement algorithm for NDN networks called Name Popularity Algorithm (NPA). The proposed algorithm adopts an extra table that takes into account a long time history for the popularity of contents. Thus, when a data content is removed from the cache, its popularity is not reset, improving the cache usage of the network routers. The performance of NPA is compared to well-known strategies in the literature through NS-3/ndnSIM simulations. The results indicate that the proposed algorithm overcomes others with lower end-to-end delay, higher cache hit ratio and smaller hop count. Besides, our code is available as open source to be accessible for other researchers and to allow reproduction of the results.