# Federated Learning-Based Service Caching in Multi-Access Edge Computing System
## 4 Proposed Service Caching Framework
### Service Caching Policies  
This section describes the cache strategy that provides optimal performance for distributed systems. Initially, a caching metric that considers the level of popularity is introduced. Subsequently, a cache replacement algorithm is presented to enhance system performance while considering the limitations imposed by the available resources. (1) Caching Score: Despite the benefit of popularity scores in predicting service demand, several drawbacks are associated with using popularity as a sole criterion for evaluating services. Popularity does not consider the resources required by each service. The deployment of resource-intensive services may result in the allocation of resources to other services. Consequently, the number of services that can be maintained in the cache decreases, leading to a corresponding decline in the ability to satisfy user requests. Hence, the cache score is computed as follows:  
\[CS_{m}(t_{m})=\big{\{}\frac{d_{i}^{m}(t_{m})}{c_{i}^{m}},1\leq i\leq S_{all} \big{\}}, \tag{14}\]  
where \(c_{i}^{m}\) denotes the computational resources required for service \(i\) in MEC server \(m\). Since the units of the operators in Equation (14) are distinct, they must be normalized to interval \((0,1)\) before being used to calculate the cache score. It can be seen that the service cache score is proportional to the popularity score to maximize the deployment of services that can satisfy the most user requests. By contrast, as the resource requirements of a service increase, its cache score decreases. This increases the number of services cached on each MEC server. (2) Service Cache Replacement: After calculating the list of cache scores for all services, each MEC server executes Algorithm 1 to provide a list of the most optimal services for the subsequent time slot operation. Each MEC server has unique service lists owing to user data and resource status variations. The primary objective of the cache score is to optimize the likelihood of cache service requests, whereas Algorithm 1 guarantees the alignment of cache service resources with the capacity of the individual MEC servers. In each operation time slot \(t_{m}\), the MEC servers individually gather data and compute the cache scores \(CS_{m}(t_{m})\) by using Equation (14). To select the most appropriate services, the MEC server employs a selection process whereby services in \(CS_{m}(t_{m})\) are listed in decreasing order based on their cache score. Selecting services with the highest score facilitates properly solving Equation (3). The popularity score value can evaluate the suitability of services for each MEC server, thanks to distributed training and decision making. In addition, performing calculations and cache replacement at each operation time slot \(t_{m}\) helps to consistently maintain cache performance. On the other hand, the MEC server concurrently computes and updates the current hardware state to align with the chosen services. This process satisfies Constraint (4) regarding system resources. Exclusively prioritizing cache performance optimization without considering current resources might result in the selection of services causing stress on the system. This not only leads to an inefficient allocation of resources, but also results in increased service latency. After completing the calculation process, each MEC server acquires a list denoted as \(S_{m}(t_{m}+1)\) consisting of services with the highest cache score while simultaneously satisfying resource limitations. Services that are not implemented on the MEC server are fetched from the cloud server, and redundant service caches are removed.