Cache management method, terminal and storage medium

By preloading and releasing dedicated hotspot data during switching in terminal devices according to application scenarios, optimizing the use of cache space, the problem of low cache management efficiency is solved, and the processor operation speed is improved and cache space is saved is achieved, and performance is achieved. Balance with cost.

CN114079671BActive Publication Date: 2024-12-31ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010772335.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-04
Publication Date
2024-12-31
Estimated Expiration
2040-08-04

AI Technical Summary

Technical Problem

The prior art is difficult to implement efficient cache management in terminal devices, resulting in increased overhead when the processor reads data and excessive cache space usage, affecting the balance of performance and cost.

Method used

By implementing a cache management method in a terminal device, special hotspot data is preloaded and released according to the application scenario switching, the preset release strategy is used to optimize the use of cache space, and the cache usage rate and processor running speed are improved.

Benefits of technology

It effectively saves the overhead of the processor to read data, improves the running speed of the processor, and reduces the use of cache space, achieving a balance between performance and cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114079671B_ABST
    Figure CN114079671B_ABST
Patent Text Reader

Abstract

The present invention discloses a cache management method, a terminal, and a storage medium, the method comprising: when it is determined that the terminal switches to a first application scenario, extracting dedicated hotspot data corresponding to the first application scenario from a non-cache area, and loading the dedicated hotspot data into a cache; when it is determined that the terminal switches from the first application scenario to a second application scenario, releasing the dedicated hotspot data corresponding to the first application scenario from the cache according to a preset release strategy. When the terminal switches to the first application scenario, the present invention preloads dedicated hotspot data matching the first application scenario into the cache, thereby saving the processor's overhead of reading data when running an application, and improving the processor's operating speed in the first application scenario. When the terminal switches from the first application scenario to the second application scenario, the dedicated hotspot data corresponding to the first application scenario is released from the cache, reducing the occupation of cache space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a cache management method, terminal equipment and storage medium. Background Art

[0002] When the processor reads data, it will first search for the required data in the cache. If it finds the data, it will execute it directly. If it does not find the data, it will search in the non-cache area. Since the cache runs much faster than the non-cache area, the cache can help the processor run faster. However, the cost of the cache is very expensive. As more and more application software is installed on terminal devices, there is more and more useless data in the cache. Therefore, a scientific cache mechanism needs to be developed to achieve a balance between performance and cost. Summary of the invention

[0003] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.

[0004] The embodiments of the present invention provide a cache management method, a terminal device and a storage medium, which can save the overhead of a processor reading data, thereby improving the operating speed of the processor and reducing the occupation of cache space.

[0005] In one aspect, an embodiment of the present invention provides a cache management method, the method comprising:

[0006] When it is determined that the terminal switches to the first application scenario, extracting the dedicated hotspot data corresponding to the first application scenario from the non-cache area, and loading the dedicated hotspot data into the cache;

[0007] When it is determined that the terminal switches from the first application scenario to the second application scenario, the dedicated hotspot data corresponding to the first application scenario is released from the cache according to a preset release strategy.

[0008] On the other hand, an embodiment of the present invention provides a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the cache management method as described above in the claim when executing the program.

[0009] In yet another aspect, an embodiment of the present invention provides a computer-readable storage medium storing a computer program, which implements the steps of the cache management method described above when executed by a processor.

[0010] The embodiment of the present invention includes: when it is determined that the terminal switches to the first application scenario, extracting the dedicated hotspot data corresponding to the first application scenario from the non-cache area, and loading the dedicated hotspot data into the cache; when it is determined that the terminal switches from the first application scenario to the second application scenario, releasing the dedicated hotspot data corresponding to the first application scenario from the cache according to a preset release policy. The technical solution provided by the embodiment of the present invention preloads the dedicated hotspot data matching the first application scenario into the cache when the terminal switches to the first application scenario, thereby improving the utilization rate of the cache, saving the processor's overhead of reading data when running the application, and improving the processor's running speed in the first application scenario. When the terminal switches from the first application scenario to the second application scenario, according to the preset release policy, the dedicated hotspot data corresponding to the first application scenario is released from the cache, reducing the occupancy of the cache space, so as to achieve a balance between performance and cost.

