# Content Management Based on Content Popularity Ranking in Information-Centric Networks
## 3 Content Management Based on Content Popularity Ranking
### Content Caching Scheme Using the CPR Mechanism  
Each node ranks all the available content at the local storage by measuring the CPR of each content using Equation (2). The objectives of the proposed caching scheme are to scatter the requested content among the surrounding nodes in such a way that the popular content, which mainly are the repeatedly requested content by the clients, are cached at the nearer nodes to the clients and stored for a longer time as well. Different server nodes may have different traffic loads and varied storage sizes. Therefore, all the content going through an intermediate node should not be cached at every node. Rather, a threshold needs to set so the content meeting the criteria of the threshold of a node can be cached at that node, and the other content which does not satisfy the criteria of the threshold of that node can be discarded. We defined a variable named _popularity threshold_, \(P_{TH}\), which indicates the ranking position in terms of content popularity an incoming content needs to have among the existing content at a node to be cached. Every node separately calculatesits \(P_{TH}\) variable each time it needs to cache a new content. The formula for determining the _popularity threshold_, \(P_{TH_{n}}\), of a node \(n\) assuming it has a total of \(m\) content is given in (6).  
\[P_{TH_{n}}=\frac{1}{10\times m}\sum_{j=1}^{m}\bigl{(}CPR_{j}\bigr{)} \tag{6}\]  
Here, \(P_{TH_{n}}\) is the _popularity threshold_ of a node \(n\) that has a total of \(m\) content. At first, the CPRs of all the \(m\) content are calculated, summed, and averaged so that the average CPR of all the content at that node is known. After that, the \(P_{TH_{n}}\) is set at 10% of the average CPR of all the content at each node. The responsible server nodes that initially receive the request for the content from the client nodes always cache those forms of content after fetching them from other server nodes. These servers move to the content removal scheme explained in Section 3.4 when there is not enough space for caching the content. On the other hand, the intermediate nodes follow Algorithm 1 and cache content only when the CPR of the content \(i\) is higher than \(P_{TH_{n}}\) of the node \(n\), as shown in (7). All the intermediate nodes also use the content removal scheme explained in Section 3.4 in case there is storage space unavailability.  
\[Cache\ content\ i\ at\ node\ n,\ if\ CPR_{i}>P_{TH_{n}} \tag{7}\]  
By following this tactic, diversity of the cache repository can be achieved as the less popular content can be cached at the farther nodes. Additionally, network resource consumption can be optimized, and creating bottlenecks can be avoided. The procedure for content caching using the CPR mechanism is given in Algorithm 1.  
```
INPUT new content \(i\), node \(n\), number of total content \(m\)
1. READ labels of the following tags of content \(i\)
2.\(T_{i}(x)\), \(E_{i}(x)\), \(D_{i}(x)\)
3. EXTRACT value of the download counter
4.\(C_{n_{i}}\), of content \(i\) at node \(n\)
5. DETERMINE values of the tags
6. Using Equation (4)
7. CALCULATE CPR of content \(i\)
8. Using Equation (5)
9.\(CPR_{i}=C_{n_{i}}\times\bigl{(}a\times T_{i}(x)+\beta\times E_{i}(x)+\gamma \times D_{i}(x)\bigr{)}\)
10. CALCULATE popularity threshold of node \(n\)
11. Using Equation (6)
12.\(P_{TH_{n}}=\frac{1}{10\times m}\sum_{j=1}^{m}\bigl{(}CPR_{j}\bigr{)}\)
13. IF\(CPR_{i}>P_{TH_{n}}\)
14. CLACHC content \(i\) at node \(n\)
15. ELSE DISCARD content \(i\)
16. END IF
```  
**Algorithm 1**cache_content 0