# Caching Transient Contents in Vehicular Named Data Networking: A Performance Analysis
## 5 Caching Transient Contents in V-NDN
### Freshness-Driven Caching (FDC) Strategy  
In this Section, we present a simple and fully distributed freshness-driven caching strategy that V-NDN nodes can apply without exchanging any additional control message. FDC is designed with two main targets in mind: to avoid cache inconsistency effects and to privilege caching contents with a longer residual lifetime.  
To overcome the cache inconsistency of the FP-Aware policy, FDC requires that information about the generation time (i.e., a timestamp) is added in the Data packet by the producer. The timestamp can be included as an additional MetaInfo field of the packet header, after the FP information, see Figure 3.  
Instead of using the FP information for setting the time a content can remain in the CS, the caching system must consider the residual freshness period (RFP), defined as:  
\[RFP=FP+timestamp-currentTime \tag{2}\]  
where _currentTime_ is the instant the vehicle is receiving the Data packet. A proper computation of the _RFP_ parameter is ensured by the fact that all vehicles maintain strict synchronization with the Coordinated Universal Time (UTC) that can be acquired from the Global Navigation Support System (GNSS) [42].  
When caching the Data packet, the node sets a timeout equal to _RFP_. When the timeout expires, the content is erased from the CS and, therefore, cache inconsistency is avoided. In FDC, RFP-based eviction is integrated with a traditional replacement policy, such as LRU. Therefore, in principle, Data packets could be erased also before the _RFP_ timeout expires.  
FDC also implements a probabilistic caching decision strategy based on the _RFP_ value: the target is to cache with higher probability the Data packets with a longer residual lifetime. The distinction between long- or short-lasting packets is done by setting a dynamic threshold value, _ThRFP_, obtained as the exponential weighted moving average (EWMA) of the RFP values carried by the received Data packets, regardless of their senders.  
More specifically, when a Data packet, \(i\), traverses a node, it is cached with probability \(P_{c}(i)\), which is computed as:  
\[P_{c}(i)=\left\{\begin{array}{ccc}1&&if&RF_{i}\geq Th_{RFP_{i}}\\ \frac{RFP_{i}}{Th_{RFP_{i}}}&&otherwise\end{array}\right. \tag{3}\]  
where:  
- _ThRFP_i is the current value of the threshold, as available at the reception of packet \(i\);  
- _RFP_i is the RFP value computed starting from the fields carried by packet \(i\).  
\begin{table}
\begin{tabular}{c c c c} \hline \hline  & **Hit Ratio [\%]** & **Inconsistency (FP = 20s)** & **Inconsistency (FP = 10s)** \\ \hline \(\alpha=1\) & 9.12\% & 3.81\% & 5.46\% \\ \(\alpha=2\) & 20.27\% & 7.01\% & 9.52 \% \\ \hline \hline \end{tabular}
\end{table}
Table 2: Cache hit ratio and inconsistency metrics in presence of CEE+LRU+FP-Aware policy, when varying the Zipf skewness parameter \(\alpha\) and the freshness period.  
Figure 3: New structure of the NDN Data packet.  
After the caching decision is taken, regardless of its outcome, the node updates the threshold as follows:  
\[Th_{RFP_{i+1}}=(1-\beta)Th_{RFP_{i}}+\beta\cdot RFP_{i} \tag{4}\]  
where parameter \(\beta\in(0,1)\) is set to 0.125 to avoid large fluctuations in the estimation and give more relevance to the historical values in front of the instantaneous ones, as commonly agreed in multiple works in the literature, e.g., [43; 44].  
At the reception of a subsequent Data packet, \(i+1\), the novel value \(Th_{RFP_{i+1}}\) will be used for the caching decision.