[0011] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation on the technical solution of the present invention.

[0013] Figure 1 It is a flowchart of a cache management method provided by an embodiment of the present invention;

[0014] Figure 2a yes Figure 1 A schematic diagram of the sub-step flow chart of step S110 in FIG.

[0015] Figure 2b yes Figure 1 Schematic diagram of the sub-step flow chart of step S121 in FIG.

[0016] Figure 3 is a flow chart of a cache management method provided by another embodiment of the present invention;

[0017] Figure 4 yes Figure 3 Schematic diagram of the sub-step flow chart of step S220 in FIG.

[0018] Figure 5 yes Figure 4 Schematic diagram of the sub-step flow chart of step S221 in FIG.

[0019] Figure 6is a flow chart of a cache management method provided by another embodiment of the present invention;

[0020] Figure 7 is a flow chart of a cache management method provided by another embodiment of the present invention;

[0021] Figure 8 is a schematic diagram of a process for acquiring shared hotspot data provided by an embodiment of the present invention;

[0022] Fig. 9 is a flow chart of a cache management method provided by another embodiment of the present invention;

[0023] Fig.10 is a flow chart of a cache management method provided by another embodiment of the present invention;

[0024] Fig.11 It is a schematic diagram of the structure of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0026] It should be understood that in the description of the embodiments of the present invention, if there is a description of "first", "second", etc., it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features or implicitly indicating the order of the indicated technical features. "At least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can represent: a, b, c, a and b, a and c, b and c or a and b and c, where a, b, c can be single or multiple.

[0027] In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0028] The cache management method provided in the embodiment of the present invention can be applied to terminal devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), etc., and can also be applied to smart home appliances such as televisions, speakers, washing machines, etc. The embodiment of the present invention does not impose any restrictions on the specific type of the terminal.

[0029] Figure 1 FIG. 1 is a flow chart of a cache management method provided by an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0030] S110, when it is determined that the terminal switches to the first application scenario, extracting dedicated hotspot data corresponding to the first application scenario from the non-cache area, and loading the dedicated hotspot data into the cache.

[0031] For example, a terminal usually has multiple applications installed. Since different types of applications have greatly different data to access when running, the embodiment of the present invention divides multiple application scenarios according to the types of applications installed in the terminal. Specifically, each application type can be set to correspond to an application scenario. For example, video applications are set as the first application scenario, game applications are set as the second application scenario, and online shopping applications are set as the third application scenario.

[0032] When the terminal device detects the user's operation of opening an application, the current application scenario of the terminal can be determined based on the user's operation. For example, for a terminal installed with the Android operating system, the Android daemon process can be used to monitor the user's operation of opening an application and determine which application the user has opened, thereby determining the current application scenario of the terminal. It should be understood that the first application scenario described in the embodiment of the present invention may refer to any one of the multiple application scenarios divided by the terminal. When the embodiment of the present invention determines that the terminal is currently switched to the first application scenario, the dedicated hotspot data corresponding to the current first application scenario is extracted from the non-cache area and loaded into the cache for buffering, thereby preloading the hotspot data to improve the cache usage rate and the cache hit rate during application operation, avoid the processor frequently reading data from the non-cache area to increase the I / O overhead, and improve the processor's operating speed and performance.

[0033] It should be understood that the dedicated hotspot data described in the embodiment of the present invention is hotspot data corresponding to a specified application scenario. For example, if data A is data that the terminal has previously accessed multiple times in a first application scenario, then data A can be used as dedicated hotspot data corresponding to the first application scenario.

