# Content Management Based on Content Popularity Ranking in Information-Centric Networks
## 3 Content Management Based on Content Popularity Ranking
### Updating the Labels of the Tags
READ labels of the following tags of content \(i\)
2.\(E_{i}(x)\), \(D_{i}(x)\)
3.EXTRACT value of the download counter
4.\(C_{n_{i}}\), of content \(i\) at node \(n\)
5.SET the following time variables
6.\(t_{new}\), \(t_{life}\)
7.INITIALize the following time variable
8.\(t_{n_{i}}\)
9.CALCULATE the average download counter of node \(n\)
10.Using Equation (8)
11.\(C_{n_{avg}}\ =\ \frac{1}{m}\sum\limits_{i=1}^{m}(C_{n_{i}})\)
12.CALL update_labels ()
```  
**Algorithm 2**initialize 0```
1. IF \(t_{n_{i}}=t_{new}\)
2. \(E_{long}\to E_{medium}\);
3. \(D_{fresh}\to D_{current}\);
4. ELSE IF \(t_{n_{i}}=t_{life}\)
5. IF \(C_{n_{i}}\geq\ C_{t_{new}}\)
6. \(E_{medium}\to E_{long}\);
7. \(E_{short}\to E_{medium}\);
8. \(D_{stale}\to D_{current}\);
9. ELSE IF \(C_{n_{i}}<C_{t_{avg}}\)
10. \(E_{medium}\to E_{short}\);
11. \(D_{current}\to D_{stale}\);
12. ELSE IF \(C_{n_{i}}=0\)
13. \(E_{short}\to E_{zero}\);
14. \(\mathbf{CALL}\) delete_content (\(i\), \(n\))
15. END IF
16. \(\mathbf{END}\) IF
17. \(\mathbf{CALL}\) initialize ()
```

**Algorithm 3****update_labels 0**

### Content Removal Scheme Using CPR Mechanism

The proposed content caching scheme ensures that the content storage capacity of a node is handled efficiently by selectively caching the popular content, and content diversity is maintained among the neighboring nodes. However, cache overflow may still occur due to the size limitation of the repository as more and more forms of content are being generated and requested. An inefficient cache removal scheme may select the content for the replacement, which may be requested again soon. Therefore, cache misses may occur, and these forms of content would need to be fetched again from other servers. Subsequently, network resources will be consumed, and content delivery times will increase. To avoid frequent cache misses and reduce the content delivery times as much as possible, we proposed a content removal scheme using the CPR mechanism. The proposed content removal scheme selects an existing content for replacement based on the labels of the tags and the content popularity ranking in order to create enough space for incoming content that needs to be cached when there is a lack of storage capacity. The proposed content removal scheme follows the steps given in Algorithm 4 and Algorithm 5. Algorithm 4 is executed when the cache removal scheme is invoked by Algorithm 3 when content \(i\) from a node \(n\) is assigned the label _zero_ for the tag _expected lifetime_, and the content \(i\) is removed from the repository of node \(n\) immediately. Algorithm 5 is executed in two scenarios: one is when an intermediate node \(n\) decides to cache a requested content \(i\) because the CPR of that content is higher than \(P_{TH_{n}}\), but there is not enough space in the repository; therefore, the intermediate node has to select an existing content \(z\) for the removal. The other scenario is like this; a server node \(n\) initially received a request for content \(i\), but the content \(i\) was unavailable in the local storage of the node \(n\), and therefore, it was fetched from another server and then delivered to the client; now the server \(n\) is going to cache the fetched content \(i\), but there is a lack of space in the storage; so, an existing content \(z\) has to be selected for the removal from the server node \(n\). This process is repeated until there is enough space in the repository of node \(n\) for caching the new content \(i\). Algorithm 4 and Algorithm 5 are given below. ```
1. \(E_{i}(x)\to E_{zero}\)
2. \(\mathbf{ERASE}\) content \(i\) from node \(n\)
3. \  
The selection procedure of an appropriate content \(z\) for the removal is executed in several steps. At first, the current labels of the tags' _expected lifetime_ and _life duration_ are extracted from all the existing content. Then, in the 1 st step, all the content with both the labels _short_ and _stale_ for the tags mentioned above are removed from the repository altogether.