File sending method and device of multi-level cache architecture, equipment and medium
By adopting a multi-level cache architecture in the server, searching and verifying the files applied on the vehicle layer by layer, the problems of high pressure, slow access speed and system delay caused by the single-layer cache architecture are solved, and efficient file access and optimized network bandwidth usage are achieved.
Patent Information
- Application Number
- CN202411865456.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-03-25
AI Technical Summary
In the prior art, the server's local single-layer cache architecture causes problems with high pressure, slow access speed, and system delay.
Using a multi-level cache architecture, the files and file identifiers required for vehicle-side applications are stored at different levels, the target files are searched layer by layer, and the file validity is checked through timestamps.
It significantly reduces file search time, improves file access efficiency, optimizes network bandwidth usage, ensures the consistency and reliability of file services, and improves user experience.
Smart Images

Figure CN119697176A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of server technology, and in particular to a file sending method, device, equipment and medium of a multi-level cache architecture. Background Art
[0002] In the rapidly developing intelligent and networked automobile industry, the vehicle computer system plays a vital role as the core component of vehicle intelligence. It not only integrates navigation, entertainment, vehicle information display and other functions, but also gradually becomes an important bridge for vehicles to communicate with the outside world. With the continuous advancement of technologies such as the Internet of Things (IoT), big data, and cloud computing, the synchronous update of data or files between the vehicle computer data and the server has become a key link in realizing intelligent vehicle management and services.
[0003] In order to improve the efficiency of data file synchronization, the local cache architecture on the server side is generally used to store related data files. Since the local cache architecture is often a single-layer structure, that is, all data requests need to obtain response files or services from the single-layer cache architecture, on the one hand, it will increase the pressure on the server because all requests need to be processed and executed by the server; on the other hand, it will also lead to frequent remote calls, especially when the frequency of data access is high, which will affect the speed of data access and increase system latency. Summary of the invention
[0004] In view of this, the present invention provides a file sending method, device, equipment and medium with a multi-level cache architecture to solve the problems of high pressure, slow access speed and system delay caused by the local single-layer cache architecture of the server.
[0005] In a first aspect, the present invention provides a file sending method of a multi-level cache architecture, the method comprising:
[0006] Acquire a multi-level cache architecture, wherein each level of the multi-level cache architecture stores one or more files and file identifiers related to the vehicle-side application;
[0007] When receiving a request message from the vehicle end, searching for a target file corresponding to the file identifier in the multi-level cache architecture layer by layer according to the file identifier carried in the request message, wherein the target file is used to provide a service response to the request message;
[0008] If the target file is found, verify the validity of the target file according to the timestamp;
[0009] If valid, the target file will be sent to the vehicle end.
[0010] The file sending method of the multi-level cache architecture provided by the present invention utilizes the multi-level cache architecture to store the files and file identifiers required by the vehicle-side application at different levels. When the vehicle-side sends a request, the target file can be searched layer by layer. This hierarchical search method is usually faster than directly searching in a single storage, especially when the cache hit rate is high, which significantly reduces the search time and improves the file access efficiency.
[0011] Due to the existence of multi-level cache, the files or data with higher access frequency are cached in the first level, and the files with the next highest access frequency are stored in the second level. Therefore, when users request to access files with high access frequency, they can directly read the files from the first level and feed them back to the vehicle without downloading them from a more distant server or data center. This not only reduces the amount of network transmission, but also optimizes the use of network bandwidth, which is more obvious when the network is in poor condition or the bandwidth is limited.
[0012] In addition, this method verifies the validity of the target file through the timestamp, ensuring that the file received by the vehicle is the latest and not expired, which helps maintain the consistency and reliability of file services and avoids service interruptions or errors caused by expired or invalid files. In addition, due to the improvement of file access efficiency and the optimization of network bandwidth, the server side can more quickly find the files required by the vehicle-side application according to the vehicle-side request and provide timely feedback to the vehicle-side, thereby improving the user experience.
[0013] In combination with the first aspect, in an optional implementation, the multi-level cache architecture includes a first level, a second level, and a third level, wherein the first level is used to store application files with high access frequency; the second level is used to store application files with medium access frequency; and the third level is used to store application files with low access frequency;
[0014] The method of searching for a target file corresponding to the file identifier in the multi-level cache architecture layer by layer according to the file identifier carried in the request message includes: searching for whether the target file corresponding to the file identifier exists layer by layer in the order of the first level, the second level and the third level according to the file identifier.
[0015] In combination with the first aspect, in another optional implementation, the first level is a local memory cache, the second level is a Redis cache, and the third level is a distributed file system cache.
[0016] In combination with the first aspect, in another optional implementation, the checking the validity of the target file according to the timestamp includes: acquiring a first timestamp stored in a storage resource according to the file identifier, and acquiring a second timestamp recorded by the target file in the multi-level cache architecture;
[0017] The first timestamp and the second timestamp are compared; if the first timestamp is greater than the second timestamp, the target file is determined to be invalid; if the first timestamp is less than or equal to the second timestamp, the target file is determined to be valid. In this embodiment, the timestamp is used for verification to update the files in the multi-level cache architecture in real time to ensure that the files cached in each level are valid.
[0018] In combination with the first aspect, in another optional implementation, the method further includes: when the target file is invalid, obtaining the latest version of the target file in the storage resource, and sending the latest version of the target file to the vehicle end; and storing the latest version of the target file and the latest timestamp on a target level in the multi-level cache architecture. This implementation can obtain the latest version of the target file through other storage resources when it is determined that the file in the multi-level cache architecture is invalid, thereby responding to the request message of the vehicle end and completing the request task of the vehicle end.
[0019] In combination with the first aspect, in another optional implementation, the obtaining of the multi-level cache architecture includes: obtaining a multi-level cache architecture storing N files related to N vehicle-side applications, where N ≥ 1 and is a positive integer;
[0020] The process of storing the first file among the N files in the multi-level cache architecture includes:
[0021] Setting a priority for the first file according to a weight strategy; comparing the priority with a first threshold and a second threshold, the first threshold being greater than the second threshold; if the priority is greater than or equal to the first threshold, determining that the first file belongs to the first level; if the priority is greater than or equal to the second threshold and less than the first threshold, determining that the first file belongs to the second level; if the priority is less than the second threshold, determining that the first file belongs to the third level; storing the first file at a determined level and recording a timestamp of the current storage.
[0022] In combination with the first aspect, in another optional implementation, setting a priority for the first file according to a weight strategy includes: obtaining M reference factors related to the first file, the M reference factors including: at least one of access frequency, bandwidth utilization, memory utilization and vehicle operating parameters, M ≥ 1 and being a positive integer; obtaining M reference coefficients corresponding to the M reference factors, and calculating a weight value corresponding to each of the reference factors; calculating the priority of the first file according to the M reference coefficients and the corresponding M weight values.
[0023] In this implementation, by comprehensively considering multiple reference factors related to the first file (such as access frequency, bandwidth usage, memory usage, and vehicle operating parameters, etc.), and calculating the priority according to the reference coefficients and weight values corresponding to these factors, the importance and urgency of the file can be evaluated more accurately. This helps the system or device to prioritize resources to high-priority files when resources are limited, ensuring that mission-critical or frequently accessed files are processed in a timely and effective manner, thereby optimizing the overall resource utilization efficiency.
[0024] In addition, setting a reasonable priority for files can effectively reduce system delays or freezes caused by resource competition. Especially when the system faces high concurrent access or resource constraints, by giving priority to high-priority files, the system's response speed and performance stability can be ensured, improving the user experience.
[0025] In combination with the first aspect, in another optional embodiment, the calculation of the weight value corresponding to each of the reference factors includes: obtaining a first number of initial online vehicles and a second number of vehicles online at the current moment, as well as M initial weight values and M weight value constraints corresponding to at least M reference factors; calculating the growth rate of the number of online vehicles based on the first number and the second number; calculating M weight values corresponding to at least M reference factors based on the growth rate, at least the M initial weight values and the weight value constraints.
[0026] In this embodiment, in the process of setting the weight value of the reference factor, by comprehensively considering at least M reference factors and calculating the new weight value according to the growth ratio of the number of online vehicles and the initial weight values and constraints of these factors, the influence of each factor on the change of the number of online vehicles can be more accurately reflected. This refined analysis method helps to more deeply understand the changing rules of online vehicle behavior.
[0027] In addition, based on the calculated weight values, strategies can be formulated and adjusted more scientifically to cope with changes in the number of online vehicles. For example, for reference factors with higher weights, targeted measures can be taken to optimize the online behavior of vehicles, thereby improving overall operational efficiency. In addition, by accurately evaluating the weights of each reference factor, resources can be allocated and managed more effectively. For factors with lower weights, investment can be appropriately reduced, and more resources can be invested in factors with higher weights to achieve optimal resource allocation.
[0028] In combination with the first aspect, in another optional implementation, the method further includes: configuring an update cycle for each file according to the importance level and access frequency of the N files; and performing file updates and timestamp updates on the N files in the multi-level cache architecture according to the update cycle.
[0029] In a second aspect, the present invention provides a file sending device with a multi-level cache architecture, the device comprising:
[0030] An acquisition module, used to acquire a multi-level cache architecture, each level of which stores one or more files related to the vehicle-side application;
[0031] A receiving module, used for receiving a request message from the vehicle end;
[0032] a processing module, configured to search for a target file corresponding to the file identifier in the multi-level cache architecture layer by layer according to the file identifier carried in the request message when the receiving module receives the request message, and if the target file is found, verify the validity of the target file according to the timestamp, wherein the target file is used to provide a service response for the request message;
[0033] The sending module is used to send the target file to the vehicle end when the target file is valid.
[0034] In a third aspect, the present invention provides an electronic device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the file sending method of the multi-level cache architecture of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0035] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the file sending method of the multi-level cache architecture of the above-mentioned first aspect or any corresponding embodiment thereof.
[0036] In addition, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the file sending method of the multi-level cache architecture of the above-mentioned first aspect or any corresponding embodiment. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 It is a flowchart of a file sending method of a multi-level cache architecture according to an embodiment of the present invention;
[0039] Figure 2 is a schematic diagram of a multi-level cache architecture according to an embodiment of the present invention;
[0040] Figure 3 is a flowchart of another method for sending a file in a multi-level cache architecture according to an embodiment of the present invention;
[0041] Figure 4 is a schematic diagram of a process for setting a priority for a file according to an embodiment of the present invention;
[0042] Figure 5 is a structural block diagram of a file sending device according to an embodiment of the present invention;
[0043] Figure 6 It is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0045] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0046] Furthermore, the terms “first” and “second” are used for descriptive purposes only and should not be understood as indicating or implying relative importance.
[0047] The technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0048] The technical solution provided in the embodiment of the present application can be applied to application scenarios such as the server field and the Internet of Vehicles environment. The scenario includes at least one client and at least one server, and may also include other more or fewer network devices or nodes, such as switches, data centers, servers, etc.
[0049] The client may be a terminal device or a vehicle terminal. Specifically, for the vehicle terminal, it may be a vehicle processor, a vehicle controller or other devices. For the terminal device, it includes but is not limited to a mobile phone, a foldable smart mobile terminal, etc., which is not limited in this embodiment.
[0050] The client and the server can communicate via a wireless network, such as a WLAN connection.
[0051] In the Internet of Vehicles environment, the large screen system on the vehicle side usually integrates a variety of multimedia functions, including music playback. As users' requirements for music experience continue to increase during vehicle use, music configuration (such as sound effect settings, sound source list, etc.) also needs to be continuously updated and improved. In order to ensure that users can get the best music experience, the vehicle side needs to be able to obtain the latest music configuration information provided by the cloud server in a timely manner.
[0052] An embodiment of the present invention provides an embodiment of a file sending method of a multi-level cache architecture. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0053] In this embodiment, a file sending method with a multi-level cache architecture is provided to address the limitations of a single-layer cache structure and to design a multi-level cache architecture that achieves hierarchical management of data access by distinguishing different levels of cache and reasonably allocating data storage locations.
[0054] The method provided in this embodiment can be used for servers, server clusters, data centers, etc. Figure 1 is a flowchart of a file sending method of a multi-level cache architecture according to an embodiment of the present invention. Figure 1 As shown, the process includes:
[0055] Step S101: Acquire a multi-level cache architecture.
[0056] Each level of the multi-level cache architecture stores one or more files and file identifiers related to the vehicle-side application. The file identifier is used to find the file. The file identifier can be a file name, file address, file ID or other identity ID, etc. Specifically, the file identifier can be in the form of a string. It is composed of numbers, characters or symbols, which is not limited in this embodiment.
[0057] One or more files related to vehicle-side applications may be vehicle-side multimedia application software, such as a music APP, video playback APP, or navigation APP, shopping / online shopping APP, or various vehicle-side software and hardware applications such as vehicle control, large-screen diagnosis, air-conditioning equipment, voice equipment, on-board diagnostic instruments, instrument middleware, etc.
[0058] In a specific embodiment, Figure 2 The figure shows a schematic diagram of a multi-level cache architecture, which includes a first level L1, a second level L2, and a third level L3. Among them, the first level L1 is used to store application files with high access frequency, which means that the L1 local memory cache can quickly respond to high-frequency access data requests. In addition, the first level L1 can be located on the client side or the vehicle side. The characteristics of the L1 level include: high-speed cache, extremely fast access speed, and relatively small capacity.
[0059] The second level L2 is used to store application files with medium access frequency, specifically, to store data that is recently active but not as frequently accessed as data in L1. Optionally, the second level L2 is a Redis cache layer, which is used as an intermediate layer to cache most of the data. The characteristics of the L2 layer include: high-performance cache, support for data persistence, and large capacity.
[0060] The third level, L3, is used to store application files with low access frequency. It can provide large storage capacity and disperse access pressure through distributed characteristics. L3 can be a distributed file system cache used to store infrequently accessed data. The characteristics of the L3 level include: large-capacity storage, support for distributed deployment to disperse access pressure, and relatively slow access speed.
[0061] Optionally, the first level L1 is a local memory cache, the second level L2 is a Redis cache, and the third level L3 is a distributed file system cache.
[0062] The multi-level cache architecture designed in this embodiment not only improves the data access speed, but also reduces the load of the overall system.
[0063] Step S102: When receiving a request message from the vehicle end, according to the file identifier carried in the request message, the target file corresponding to the file identifier is searched layer by layer in the multi-level cache architecture.
[0064] like Figure 3 As shown, the server receives a request message from a client, such as a vehicle, in real time, such as a request to play a song or music. The server searches for a target file corresponding to the file identifier in the cache architecture layer by layer based on the file identifier in the request message.
[0065] The target file is used to provide a service response for the request message. For example, the target file is a target song or music requested to be played by the vehicle. Optionally, the target song or music is data in a certain file format and is pre-stored in a level in the multi-level cache architecture.
[0066] In this embodiment, a possible search method is to search whether the target file corresponding to the file identifier exists in the first level L1, the second level L2 and the third level L3 layer by layer according to the file identifier. It is understood that each level is searched layer by layer from L1 to L3 to see whether the target file is included. If the current level does not hit, that is, the target file is found, then try to search from the L2 layer and the L3 layer.
[0067] The client is responsible for initiating request messages or data requests and updating the local cache based on the results returned by the system. Advantages include: lightweight, support for multi-platform deployment, and the ability to quickly respond to updates to cloud data.
[0068] See also Figure 1 As shown, the method also includes:
[0069] Step S103: If the target file is found, the validity of the target file is checked according to the timestamp.
[0070] For example, if a target file corresponding to the file identifier is found in the L1 layer, the timestamp recorded in the target file is used to check whether the target file is valid.
[0071] Specifically, a possible implementation is to obtain a first timestamp stored in a storage resource according to a file identifier, and to obtain a second timestamp recorded in a multi-level cache architecture for a target file.
[0072] The storage resource may be a Redis cache, such as a Redis cache resource at the L2 level, or the storage resource may be other storage resources on the server, which are different from the aforementioned L1 to L3 levels. In other words, the storage resource may be different from the aforementioned L1 to L3 cache resources, or may be the same. This embodiment takes the storage resource as a Redis cache in L2 as an example.
[0073] Furthermore, Redis cache is a powerful, high-performance key-value storage system suitable for a variety of application scenarios. Its single-threaded model, in-memory storage, rich data structure support, persistence options, transaction support, publish / subscribe mode, master-slave replication, and clustering capabilities make it an important tool for modern application development. By properly configuring and using Redis, the performance and reliability of the application can be significantly improved.
[0074] This embodiment takes the storage resource as Redis cache as an example, and pre-stores the time information of the target file storage in the Redis cache, that is, the first timestamp. When the target file is stored in one of the levels L1 to L3, the time when the target file is stored in the L1 to L3 layers of the multi-level cache architecture is recorded, that is, the second timestamp.
[0075] Compare the first timestamp and the second timestamp; if the first timestamp is greater than the second timestamp, the target file is determined to be invalid, indicating that the current target file is not the latest file or the latest data. For example, if the first timestamp is 15:05 and the second timestamp is 14:58, then 15:05>14:58, indicating that the target file is stored with a time lag and is not the latest timestamp, which further indicates that the first timestamp stored and recorded in the Redis cache is the latest timestamp, and the target file stored under the first timestamp is not the latest file.
[0076] Otherwise, if the first timestamp is less than or equal to the second timestamp, the target file is determined to be valid. For example, if the first timestamp is 15:05 and the second timestamp is 15:10, then 15:05≤15:10, indicating that the target file or the version number of the target file stored at the target level is the latest.
[0077] Step S104: If the above step S103 is verified to be valid, the target file is taken out from a target level among L1 to L3, and the target file is sent to the vehicle end.
[0078] Step S105: If the target file is invalid, obtain the latest version of the target file in the storage resource, and send the latest version of the target file to the vehicle end.
[0079] The latest version of the target file can be obtained from the Redis cache (a storage resource). In addition, the latest version of the target file can also be obtained from other storage resources, such as from the local storage resources of the server. This embodiment does not limit this.
[0080] Optionally, the method provided in this embodiment, after step S105, further includes: storing the latest version of the target file and the latest timestamp on a target level in the multi-level cache architecture. The target level is a level among L1 to L3. The purpose of storage is to synchronize the target file or other data information on the server level and the multi-level cache architecture, so as to facilitate the next search by the client.
[0081] The file sending method provided in this embodiment utilizes a multi-level cache architecture to store files and file identifiers required by vehicle-side applications at different levels. When the vehicle-side sends a request, the target file can be searched layer by layer. This hierarchical search method is usually faster than searching directly in a single storage, especially when the cache hit rate is high, which significantly reduces the search time and improves the file access efficiency.
[0082] Due to the existence of multi-level cache, the files or data with higher access frequency are cached in the first level, and the files with the next highest access frequency are stored in the second level. Therefore, when users request to access files with high access frequency, they can directly read the files from the first level and feed them back to the vehicle without downloading them from a more distant server or data center. This not only reduces the amount of network transmission, but also optimizes the use of network bandwidth, which is more obvious when the network is in poor condition or the bandwidth is limited.
[0083] In addition, this method verifies the validity of the target file through the timestamp, ensuring that the file received by the vehicle is the latest and not expired, which helps maintain the consistency and reliability of file services and avoids service interruptions or errors caused by expired or invalid files. In addition, due to the improvement of file access efficiency and the optimization of network bandwidth, the server side can more quickly find the files required by the vehicle-side application according to the vehicle-side request and provide timely feedback to the vehicle-side, thereby improving the user experience.
[0084] In addition, the timestamp-based incremental update mechanism of this embodiment determines whether data needs to be updated by comparing the timestamps of the cloud Redis cache and the local application. This method only synchronizes data when necessary, greatly reduces the burden of network transmission, and improves the efficiency of data update.
[0085] In a specific implementation of this embodiment, Figure 3 FIG. 1 is a flow chart of another method for sending a file in a multi-level cache architecture provided in this embodiment.
[0086] The cloud includes a database and a timestamp management module, which are used to detect whether there are data changes in the cloud, and when changes are detected, trigger an update notification in the cloud database to inform the multi-level cache architecture to start the data update event. The timestamp management module is used to adjust the timestamp accuracy and update the timestamp, and add the updated timestamp together with the updated data or file to a target level of the multi-level cache architecture for use by client requests.
[0087] Specifically, in combination with the above Figure 1In the method steps shown, the client (such as the vehicle side) initiates a request message to the multi-level cache architecture of the server, such as performing two-way authentication of the vehicle side and the server side through https. After the authentication is passed, the target file is searched layer by layer in the multi-level cache architecture in the order of L1 to L3. During the search process, if the target file is found, the timestamp comparison is performed through the timestamp cache module to determine the validity of the target file.
[0088] Specifically, the comparison process refers to the description of the first timestamp and the second timestamp, which will not be repeated here. When it is determined through timestamp comparison that the multi-level cache architecture needs to be updated, that is, one or more target files currently cached in the L1-L3 levels are not new version files, or are not the latest data packets, it is determined that the multi-level cache structure needs to be updated, and the latest data packet or the latest version of the file is stored in a target level in L1-L3, completing the real-time update operation of the data on the multi-level cache architecture.
[0089] The implementation process of the above step S101: obtaining a multi-level cache architecture is introduced below.
[0090] In such Figure 2 The multi-level cache architecture shown in the figure assumes that N files related to N vehicle-side applications are stored, N ≥ 1 and is a positive integer. In this embodiment, N = 3. In this embodiment, taking the storage of one file among N files, such as the first file, to the multi-level cache architecture as an example, the storage process of the remaining N-1 files is the same.
[0091] Specifically, Figure 4 As shown, the process of storing the first file among N files in the multi-level cache architecture includes:
[0092] Step S401: setting a priority for the first file according to a weight strategy.
[0093] The weight strategy is a method of calculating the weight value of a file based on multiple factors, and is used to calculate the priority of each file to be stored.
[0094] Step S402: Compare the priority with the first threshold and the second threshold.
[0095] The first threshold is greater than the second threshold, and the first threshold and the second threshold can be customized. For example, the first threshold is 0.75, and the second threshold is 0.5.
[0096] Step S403: If the priority is greater than or equal to the first threshold, it is determined that the first file belongs to the first level.
[0097] Step S404: If the priority is greater than or equal to the second threshold and less than the first threshold, it is determined that the first file belongs to the second level.
[0098] Step S405: If the priority is less than the second threshold, it is determined that the first file belongs to the third level.
[0099] For example, if the priority of the first file is expressed as "P1", the size relationship among P1, 0.75, and 0.5 is determined.
[0100] If P1≥0.75, it is determined that the first file belongs to the first level L1; if 0.5≤P1<0.75, it is determined that the first file belongs to the second level L2; if P1<0.5, it is determined that the first file belongs to the third level L.
[0101] Step P406: Store the first file on a determined level and record the current storage timestamp. Specifically, if it is determined to belong to L1, store the first file on L1; similarly, if it belongs to L2, store it on L2; if it belongs to L3, store it on L3.
[0102] According to the new priority P_new, it can be decided in which layer the first file or target data should be stored: If P_new is very high (such as P>0.75), it means that the first file is very important and is frequently accessed, so it should be stored in the L1 layer, because the response to access on the L1 layer is the fastest, but it is also the most expensive storage layer. If P_new is medium (such as P>0.5), you can consider storing the first file in the L2 layer, because the L2 layer is a storage layer with a balanced cost and performance. If P_new is low (P>0), it means that the first file is not particularly important or is not frequently accessed, so it can be stored in the L3 layer, because the L3 layer has the slowest access speed, but compared with L1 and L2, the L3 layer is the most economical storage layer.
[0103] Furthermore, the above step S401: setting a priority for the first file according to the weight strategy specifically includes: obtaining M reference factors related to the first file, the M reference factors including: at least one of access frequency, bandwidth usage, memory usage and vehicle operation parameters, M≥1 and a positive integer; obtaining M reference coefficients corresponding to the M reference factors, and calculating the weight value corresponding to each reference factor; calculating the priority of the first file according to the M reference coefficients and the corresponding M weight values. Among them, the vehicle operation parameter can be represented by 0 or 1.
[0104] For example, in this embodiment, the weight value of the file is set taking into account the following reference factors:
[0105] 1. Access frequency (w): As more vehicles come online, the access frequency of some data may increase, especially some data related to vehicle status monitoring and safety. Therefore, for this data, the weight value of the access frequency can be appropriately increased.
[0106] 2. Bandwidth usage (i): As the number of online vehicles increases and network traffic increases, bandwidth becomes a more scarce resource. Therefore, for data that occupies a higher bandwidth, its weight value may need to be reduced to prioritize the rapid response of high-frequency, small-volume data.
[0107] 3. CPU and memory usage (c): As the load increases, the internal resources of the server become more scarce. For data processing tasks that require a lot of computing or memory support, their weight values can be appropriately reduced to avoid over-consumption of limited resources.
[0108] 4. Whether it is the core operation data of the vehicle (v), which can be understood as part of the data of the vehicle operation parameters: the importance of this factor may not change with the change of the number of vehicles. Since the core operation data of the vehicle is always the priority reference factor, the weight value of the core operation data of the vehicle needs to remain unchanged or slightly increased to ensure that the key data can be processed in time.
[0109] Optionally, the vehicle's core operating data (v) includes but is not limited to vehicle battery-related parameters, power consumption time, capacity; and motor-related parameters, such as power, power consumption, etc.
[0110] A process for stratifying data or files includes: real-time statistics on data access frequency, monitoring bandwidth indicators of cache components at all levels, and monitoring hardware resource indicators of cache components at all levels, such as CPU and memory usage, and finally calculating the weight value corresponding to each data or file according to the weight strategy, and determining to which level the data or file to be stored belongs based on the comparison of the weight values.
[0111] Furthermore, the above calculation of the weight value corresponding to each reference factor includes: obtaining a first number of initial online vehicles and a second number of vehicles online at the current moment, as well as M initial weight values and M weight value constraints corresponding to at least M reference factors; calculating the growth rate of the number of online vehicles based on the first number and the second number; calculating M weight values corresponding to at least M reference factors based on the growth rate, at least M initial weight values and weight value constraints.
[0112] For example, the weight value corresponding to each reference factor can be calculated through algorithm model design (adjust_weights). The input parameters include: the first number n1 of the initial online vehicles, the second number n2 of the current online vehicles, where n2>n1; the initial weight value w_xx of the access frequency, the initial weight value i_xx of the bandwidth usage, the initial weight value c_xx of the CPU and memory usage, and the initial weight value v_xx of whether it is the core operation data of the vehicle.
[0113] If the number of online vehicles increases from n1 to n2, it usually means that the system needs to process more requests, which may cause server bandwidth and hardware resources to become more strained. In this case, the system needs to re-evaluate the priority of the data and may adjust the distribution of data in the multi-level cache to optimize performance.
[0114] A specific implementation process includes: calculating the growth ratio of the number of online vehicles according to the first number n1 and the second number n2, growth_ratio = (n2-n1) / n1. Then, according to the growth ratio (growth_ratio), the initial weight value and the constraint condition of the weight value, calculating the M weight values corresponding to each reference factor. The calculation formula is as follows:
[0115] The weight value of access frequency w_new=w_xx*(1+0.1*growth_ratio), where 0.1=10%, indicating an increase of 10% weight, w_xx is the initial weight value of access frequency, and the constraint condition of the weight value is w_new=min(w_new,1.0). That is, the weight value w_new of access frequency (w), one of the reference factors, cannot exceed 1.0.
[0116] Similarly, the weight values of bandwidth usage (i), CPU and memory usage (c), and vehicle core operation data (v) are set respectively. One adjustment method is as follows:
[0117] The weight value i_new of bandwidth utilization rate (i) is i_new=i_xx*(1-0.1*growth_ratio), wherein 0.1=10%, indicating a 10% reduction in weight, i_xx being the initial weight value of bandwidth utilization rate, and the constraint condition of the weight value is i_new=max(i_new,0.0), indicating that the weight value i_new of bandwidth utilization rate (i), the second reference factor, is not less than 0.
[0118] The weight value of CPU and memory utilization (c) is c_new=c_xx*(1-0.05*growth_ratio), where 0.05=5% indicates that the weight needs to be reduced by 5%, c_xx is the initial weight value of CPU and memory utilization, and the constraint condition of the weight value is c_new=max(c_new,0.0), indicating that the weight value of the third reference factor, CPU and memory utilization (c), is not less than 0.
[0119] The weight value of the vehicle's core operating data (v) is v_new=v_xx*(1+0.05*growth_ratio), where 0.05=5%, indicating a 5% increase in weight, and v_xx indicates whether it is the initial weight value of the vehicle's core operating data. The constraint condition of the weight value is v_new=min(v_new,1.0), indicating that the weight of the vehicle's core operating data (v), one of the fourth reference factors, does not exceed 1.0.
[0120] According to the sum of weight values: all = w_new + i_new + c_new + v_new. For example, the sum of the weight values of the four reference factors all = 0.2 + 0.3 + 0.5 + 0.1 = 1.1, and then the weight value of each reference factor is obtained. The weight values of w_new, i_new, c_new and v_new are: w_new / all, i_new / all, c_new / all, v_new / all.
[0121] In a specific example, in order to calculate the priority of the current file, according to the relationship between the network configuration and M reference factors, the following initial parameters are preset: the first number of initial online vehicles n1=100, the second number of current online vehicles n2=150, the initial weight value of access frequency w_xx=0.5, the initial weight value of bandwidth utilization i_xx=0.3, the initial weight value of CPU and memory utilization c_xx=0.1, the initial weight value of whether it is the core operating data of the vehicle v_xx=0.1, and 4 reference coefficients: the coefficient of access frequency w=0.85, the coefficient of bandwidth utilization i=0.58, the coefficient of CPU and memory utilization c=0.61 and the coefficient of whether it is the core operating data of the vehicle v=1.
[0122] The above-mentioned preset initial parameters are input into the weight value algorithm model or the preset algorithm model, and the new 4 weight values, for example, the preset initial parameters based on the above configuration are processed by the weight value algorithm model to obtain the following 4 new weight values new_weights:{"w":0.525,"i":0.285,"c":0.0975,"v":0.1025}, and the priority is set for the corresponding target file according to the above-mentioned 4 new weight values new_weights, that is, after step S401, the priority of the current target file priority = 0.773525 is obtained, and the 0.773525 is compared with the above-mentioned first threshold of 0.75 and the second threshold of 0.5, and finally it is determined that the target file belongs to the first level "L1"; finally, the target file is stored on the first level L1.
[0123] It should be noted that the above steps S401 to S404 and the process of setting the weight value for each file can be implemented by "calling the process_data function". When the process_data function is called, the weight value calculation and setting process is automatically executed, thereby automatically determining the priority of the current target file and the target level to which it belongs, and the target level is one of L1 to L3.
[0124] This embodiment can more accurately evaluate the importance and urgency of files by comprehensively considering multiple reference factors related to the first file (such as access frequency, bandwidth usage, memory usage, and vehicle operating parameters, etc.), and calculating the priority according to the reference coefficients and weight values corresponding to these factors. This helps the system or device to prioritize resources to high-priority files when resources are limited, ensuring that mission-critical or frequently accessed files are processed in a timely and effective manner, thereby optimizing the overall resource utilization efficiency.
[0125] In addition, setting a reasonable priority for files can effectively reduce system delays or freezes caused by resource competition. Especially when the system faces high concurrent access or resource constraints, by giving priority to high-priority files, the system's response speed and performance stability can be ensured, improving the user experience.
[0126] In another possible implementation of this embodiment, as described above Figure 3 As shown, the method further includes: configuring an update cycle of each file according to the importance level and access frequency of the N files; and updating the files and timestamps of the N files in the multi-level cache architecture according to the update cycle. The update cycle can be freely set.
[0127] This embodiment achieves effective management of different types of data by dynamically adjusting the timestamp precision. Specifically, the system can dynamically adjust the timestamp precision according to the importance level and update frequency of the data. For example, for data with high frequency changes, the timestamp can be set to be updated once per second; while for data with low frequency changes, the timestamp can be set to be updated once every minute or longer. This approach not only improves system efficiency, but also reduces unnecessary resource consumption.
[0128] Another condition that triggers an update is that when the data in the cloud database changes, the system immediately updates the timestamp of the corresponding entry in the Redis cache. The timestamp is a marker used to identify the last time the entry was modified, and it is the basis for implementing incremental updates. Specifically, whenever a data item in the cloud database changes, the system appends a new timestamp value to the corresponding data entry in the Redis cache. This timestamp value reflects the last modification time of the data item, allowing the system to identify which data items are the latest and make corresponding update decisions accordingly.
[0129] For example, in an Internet of Vehicles application, the location information of a vehicle may change frequently. Whenever the location information of a vehicle is updated, the cloud database will update the location data of the vehicle and simultaneously update the timestamp of the location data entry of the vehicle in the Redis cache. Beneficial effect: The system can accurately know which data entry is the latest, so that the latest data can be quickly retrieved when needed.
[0130] In this embodiment, the limitation of fixed timestamp precision is solved by dynamically adjusting the timestamp precision. According to the importance and update frequency of the data, this embodiment realizes the dynamic adjustment of the timestamp precision. Specifically, for data or files with higher importance, a higher precision timestamp will be used to ensure its timeliness; while for data or files with lower importance, a lower precision timestamp can be used, thereby reducing unnecessary update operations. This method not only ensures the timely update of important data, but also avoids the waste of resources caused by excessive synchronization.
[0131] Specifically, the above timestamp precision adjustment process can be implemented through the "timestamp management module". Specifically, the timestamp management module is responsible for managing the timestamps of each data entry and dynamically adjusting the timestamp precision according to the importance and update frequency of the data. Beneficial effects of precision adjustment: flexible timestamp precision adjustment mechanism to ensure the timeliness of important data.
[0132] This embodiment provides a proposed multi-level cache architecture, which realizes hierarchical management of data access by distinguishing different levels of cache and reasonably allocating the storage location of data. Utilizing this multi-level cache architecture, it can provide different response speeds for different types of requests. For example, for data that is accessed frequently, the fastest data access speed can be achieved by using the L1 local memory cache; for data that is accessed less frequently, it can be stored through the L2 Redis cache or the L3 distributed file system cache, which ensures the accessibility of the data while not bringing too much pressure to the system.
[0133] In a method provided in this embodiment, the large screen system on the vehicle side can quickly obtain the latest music configuration information to ensure that the user has the best music experience. At the same time, through the multi-level cache architecture and dynamic timestamp precision adjustment technology, the system effectively reduces the burden of network transmission and server load while ensuring data timeliness, thereby improving the overall performance and reliability of the system.
[0134] In this embodiment, a file sending device with a multi-level cache architecture is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0135] See also Figure 5 , is a structural diagram of a file sending device with a multi-level cache architecture provided by an embodiment of the present invention, the device includes: an acquisition module 510, a receiving module 520, a processing module 530 and a sending module 540. In addition, the device may also include other more or fewer modules, such as a timestamp management module, a data synchronization module, etc., which are not limited in this embodiment.
[0136] Among them, the acquisition module 510 is used to obtain a multi-level cache architecture, and each level of the multi-level cache architecture stores one or more files related to the vehicle-side application.
[0137] The receiving module 520 is used to receive a request message from the vehicle end.
[0138] The processing module 530 is used to search for the target file corresponding to the file identifier in the multi-level cache architecture layer by layer according to the file identifier carried in the request message when the receiving module receives the request message. If the target file is found, the validity of the target file is verified according to the timestamp, wherein the target file is used to provide a service response for the request message.
[0139] The sending module 540 is used to send the target file to the vehicle end if the target file is valid.
[0140] In some optional implementations, the processing module 530 is specifically configured to search, according to the file identifier, layer by layer in the order of the first level, the second level, and the third level to see whether there is a target file corresponding to the file identifier.
[0141] In other optional implementations, the processing module 530 is specifically used to obtain a first timestamp stored in a storage resource based on a file identifier, and to obtain a second timestamp recorded in a multi-level cache architecture for a target file; compare the first timestamp and the second timestamp; if the first timestamp is greater than the second timestamp, determine that the target file is invalid; if the first timestamp is less than or equal to the second timestamp, determine that the target file is valid.
[0142] In some other optional implementations, the acquisition module 510 is also used to obtain the latest version of the target file in the storage resources when the target file is invalid, and send the latest version of the target file to the vehicle end.
[0143] The data synchronization module is used to store the latest version of the target file and the latest timestamp on a target level in the multi-level cache architecture.
[0144] In some further optional implementations, the acquisition module 510 is specifically used to acquire a multi-level cache architecture storing N files related to N vehicle-side applications, where N ≥ 1 and is a positive integer.
[0145] Processing module 530 is specifically used to set a priority for the first file according to a weight strategy, compare the priority with a first threshold and a second threshold, and the first threshold is greater than the second threshold; if the priority is greater than or equal to the first threshold, determine that the first file belongs to the first level; if the priority is greater than or equal to the second threshold and less than the first threshold, determine that the first file belongs to the second level; if the priority is less than the second threshold, determine that the first file belongs to the third level; store the first file at a determined level and record the current storage timestamp.
[0146] Furthermore, the above-mentioned processing module 530 is specifically used to obtain M reference factors related to the first file, the M reference factors include: at least one of access frequency, bandwidth utilization, memory utilization and vehicle operating parameters, M≥1 and is a positive integer; obtain M reference coefficients corresponding to the M reference factors, and calculate the weight value corresponding to each reference factor; calculate the priority of the first file based on the M reference coefficients and the corresponding M weight values, and send the priority to the acquisition module 510.
[0147] In some other optional embodiments, the acquisition module 510 is specifically used to obtain a first number of initial online vehicles and a second number of vehicles online at the current moment, as well as M initial weight values and M weight value constraints corresponding to at least M reference factors; calculate the growth rate of the number of online vehicles based on the first number and the second number; calculate the M weight values corresponding to at least M reference factors based on the growth rate, at least M initial weight values and the weight value constraints.
[0148] In some other optional embodiments, the timestamp management module and the data synchronization module are used to configure the update cycle of each file according to the importance level and access frequency of the N files, and to update the files and timestamps of the N files in the multi-level cache architecture according to the update cycle.
[0149] In addition, the timestamp management module is also used to manage the timestamps of music configurations and dynamically adjust the accuracy of timestamps according to the importance and update frequency of the configurations.
[0150] The data synchronization module is also responsible for comparing the timestamp of the Redis cache with the timestamp of the local application, and deciding whether to update the music configuration information of the local application based on the comparison result.
[0151] The large screen system on the vehicle is used for the user interface, displays music configuration information, and allows users to make relevant settings.
[0152] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0153] The file sending device in this embodiment is presented in the form of a functional unit, which refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0154] The embodiment of the present invention also provides an electronic device having the above Figure 5 The file sending device shown.
[0155] See also Figure 6 , is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present invention, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface).
[0156] In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0157] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0158] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the file sending method shown in the above embodiment.
[0159] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0160] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0161] The electronic device further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0162] The input device 30 can receive input digital or character information, and generate signal input related to the user settings and function control of the electronic device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0163] In addition, the electronic device also includes at least one communication interface for communicating with other devices or a communication network.
[0164] Optionally, the electronic device in this embodiment may be a server or a server cluster, or a data center, or other network equipment, etc., which is not limited in this embodiment.
[0165] An embodiment of the present invention further provides a file sending system with a multi-level cache architecture, the system comprising at least one client and a server, wherein each client and server can communicate with each other via a wireless network.
[0166] Furthermore, the client may be a vehicle or a vehicle terminal.
[0167] Each client can send a request message to the server, and the server is used to receive the request message and execute the above-mentioned Figure 1 , Figure 3 or Figure 4 The file sending method of the multi-level cache architecture shown in the figure can achieve the beneficial effect of significantly reducing the search time and improving the file access efficiency. The specific process is described in the above embodiment and will not be repeated here.
[0168] An embodiment of the present invention also provides a computer-readable storage medium, and the above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented by downloading through a network and originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware.
[0169] The storage medium may be a disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid state drive, etc.; further, the storage medium may also include a combination of the above-mentioned types of memories. It is understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by the computer, processor or hardware, the file sending method of the multi-level cache architecture shown in the above embodiment is implemented.
[0170] Embodiments of the present application may also provide a computer program product, including computer program instructions, which, when executed by a processor, cause the processor to perform the steps in the above method. Wherein, the computer program product may be written in any combination of one or more programming languages to perform program codes for performing the operations of the disclosed embodiments, wherein the programming languages include object-oriented programming languages, such as Java, C++, etc., and also include conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on a user computing device, partially on a user device, as an independent software package, partially on a user computing device, partially on a remote computing device, or entirely on a remote computing device or server.
[0171] The above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the embodiments of the present invention are described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A file sending method with a multi-level cache architecture, characterized in that: The method comprises: Acquire a multi-level cache architecture, wherein each level of the multi-level cache architecture stores one or more files and file identifiers related to the vehicle-side application; When receiving a request message from the vehicle end, searching for a target file corresponding to the file identifier in the multi-level cache architecture layer by layer according to the file identifier carried in the request message, wherein the target file is used to provide a service response to the request message; If the target file is found, verify the validity of the target file according to the timestamp; If valid, the target file will be sent to the vehicle end.
2. The method according to claim 1, characterized in that The multi-level cache architecture includes a first level, a second level and a third level, wherein the first level is used to store application files with high access frequency; the second level is used to store application files with medium access frequency; and the third level is used to store application files with low access frequency; The step of searching, layer by layer in the multi-level cache architecture, for a target file corresponding to the file identifier carried in the request message includes: According to the file identifier, a search is performed layer by layer in the order of the first level, the second level and the third level to determine whether there is a target file corresponding to the file identifier.
3. The method according to claim 2, characterized in that The first level is the local memory cache, the second level is the Redis cache, and the third level is the distributed file system cache.
4. The method according to any one of claims 1 to 3, characterized in that: The checking the validity of the target file according to the timestamp includes: Acquire a first timestamp stored in a storage resource according to the file identifier, and acquire a second timestamp recorded in the multi-level cache architecture for the target file; comparing the first timestamp and the second timestamp; If the first timestamp is greater than the second timestamp, determining that the target file is invalid; If the first timestamp is less than or equal to the second timestamp, it is determined that the target file is valid.
5. The method according to claim 4, characterized in that The method further comprises: When the target file is invalid, obtaining the latest version of the target file from the storage resource, and sending the latest version of the target file to the vehicle end; And, storing the latest version of the target file and the latest timestamp on a target level in the multi-level cache architecture.
6. The method according to claim 2, characterized in that The obtaining of the multi-level cache architecture includes: Obtain a multi-level cache architecture storing N files related to N vehicle-side applications, where N ≥ 1 and is a positive integer; The process of storing the first file among the N files in the multi-level cache architecture includes: Setting a priority for the first file according to a weight strategy; comparing the priority to a first threshold and a second threshold, the first threshold being greater than the second threshold; If the priority is greater than or equal to the first threshold, determining that the first file belongs to the first level; If the priority is greater than or equal to the second threshold and less than the first threshold, determining that the first file belongs to the second level; If the priority is less than the second threshold, determining that the first file belongs to the third level; The first file is stored at a determined level, and a timestamp of the current storage is recorded.
7. The method according to claim 6, characterized in that The step of setting a priority for the first file according to the weight strategy includes: Acquire M reference factors related to the first file, the M reference factors comprising: at least one of access frequency, bandwidth usage, memory usage, and vehicle operation parameters, where M≥1 and is a positive integer; Obtaining M reference coefficients corresponding to the M reference factors, and calculating a weight value corresponding to each of the reference factors; The priority of the first file is calculated according to the M reference coefficients and the corresponding M weight values.
8. The method according to claim 7, characterized in that The calculating the weight value corresponding to each of the reference factors includes: Obtaining a first number of initial online vehicles and a second number of current online vehicles, as well as M initial weight values and M weight value constraints corresponding to at least M reference factors; Calculate the growth rate of the number of online vehicles according to the first number and the second number; According to the growth ratio, at least the M initial weight values and the constraints of the weight values, M weight values corresponding to at least M reference factors are calculated.
9. The method according to claim 6, characterized in that The method further comprises: Configure the update cycle of each file according to the importance level and access frequency of the N files; The N files in the multi-level cache architecture are updated with file updates and time stamp updates according to the update cycle.
10. A file sending device with a multi-level cache architecture, characterized in that: The device comprises: An acquisition module, used to acquire a multi-level cache architecture, each level of which stores one or more files related to the vehicle-side application; A receiving module, used for receiving a request message from the vehicle end; a processing module, configured to search for a target file corresponding to the file identifier in the multi-level cache architecture layer by layer according to the file identifier carried in the request message when the receiving module receives the request message, and if the target file is found, verify the validity of the target file according to the timestamp, wherein the target file is used to provide a service response for the request message; The sending module is used to send the target file to the vehicle end when the target file is valid.
11. An electronic device, characterized in that: comprising a memory and a processor, wherein the memory and the processor are connected; The memory stores computer instructions, and the processor executes the file sending method of the multi-level cache architecture according to any one of claims 1 to 9 by executing the computer instructions.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the file sending method of the multi-level cache architecture according to any one of claims 1 to 9.
Citation Information
Cited By
Data caching method, system and device and storage medium
CN120583063A