[0034] like Figure 2a As shown, extracting the dedicated hotspot data corresponding to the first application scenario from the non-cache area in step S110 can be implemented through the following sub-steps S111 and S112.

[0035] S111, determining dedicated hotspot data corresponding to a first application scenario according to a mapping relationship between dedicated hotspot data and application scenarios;

[0036] S112, extracting dedicated hotspot data corresponding to the first application scenario from the non-cache area.

[0037] During specific implementation, at least one configuration list may be pre-set, and the mapping relationship between the dedicated hotspot data and the application scenario may be recorded through the configuration list.

[0038] In some embodiments, multiple configuration lists are provided, each configuration list corresponds to an application scenario, and each configuration list includes a data identifier and a data address of dedicated hotspot data. When it is determined that the terminal switches to a first application scenario, the configuration list corresponding to the first application scenario is searched, and the dedicated hotspot data corresponding to the first application scenario is extracted from the non-cache area according to the data address in the configuration list.

[0039] In other embodiments, only one configuration list is set, which includes the data identifier, data address and corresponding application scenario of the dedicated hotspot data. When it is determined that the terminal switches to the first application scenario, the dedicated hotspot data corresponding to the first application scenario is searched in the configuration list, and according to the data address in the configuration list, the dedicated hotspot data corresponding to the first application scenario is extracted from the non-cache area.

[0040] It should be understood that the cache described in the embodiments of the present invention is a storage space with a faster reading speed than the non-cache area. For example: in some embodiments, the cache may refer to RAM (Random Access Memory), and the non-cache area may refer to ROM (Read-Only Memory); in some embodiments, the cache may refer to SRAM (Static RAM), and the non-cache area may refer to DRAM (Dynamic RAM); in other embodiments, the cache may refer to memory, and the non-cache area may refer to a disk. The embodiments of the present invention do not specifically limit the storage devices referred to by the cache and non-cache areas respectively.

[0041] S120: When it is determined that the terminal switches from the first application scenario to the second application scenario, the dedicated hotspot data corresponding to the first application scenario is released from the cache according to a preset release strategy.

[0042] Exemplarily, when it is monitored that the application scenario of the terminal switches, the first application scenario is switched to the second application scenario, and the dedicated hotspot data corresponding to the first application scenario is released from the cache to avoid infrequently used data occupying too much cache space, so as to load the dedicated hotspot data corresponding to the second application scenario.

[0043] As an example, Figure 2b As shown, in step S120, releasing the dedicated hotspot data corresponding to the first application scenario from the cache according to a preset release strategy may include:

[0044] S121, determining a category of a first application scenario, wherein the category of application scenarios includes common scenarios and uncommon scenarios;

[0045] S122: When it is determined that the first application scenario is not a common scenario, the dedicated hotspot data corresponding to the first application scenario is released from the cache.

[0046] When the terminal switches from the first application scenario to the second application scenario, it determines whether the first application scenario is a not-so-common scenario. If it is determined that the first application scenario is not-so-common scenario, the dedicated hotspot data corresponding to the first application scenario is released from the cache to avoid infrequently used data occupying too much cache space.

[0047] Figure 3 A flowchart of a cache management method provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the following steps are included:

[0048] S210, determining that the terminal switches to the first application scenario, extracting dedicated hotspot data corresponding to the first application scenario from the non-cache area, and loading the dedicated hotspot data corresponding to the first application scenario into the cache;

[0049] S220, determining that the terminal switches from the first application scenario to the second application scenario, determining the category of the first application scenario, and if it is determined that the first application scenario is not a common scenario, executing step S230; if it is determined that the first application scenario is a common scenario, directly executing step S240;

[0050] S230, releasing the dedicated hotspot data corresponding to the first application scenario from the cache;

[0051] S240, extracting dedicated hotspot data corresponding to the second application scenario from the non-cache area, and loading the dedicated hotspot data corresponding to the second application scenario into the cache.

[0052] Figure 3In the example shown, when the terminal switches from the first application scenario to the second application scenario, it is determined whether the first application scenario is a not-very-common scenario. If it is determined that the first application scenario is not-very-common scenario, the dedicated hotspot data corresponding to the first application scenario is released from the cache to avoid excessive cache space occupied by infrequently used data. If it is determined that the first application scenario is a frequently used scenario, the dedicated hotspot data corresponding to the first application scenario is not released, so that the dedicated hotspot data corresponding to the first application scenario remains in the cache to avoid excessive memory I / O overhead caused by multiple loading of hotspot data of the first application scenario in the future.

[0053] As an example, Figure 4 As shown, in step S220, the process of determining the category of the first application scenario specifically includes:

[0054] S221, obtaining a usage heat value of the first application scenario.

[0055] It should be understood that the usage heat value of an application scenario represents the probability of the application scenario being used, and a larger usage heat value of an application scenario represents a higher probability of its being used.

[0056] S222: Determine whether the first application scenario is a common scenario or an uncommon scenario according to the usage heat value.

[0057] As an example, the ranking position of the first application scenario among multiple application scenarios can be determined in descending order of usage heat values. For example, the current terminal device is divided into M application scenarios, and the M application scenarios are sorted according to the usage heat values ​​of each application scenario, with the first application scenario having the highest usage heat value and the Mth application scenario having the lowest usage heat value. When the ranking position of the first application scenario is in the top N positions, the first application scenario is determined to be a commonly used scenario, otherwise it is an uncommon scenario, where N is an integer greater than 0, and N is less than M. Here, N can be a preset value, and among the M application scenarios, the N application scenarios with higher rankings in usage heat values ​​are taken as commonly used scenarios, and the rest are uncommon scenarios.

[0058] As an example, Figure 5 As shown, in step S221, the process of obtaining the usage heat value of the first application scenario specifically includes:

[0059] S2211, obtaining usage information of the first application scenario, where the usage information includes the number of times of use and the time point of use;

[0060] S2212: Perform a weighted calculation based on the number of times used and the time point of use to obtain a usage heat value of the first application scenario.

[0061] In specific implementation, the usage information of each application scenario can be recorded by setting a scenario list. In step S2211, the usage information of the first application scenario can be read from the scenario list.

[0062] This example uses a weighted calculation based on the number of uses and the time point of use to determine the usage heat value, and then divides the commonly used application scenarios according to the usage heat value. Compared with the division of commonly used / uncommonly used scenarios based only on the number of uses or the time point of use, the division method of this example can be more accurate and more in line with the user's usage needs. For example, a user may frequently use a certain application scenario in a certain period of time, so that the cumulative number of uses of this application scenario is higher than that of other application scenarios, but the time point of the most recent use of this application scenario is far away from the current time point. If this application scenario is determined as a commonly used scenario, it is obviously inappropriate. For another example, the user may have switched multiple application scenarios continuously. If the use time point is used as the basis for determining the commonly used scenario, the recently switched application scenarios will replace the previously commonly used application scenarios. However, the user may have only used these application scenarios once at present and will no longer use them in the future. If these application scenarios are determined as commonly used scenarios, it is also obviously inappropriate.

[0063] Figure 6 A flowchart of a cache management method provided by an embodiment of the present invention is shown in FIG. Figure 6 As shown, the following steps are included:

[0064] S301, determining that the terminal switches to a first application scenario, extracting dedicated hotspot data corresponding to the first application scenario from a non-cache area, and loading the dedicated hotspot data corresponding to the first application scenario into a cache;

[0065] S302, receiving an access request from a terminal in a first application scenario and determining the type of the access request; when receiving an access request from a terminal for dedicated hotspot data in the first application scenario, executing step S303a; when receiving an access request from a terminal for non-hotspot data in the first application scenario, executing step S303b;

[0066] S303a, updating access information of dedicated hotspot data;

[0067] S303b, taking the non-hotspot data as new dedicated hotspot data, and recording access information of the new dedicated hotspot data;

[0068] S304, determining whether the terminal switches from the first application scenario to the second application scenario; if the determination result is yes, executing step S305; if the determination result is no, returning to step S302;

[0069] S305, determining the category of the first application scenario; if it is determined that the first application scenario is an uncommon scenario, executing step S306; if it is determined that the first application scenario is a common scenario, directly executing step S307;

[0070] S306, releasing the dedicated hotspot data corresponding to the first application scenario from the cache;

[0071] S307, extracting the dedicated hotspot data corresponding to the second application scenario from the non-cache area, and loading the dedicated hotspot data corresponding to the second application scenario into the cache.

[0072] Exemplarily, the access request in step S302 represents a request by the processor to access required data in the first application scenario. If the data requested to be accessed by the access request is dedicated hotspot data that has been pre-loaded into the cache, the access information of the dedicated hotspot data is updated.

[0073] In a specific implementation, the access information of the dedicated hotspot data can be recorded through a configuration list, where the access information may include the number of accesses, access time, etc. The form of the configuration list can be found in Table 1 (the data address is not shown in the table). As shown in Table 1, the dedicated hotspot data corresponding to the current first application scenario that has been pre-loaded into the cache includes data A, B, C, D, and E, where the access information of data A includes: the number of accesses is 8, and the access time is 2020 / 5 / 6 8:00.

[0074] Table 1

[0075]

[0076]

[0077] When the processor requests access to data A in this first application scenario, and the time point for accessing data A is 2020 / 5 / 6 13:00, then according to this access request to data A, the corresponding access information of data A is updated: the number of accesses is increased by 1, so that the number of accesses is updated to 9, and the access time point is updated to the latest access time point 2020 / 5 / 6 13:00. The updated data A is shown in Table 2.

[0078] If the data requested by the access request is non-hotspot data that has not been loaded into the cache, it is necessary to search for the non-hotspot data in the non-cache area. When the requested non-hotspot data is found, the non-hotspot data is loaded into the cache, and a corresponding relationship is established between the non-hotspot data and the current first application scenario, thereby updating the non-hotspot data to dedicated hotspot data corresponding to the first application scenario, and recording the access information of the new dedicated hotspot data. For example, the processor requested access to data F in the first application scenario, and data F was not previously loaded into the cache. After the processor finds the data F from the non-cache area, it loads the data F into the cache, and adds it to the configuration list corresponding to the first application scenario as new dedicated hotspot data, and records the access information of data F in the configuration list. For details, please refer to Table 2.

[0079] Table 2

[0080]

[0081] In some embodiments, after the above step S303b, the buffer management method of the embodiment of the present invention further includes: Figure 7 Steps shown:

[0082] S401, calculating the total capacity of dedicated hotspot data;

[0083] S402, when the total capacity of the dedicated hotspot data reaches a first upper limit value, obtaining access information of the dedicated hotspot data, and determining an access heat value of the dedicated hotspot data according to the access information of the dedicated hotspot data; wherein the access information of the dedicated hotspot data includes at least one of the number of accesses and the access time point;

[0084] S403: Clear the dedicated hotspot data according to the access heat value of the dedicated hotspot data, so that the total capacity of the dedicated hotspot data is lower than the first upper limit value.

[0085] In a specific implementation, the data capacity of each dedicated hotspot data may be recorded in the configuration list, and the total capacity of the dedicated hotspot data may be obtained by summing up the data capacity of each dedicated hotspot data.

[0086] The access heat value of the dedicated hotspot data represents the probability of the dedicated hotspot data being accessed in the first application scenario. It can be understood that the higher the access heat value, the greater the probability of the dedicated hotspot data being accessed in the first application scenario, and the lower the access heat value, the lower the probability of the dedicated hotspot data being accessed in the first application scenario. Therefore, when the total capacity of the dedicated hotspot data in the configuration list corresponding to the first application scenario reaches the first upper limit value, the dedicated hotspot data with lower access heat values ​​can be eliminated until the total capacity of the dedicated hotspot data corresponding to the first application scenario is lower than the first upper limit value.

[0087] In one embodiment, the access information of the dedicated hotspot data includes the number of visits and the access time point; in step S402, the access heat value of the dedicated hotspot data is determined according to the access information of the dedicated hotspot data, which may specifically include: performing a weighted operation according to the number of visits and the access time point to obtain the access heat value of the dedicated hotspot data.

[0088] Generally speaking, the more times a certain hot data is accessed, or the closer the time point of the last access is to the current time point, it can be said to a certain extent that the probability of the hot data being accessed is relatively large, and a larger access heat value should be assigned. However, using only the number of accesses or the access time point as the basis for determining the access heat value is rather one-sided. For example, although some hot data has been accessed many times before, the time point of the last access is relatively far from the current time point. These hot data are no longer needed in the current application scenario. If these hot data continue to be stored in the cache, it will cause a waste of cache space. For another example, although the time point of the last access of some hot data is very close to the current time point, the processor only needs to access these hot data once, and there is no need to access these hot data again. If the hot data in the cache is eliminated according to the distance of the access time point, some hot data that are really frequently accessed will be eliminated, resulting in a decrease in the cache hit rate.

[0089] Therefore, the embodiment of the present invention performs weighted calculation on the number of accesses and the access time points to obtain the access heat value of the dedicated hotspot data, so as to ensure that the cache hit rate does not drop sharply after the hotspot data is cleared from the cache.

[0090] The first upper limit value in step S402 may be preset, for example, set to 10% of the cache space capacity.

[0091] In step S403, the dedicated hotspot data may be cleared one by one in the order of access heat value from small to large. For example, the dedicated hotspot data with the smallest access heat value is cleared first, and if the total capacity of the dedicated hotspot data is still not lower than the first upper limit, the next dedicated hotspot data is cleared, and so on, and the dedicated hotspot data in the configuration list are cleared in sequence until the total capacity of the dedicated hotspot data in the configuration list is lower than the first upper limit.

[0092] In some embodiments, the cache stores common hotspot data, wherein the common hotspot data represents hotspot data corresponding to all application scenarios, that is, the common hotspot data is hotspot data that has been accessed in all application scenarios. In this embodiment, these hotspot data corresponding to all application scenarios are fixedly stored in the cache to reduce the I / O overhead of loading hotspot data from the non-cache area to the cache each time the application scenario is switched.

[0093] For example, Figure 8 As shown in FIG. 1 , the process of obtaining shared hotspot data includes:

[0094] S510, obtaining a mapping relationship between each dedicated hotspot data and an application scenario;

[0095] S520: When it is determined that the dedicated hotspot data has a corresponding relationship with all application scenarios, the dedicated hotspot data is loaded into a cache as shared hotspot data for storage.

[0096] Exemplarily, the configuration list can be scanned for dedicated hotspot data to obtain the mapping relationship between each dedicated hotspot data and the application scenario. For example, as shown in Table 2, in this first application scenario, a dedicated hotspot data F is added to the configuration list of the first application scenario, and the terminal is divided into 3 application scenarios in total. By scanning the configuration list of the second application scenario and the third application scenario (see Table 3 and Table 4), it can be known that the data F already exists in the configuration list of the second application scenario and the third application scenario. Therefore, it can be considered that data F is a data hotspot that all application scenarios may access, so data F is updated from dedicated hotspot data to shared hotspot data, added to the configuration list of the full scene, and loaded into the cache for fixed storage. Specifically, when the application scene is switched, the newly added shared hotspot data can be loaded into the cache along with the dedicated hotspot data of the current application scene. It should also be understood that after data F is added to the configuration list of the full scene, the data F should be deleted from the configuration list of the first application scene, the second application scene, and the third application scene.

[0097] Table 3

[0098]

[0099] Table 4

[0100]

[0101] Table 5

[0102]

[0103] It should be understood that the number of accesses in the access information of shared hotspot data refers to the cumulative number of times the shared hotspot data is accessed in all application scenarios, and is not limited to counting the number of accesses in a single application scenario. Similarly, the access time points in the access information carried by the shared hotspot data are not limited to recording the access time points in a single application scenario.

[0104] In some embodiments, Fig. 9 As shown, after step S302 and before step S304, the following may also be included: S303c, when receiving an access request for shared hotspot data from a terminal in the first application scenario, updating access information of the shared hotspot data.

[0105] The access information carried by the shared hotspot data may include: the number of accesses, the access time point, etc. For example, if data G is shared hotspot data, when the processor requests to access data G in the first application scenario, the access information carried by data G is updated accordingly: the number of accesses is increased by 1, and the access time point is updated to the latest access time point.

[0106] In some embodiments, Fig.10 As shown, the method of the embodiment of the present invention may also include:

[0107] S610, calculating the total capacity of shared hotspot data;

[0108] S620, when the total capacity of the shared hotspot data reaches the second upper limit, obtaining access information of the shared hotspot data, and determining the access heat value of the shared hotspot data according to the access information of the shared hotspot data, wherein the access information of the shared hotspot data includes at least one of the number of accesses and the access time point;

[0109] S630: Clear the shared hotspot data according to the access heat value of the shared hotspot data, so that the total capacity of the shared hotspot data is lower than the second upper limit.

[0110] In one embodiment, the access information includes the number of visits and the access time point; in step S620, the access heat value of the shared hotspot data is determined based on the access information of the shared hotspot data, which may specifically include: performing a weighted operation based on the number of visits and the access time point to obtain the access heat value of the shared hotspot data.

[0111] As an example, the second upper limit value can be pre-set, such as set to 10% of the total cache capacity. When the total capacity of the shared hotspot data in the configuration list reaches the second upper limit value, the shared hotspot data in the cache can be cleared one by one in order of access heat value from small to large, so that the total capacity of the shared hotspot data in the cache is lower than the second upper limit value. For example, the shared hotspot data with the smallest access heat value is cleared first. If the total capacity of the shared hotspot data is still not lower than the second upper limit value, the shared hotspot data in the next position is cleared, and so on. The shared hotspot data in the cache is cleared in sequence until the total capacity of the shared hotspot data in the configuration list is lower than the second upper limit value.

[0112] It should be understood that in the above embodiments, the description of each embodiment has its own emphasis, and for the parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0113] It is further understood that, although the operations are described in a specific order in the accompanying drawings in the embodiments of the present invention, it should not be understood as requiring the operations to be performed in the specific order or serial order shown, or requiring the execution of all the operations shown to obtain the desired results. In certain environments, multitasking and parallel processing may be advantageous.

[0114] Fig.11 FIG. 5 shows a terminal 500 provided by an embodiment of the present invention. Fig.11 As shown, the terminal 500 includes but is not limited to:

[0115] Memory 501, used for storing programs;

[0116] The processor 502 is used to execute the program stored in the memory 501. When the processor 502 executes the program stored in the memory 501, the processor 502 is used to execute the above-mentioned cache management method.

[0117] The processor 502 and the memory 501 may be connected via a bus or other means.

[0118] The memory 501 is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs and non-transitory computer executable programs, such as the cache management method described in the embodiment of the present invention. The processor 502 implements the above-mentioned cache management method by running the non-transitory software programs and instructions stored in the memory 501.

[0119] The memory 501 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store and execute the above-mentioned cache management method. In addition, the memory 501 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 501 may optionally include a memory remotely arranged relative to the processor 502, and these remote memories may be connected to the processor 502 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.

[0120] The non-transient software programs and instructions required to implement the above cache management method are stored in the memory 501. When executed by one or more processors 502, the execution Figures 1 to 10 The illustrated embodiment provides a cache management method.

[0121] The embodiment of the present invention further provides a storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the above cache management method.

[0122] In one embodiment, the storage medium stores computer executable instructions, and the computer executable instructions are executed by one or more control processors 502, for example, by a processor 502 in the terminal device 500, so that the one or more processors 502 can execute Figures 1 to 10 The illustrated embodiment provides a cache management method.

[0123] The above described embodiments are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0124] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0125] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above implementation. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.

Claims

1. A cache management method, characterized in that: The method comprises: When it is determined that the terminal switches to the first application scenario, extracting the dedicated hotspot data corresponding to the first application scenario from the non-cache area, and loading the dedicated hotspot data into the cache; When it is determined that the terminal switches from the first application scenario to the second application scenario, releasing the dedicated hotspot data corresponding to the first application scenario from the cache according to a preset release strategy; Calculating the total capacity of the dedicated hotspot data corresponding to the first application scenario; When the total capacity of the dedicated hotspot data corresponding to the first application scenario reaches a first upper limit value, obtaining access information of the dedicated hotspot data corresponding to the first application scenario, the access information including the number of accesses and the most recent access time point; Performing a weighted calculation based on the number of accesses and the distance between the most recently accessed time point and the current time point to obtain an access heat value of the dedicated hotspot data corresponding to the first application scenario; According to the access heat value of the dedicated hotspot data corresponding to the first application scenario, the dedicated hotspot data corresponding to the first application scenario is cleared so that the total capacity of the dedicated hotspot data corresponding to the first application scenario is lower than the first upper limit value.

2. The method according to claim 1, characterized in that The extracting the dedicated hotspot data corresponding to the first application scenario from the non-cache area includes: Determining the dedicated hotspot data corresponding to the first application scenario according to a mapping relationship between the dedicated hotspot data and the application scenario; Dedicated hotspot data corresponding to the first application scenario is extracted from the non-cache area.

3. The method according to claim 1, characterized in that The method further comprises: When receiving a request for access to dedicated hotspot data from the terminal in the first application scenario, access information of the dedicated hotspot data is updated.

4. The method according to claim 1, characterized in that: Also includes: When receiving an access request for non-hotspot data from the terminal in the first application scenario, the non-hotspot data is used as new dedicated hotspot data, and access information of the new dedicated hotspot data is recorded.

5. The method according to claim 1, characterized in that The cache stores common hotspot data, which represent hotspot data corresponding to all application scenarios.

6. The method according to claim 5, characterized in that The process of obtaining the shared hotspot data includes: Acquire a mapping relationship between the dedicated hotspot data and the application scenario; When it is determined that the dedicated hotspot data has a corresponding relationship with all application scenarios, the dedicated hotspot data is loaded into the cache as the shared hotspot data for storage.

7. The method according to claim 1, characterized in that The releasing the dedicated hotspot data corresponding to the first application scenario from the cache according to a preset release strategy includes: Determining a category of the first application scenario, where the category includes an uncommon scenario and a common scenario; When it is determined that the first application scenario is an uncommon scenario, releasing the dedicated hotspot data corresponding to the first application scenario from the cache; or When it is determined that the first application scenario is a common scenario, the dedicated hotspot data corresponding to the first application scenario is retained in the cache.

8. The method according to claim 7, characterized in that The process of determining the category of the first application scenario includes: Obtaining a usage heat value of the first application scenario; The first application scenario is determined to be the common scenario or the uncommon scenario according to the usage heat value.

9. The method according to claim 8, characterized in that The process of obtaining the usage heat value of the first application scenario includes: Acquire usage information of the first application scenario, the usage information including the number of times of use and the time point of use; A weighted calculation is performed according to the number of times of use and the time point of use to obtain a usage heat value of the first application scenario.

10. A terminal, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 9 when executing the program.

11. A computer-readable storage medium, characterized in that: A computer program is stored, and when the program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.