Cache management method and device, electronic equipment and readable storage medium

By grading and caching management of pages in smart home device applications, the problem of excessive application cache is solved, and the effect of improving fluency and memory utilization efficiency is achieved.

CN119179569APending Publication Date: 2024-12-24GD MIDEA AIR CONDITIONING EQUIP CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411195994.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-24

AI Technical Summary

Technical Problem

Due to the diverse functions and numerous pages of applications for smart home devices, the application cache is too large, which reduces the smoothness of application usage.

Method used

By grading multiple pages in the application, compressing the page cache files when they are not opened, and decompressing the cache files of the subpages in advance when the page is opened, reducing the application's memory footprint and improving fluency.

Benefits of technology

Without affecting the normal use of the application, the application's memory usage is reduced, the usage fluency is improved, and the cache is automatically managed, avoiding the need for users to manually clean up the cache.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119179569A_ABST
    Figure CN119179569A_ABST
Patent Text Reader

Abstract

The invention provides a cache management method and device, electronic equipment and a readable storage medium. The cache management method comprises the following steps: grading a plurality of pages in an application program; a cache file corresponding to each page is determined, and when the page is not opened, the cache file corresponding to the page is in a compressed state; under the condition that the first page of the Nth level is opened, a plurality of cache files corresponding to the (N + 1) th level page corresponding to the first page are decompressed; wherein N is a positive integer, and the (N + 1) th-level page corresponding to the first page is a sub-page of the first page. Therefore, when the page is not opened, the cache file corresponding to the page is in the compressed state, and the cache file of the to-be-opened page is decompressed in advance through page grading, so that application cache can be reduced, the memory occupied by an application program can be reduced, and the use fluency of the application program can be improved under the condition that normal use of the application is not influenced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of memory management technology, and in particular to a cache management method and device, an electronic device and a readable storage medium. Background Art

[0002] At present, with the development of smart home technology, more and more smart home devices such as smart air conditioners, smart refrigerators and smart TVs can be remotely controlled on the client side by applications installed on the electronic devices, such as startup, shutdown and mode switching.

[0003] However, smart home devices have many functions, and there are also many function pages and plug-ins corresponding to different functions in the application. When the user uses the application to control the smart home devices, the application cache of the application will be large.

[0004] This increases the memory occupied by the application and reduces the smoothness of using the application. Summary of the invention

[0005] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.

[0006] To this end, a first aspect of the present invention is to propose a cache management method.

[0007] A second aspect of the present invention is to provide a cache management device.

[0008] A third aspect of the present invention is to provide an electronic device.

[0009] A fourth aspect of the present invention is to provide a readable storage medium.

[0010] A fifth aspect of the present invention is to provide a computer program product.

[0011] In view of this, according to one aspect of the present invention, a cache management method is proposed, which includes: grading multiple pages in an application; determining the cache file corresponding to each page, and when the page is not opened, the cache file corresponding to the page is in a compressed state; when the first page of the Nth level is opened, decompressing multiple cache files corresponding to the N+1th level page corresponding to the first page; wherein N is a positive integer, and the N+1th level page corresponding to the first page is a subpage of the first page.

[0012] The execution subject of the technical solution of the cache management method provided by the present invention can be an electronic device, or a cache management device, and can also be determined according to actual use requirements, which is not specifically limited here. In order to more clearly describe the cache management method provided by the present invention, the execution subject of the cache management method is described below as a cache management device.

[0013] Specifically, in the cache management method provided by the present invention, the cache management device obtains multiple pages contained in each application installed in the electronic device, and grades the multiple pages contained in each application. Further, the cache management device determines the cache file corresponding to each page in each application when rendering. Wherein, when the page in the application is not opened, the cache file corresponding to the page is in a compressed state. Further, in the process of the user using the application, when the user opens the first page of the Nth level of the application, the cache management device renders the first page, and after the rendering of the first page is completed, the background program is started to decompress the multiple cache files corresponding to the N+1th level page corresponding to the first page, so as to prepare for the user to open any N+1th level page corresponding to the first page. Wherein, N is a positive integer, and the N+1th level page corresponding to the first page is a subpage of the first page. In this way, when the page is not opened, the cache file corresponding to the page is in a compressed state, and the cache file of the page to be opened is decompressed in advance through page grading, which can reduce the application cache without affecting the normal use of the application, reduce the memory occupied by the application, and improve the fluency of the application.

[0014] The cache management method according to the present invention may also have the following additional technical features:

[0015] In some technical solutions, optionally, the cache management method also includes: when returning from the first page to the N-1 level page corresponding to the first page, compressing multiple cache files corresponding to the N+1 level page corresponding to the first page; wherein N is a positive integer greater than 1.

[0016] In this technical solution, when a user opens the first page of the Nth level of an application, if the user closes the first page and returns from the first page to the N-1th level page corresponding to the first page, the cache management device will compress multiple cache files corresponding to the N+1th level page corresponding to the first page to reduce the application cache. Wherein, N is a positive integer greater than 1. In this way, through page grading, after the application exits a certain page, the cache files of the sub-pages of the page are automatically compressed, which reduces the application cache, reduces the memory occupied by the application, and improves the fluency of the application. In addition, there is no need for the user to manually clean up the application cache, which helps to save the running status of the application and does not affect the running speed of the application.

[0017] In some technical solutions, optionally, the cache management method further includes: obtaining a time period during which the user uses the application; and managing the application cache of the application according to the time period.

[0018] In this technical solution, in the process of managing the application cache of the application, the cache management device can also obtain the time period of the user's use of the application, and then compress and decompress the application cache of the application according to the time period of the user's use of the application. In this way, the application cache of the application is managed based on the time period of the user's use of the application, which can avoid frequent compression and decompression of the application cache of the application.

[0019] In some technical solutions, optionally, the application cache of the application is managed according to the usage time period, including: during the usage time period, prohibiting the compression task of the cache files corresponding to the application; outside the usage time period, when the application is in a closed state, starting the compression task of the cache files corresponding to the application.

[0020] In this technical solution, in the process of the cache management device managing the application cache of the application based on the user's use time period of the application, during the above-mentioned use time period, the cache management device prohibits the execution of compression tasks on the cache files corresponding to the application, so as not to perform compression operations on the cache files of each page in the application during the use time period. Furthermore, outside the above-mentioned use time period, when the application is in a closed state, the cache management device restarts the background program, and starts the compression task on the cache files corresponding to the application through the background program, so as to perform compression operations on the cache files of each page in the application, thereby reducing the application cache of the application. In this way, combined with the user's use time period of the application, it is avoided to manage the application cache of the application during the high-frequency period when the user uses the application, and it is possible to avoid frequent compression and decompression of the application cache of the application.

[0021] In some technical solutions, optionally, the cache management method also includes: sending a heartbeat signal to the application to start the background program of the application; checking the completion status of the decompression task and / or compression task corresponding to the application through the background program; executing the decompression task and / or compression task in the interrupted state through the background program.

[0022] In this technical solution, in the process of managing the application cache of the application, the cache management device can also start the background program of the application by sending a heartbeat signal to the application, and then check the completion status of the decompression task and / or compression task corresponding to the application through the background program. On this basis, when the cache management device detects that any decompression task and / or compression task is in an interrupted state, the cache management device continues to execute the previously interrupted decompression task and / or compression task through the background program to continue to decompress and / or compress the application cache of the application. In this way, when the application is accidentally closed by the user, that is, when the decompression task and / or compression task corresponding to the application is accidentally interrupted, the previous decompression task and / or compression task can be continued to be completed, ensuring the smooth execution of the decompression task and / or compression task, thereby improving the accuracy of managing the application cache of the application.

[0023] In some technical solutions, optionally, the cache management method further includes: determining a second page in the application whose usage frequency is less than a preset threshold; and deleting a cache file corresponding to the second page.

[0024] In this technical solution, in the process of managing the application cache of the application, the cache management device can also determine the second page in the application whose usage frequency is less than a preset threshold. On this basis, the cache management device directly deletes the cache file corresponding to the determined second page. It can be understood that for pages with low usage frequency, even if the cache file of the page is compressed, the cache file of the page will become invalid because the user has not opened the page for a long time. Therefore, by directly cleaning up the cache files of infrequently used pages, the application cache of the application can be further reduced without affecting the normal use of the application by the user, thereby reducing the memory occupied by the application and improving the fluency of the application.

[0025] In some technical solutions, optionally, determining a second page in an application whose usage frequency is less than a preset threshold includes: determining a second page in the application whose usage frequency is less than a preset threshold based on a level of each page in the application; and / or determining a second page in the application whose usage frequency is less than a preset threshold based on a frequency of use of each page in the application by a user.

[0026] In this technical solution, in the process of the cache management device determining the second page in the application whose usage frequency is less than the preset threshold, the cache management device can specifically analyze the usage frequency of each page in the application according to the level of each page in the application, and then determine the second page in the application whose usage frequency is less than the preset threshold, such as the "Software License and User Service Agreement" page at the fourth or fifth level. Furthermore, the cache management device can also determine the second page in the application whose usage frequency is less than the preset threshold according to the frequency of users using each page in the application, so as to avoid misjudging pages with higher levels but less frequent usage as high-frequency pages. In this way, combining the page level and the frequency of users using the page to determine the low-frequency pages in the application can avoid misjudging pages with higher levels but less frequent usage as high-frequency pages, thereby ensuring the accuracy of determining low-frequency pages.

[0027] In some technical solutions, optionally, multiple cache files corresponding to the N+1th level page corresponding to the first page are compressed, including: obtaining the file type of each cache file; based on the first file in each file type, performing differential processing on at least one second file in each file type to obtain at least one differential file; compressing the first file and at least one differential file corresponding to each file type into a cache folder.

[0028] In this technical solution, in the process of the cache management device compressing multiple cache files corresponding to the N+1-level page corresponding to the first page, the cache management device can obtain the file type of each cache file and group the multiple cache files based on the file type. Furthermore, for cache files of each file type, the cache management device performs differential processing on other second files in each file type based on the first file in each file type to obtain at least one differential file corresponding to each first file. On this basis, the cache management device then compresses all the first files and differential files corresponding to the N+1-level page as a whole into a cache folder. In this way, after differential compression is performed on cache files of different file types at the same level, all cache files at the same level are compressed as a whole, which reduces the application cache of the application and facilitates the management of cache files.

[0029] In some technical solutions, optionally, multiple cache files corresponding to the N+1-level page corresponding to the first page are decompressed, including: obtaining a cache folder corresponding to the N+1-level page corresponding to the first page; decompressing the cache folder to obtain a first file and at least one differential file; and merging the first file and at least one differential file respectively to obtain multiple cache files.

[0030] In this technical solution, when the cache management device decompresses multiple cache files corresponding to the N+1-level page corresponding to the first page, the cache management device obtains the cache folder corresponding to the N+1-level page corresponding to the first page, and decompresses the cache folder to obtain the first file and at least one differential file corresponding to different file types in the N+1-level page. Further, for each file type, the cache management device merges each differential file and the first file in the file type respectively to obtain the second file corresponding to each differential file, thereby obtaining multiple cache files of each file type, thereby restoring all cache files corresponding to the N+1-level page. In this way, the cache files are decompressed by performing reverse operations according to the operation sequence of compressing the cache files, thereby ensuring the accuracy of the decompression operation.

[0031] According to a second aspect of the present invention, a cache management device is proposed, which includes: a processing unit, used to classify multiple pages in an application; the processing unit is also used to determine the cache file corresponding to each page, and when the page is not opened, the cache file corresponding to the page is in a compressed state; the processing unit is also used to decompress multiple cache files corresponding to the N+1th level page corresponding to the first page when the first page of the Nth level is opened; wherein N is a positive integer, and the N+1th level page corresponding to the first page is a subpage of the first page.

[0032] The cache management device provided by the present invention includes a processing unit, which obtains multiple pages contained in each application installed in an electronic device and grades the multiple pages contained in each application. Further, the processing unit determines the cache file corresponding to each page in each application when rendering. Wherein, when the page in the application is not opened, the cache file corresponding to the page is in a compressed state. Further, in the process of a user using the application, when the user opens the first page of the Nth level of the application, the processing unit renders the first page, and after the rendering of the first page is completed, the background program is started to decompress the multiple cache files corresponding to the N+1th level page corresponding to the first page, so as to prepare for the user to open any N+1th level page corresponding to the first page. Wherein, N is a positive integer, and the N+1th level page corresponding to the first page is a subpage of the first page. In this way, when the page is not opened, the cache file corresponding to the page is in a compressed state, and the cache file of the page to be opened is decompressed in advance through page grading, which can reduce the application cache without affecting the normal use of the application, reduce the memory occupied by the application, and improve the fluency of the application.

[0033] According to the third aspect of the present invention, an electronic device is proposed, comprising a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the cache management method in any of the above technical solutions are implemented. Therefore, the electronic device proposed in the third aspect of the present invention has all the beneficial effects of the cache management method in any of the above technical solutions in the first aspect, which will not be repeated here.

[0034] According to the fourth aspect of the present invention, a readable storage medium is provided, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the cache management method in any of the above technical solutions are implemented. Therefore, the readable storage medium provided in the fourth aspect of the present invention has all the beneficial effects of the cache management method in any of the technical solutions in the first aspect, and will not be repeated here.

[0035] According to a fifth aspect of the present invention, a computer program product is proposed, including a computer program, which, when executed by a processor, implements the steps of the cache management method in any of the above technical solutions. Therefore, the computer program product proposed in the fifth aspect of the present invention has all the beneficial effects of the cache management method in any of the technical solutions in the first aspect, and will not be repeated here.

[0036] Additional aspects and advantages of the present invention will become apparent from the following description or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0038] Figure 1 A schematic diagram showing a flow chart of a cache management method according to an embodiment of the present invention;

[0039] Figure 2 A schematic diagram showing page classification of a cache management method according to an embodiment of the present invention is shown;

[0040] Figure 3 A structural block diagram of a cache management device according to an embodiment of the present invention is shown;

[0041] Figure 4 A structural block diagram of an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0042] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.

[0043] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.

[0044] Combine the following Figures 1 to 4 , the cache management method and device, electronic device and readable storage medium provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.

[0045] In one embodiment of the present invention, Figure 1 As shown, the cache management method may specifically include the following steps 102 to 106:

[0046] Step 102, grading multiple pages in the application;

[0047] Step 104, determining the cache file corresponding to each page;

[0048] Step 106, when the first page of the Nth level is opened, decompress multiple cache files corresponding to the N+1th level page corresponding to the first page;

[0049] Among them, when the page is not opened, the cache file corresponding to the page is in a compressed state; N is a positive integer, and the N+1th level page corresponding to the first page is a subpage of the first page.

[0050] The execution subject of the technical solution of the cache management method provided by the present invention can be an electronic device, or a cache management device, and can also be determined according to actual use requirements, which is not specifically limited here. In order to more clearly describe the cache management method provided by the present invention, the execution subject of the cache management method is described below as a cache management device.

[0051] The cache management method provided by the present invention can reduce application cache without affecting normal use of the application.

[0052] Specifically, in the cache management method provided by the present invention, the cache management device obtains multiple pages contained in each application installed in the electronic device, and grades the multiple pages contained in each application. Further, the cache management device determines the cache file corresponding to each page in each application when rendering. Wherein, when the page in the application is not opened, the cache file corresponding to the page is in a compressed state. Further, in the process of the user using the application, when the user opens the first page of the Nth level of the application, the cache management device renders the first page, and after the rendering of the first page is completed, the background program is started to decompress the multiple cache files corresponding to the N+1th level page corresponding to the first page, so as to prepare for the user to open any N+1th level page corresponding to the first page. Wherein, N is a positive integer, and the N+1th level page corresponding to the first page is a subpage of the first page. In this way, when the page is not opened, the cache file corresponding to the page is in a compressed state, and the cache file of the page to be opened is decompressed in advance through page grading, which can reduce the application cache without affecting the normal use of the application, reduce the memory occupied by the application, and improve the fluency of the application.

[0053] Among them, the above-mentioned application can specifically be a client program for smart home devices installed in electronic devices, such as smart air conditioners, smart refrigerators, and smart TVs. The above-mentioned application can also specifically be software programs such as video applications, map applications, and shopping applications, and no specific restrictions are made here.

[0054] Furthermore, in the process of grading the multiple pages included in each application by the cache management device, the cache management device can specifically grade the multiple pages included in each application according to the order in which the user opens each page and the inclusion and inclusion relationship between the multiple pages. Specifically, for each page in the application, the cache management device can set the function page and plug-in page corresponding to each function control and plug-in in the page as the next level page of the page. For example, when the current page is a first level page, the page corresponding to each function control and plug-in in the current page is set as a second level page.

[0055] For example, Figure 2As shown, the application includes a home page, a device list page, a "My" page, a manual device add page, a home page setting page, a settings page, a service support page, a tool page, a smart dashboard settings page, a device sorting page, a background change page, a manual scene instruction page, a language setting page, a region setting page, an account setting page, a message setting page, a system permission page, a widget page, and a virtual plug-in page. Among them, the device list page and the "My" page are opened through the function control in the home page, the manual device add page and the home page setting page are opened through the function control in the device list page, the settings page, the service support page, and the tool page are opened through the function control in the "My" page, the smart dashboard settings page, the device sorting page, the background change page, and the manual scene instruction page are opened through the function control in the home page setting page, the language setting page, the region setting page, the account setting page, the message setting page, and the system permission page are opened through the function control in the settings page, and the widget page and the virtual plug-in page are opened through the function control in the tool page.

[0056] On this basis, the cache management device can set the home page as the first-level page, the device list page and the "My" page as the second-level pages corresponding to the home page, the manual device addition page and the home page settings page as the third-level pages corresponding to the device list page, the settings page, service support page and tool page as the third-level pages corresponding to the "My" page, the smart dashboard settings page, device sorting page, background change page and manual scene instruction page as the fourth-level pages corresponding to the home page settings page, the language settings page, region settings page, account settings page, message settings page and system permission page as the fourth-level pages corresponding to the settings page, and the widget page and virtual plug-in page as the fourth-level pages corresponding to the tool page.

[0057] Furthermore, to ensure the normal use of the application, the cache file corresponding to the homepage in the application can always be in a decompressed state so that the user can open the homepage of the application at any time.

[0058] In some embodiments of the present invention, optionally, the cache management method may further include the following step 134:

[0059] Step 134, when returning from the first page to the N-1th level page corresponding to the first page, compressing multiple cache files corresponding to the N+1th level page corresponding to the first page;

[0060] Wherein, N is a positive integer greater than 1.

[0061] In this embodiment, when a user opens the first page of the Nth level of an application, if the user closes the first page and returns from the first page to the N-1th level page corresponding to the first page, the cache management device will compress multiple cache files corresponding to the N+1th level page corresponding to the first page to reduce the application cache. Wherein, N is a positive integer greater than 1. In this way, through page grading, after the application exits a certain page, the cache files of the sub-pages of the page are automatically compressed, which reduces the application cache, reduces the memory occupied by the application, and improves the fluency of the application. In addition, there is no need for the user to manually clean up the application cache, which helps to save the running status of the application and does not affect the running speed of the application.

[0062] In some embodiments of the present invention, optionally, the cache management method may further include the following steps 108 and 110:

[0063] Step 108, obtaining the time period during which the user uses the application;

[0064] Step 110: managing the application cache of the application program according to the usage time period.

[0065] In this embodiment, in the process of managing the application cache of the application, the cache management device can also obtain the time period of the user's use of the application, and then compress and decompress the application cache of the application according to the time period of the user's use of the application. In this way, the application cache of the application is managed based on the time period of the user's use of the application, which can avoid frequent compression and decompression of the application cache of the application.

[0066] In some embodiments of the present invention, optionally, the above step 110 may specifically include the following steps 110a and 110b:

[0067] Step 110a, during the usage time period, prohibiting the execution of compression tasks on cache files corresponding to the application;

[0068] Step 110b: outside the usage time period, when the application is closed, start the compression task of the cache file corresponding to the application.

[0069] In this embodiment, in the process of the cache management device managing the application cache of the application based on the user's use time period of the application, the cache management device prohibits the execution of compression tasks on the cache files corresponding to the application during the above-mentioned use time period, so as not to perform compression operations on the cache files of each page in the application during the use time period. Furthermore, outside the above-mentioned use time period, when the application is in a closed state, the cache management device restarts the background program, and starts the compression task on the cache files corresponding to the application through the background program, so as to perform compression operations on the cache files of each page in the application, thereby reducing the application cache of the application. In this way, combined with the user's use time period of the application, it is avoided to manage the application cache of the application during the high-frequency period when the user uses the application, and it is possible to avoid frequent compression and decompression of the application cache of the application.

[0070] For example, user A returns home at 19:00 every day and opens the client application of the smart air conditioner, and opens the air conditioner plug-in through the client application during the time period from 19:00 to 19:10 to control the smart air conditioner. That is, the high-frequency period for user A to use the client application of the smart air conditioner is around 19:00 to 19:10. On this basis, during the time period from 19:00 to 19:10, the cache management device prohibits the execution of compression tasks on the cache files corresponding to the client application of the smart air conditioner, so as not to perform compression operations on the cache files of each page in the client application during the time period from 19:00 to 19:10.

[0071] Exemplarily, user B opens the client application of the rice cooker at 07:00 every day, and operates the rice cooker to perform the cooking task through the client application during the time period from 07:00 to 07:10. That is, the high-frequency period of user B using the client application of the rice cooker is around 07:00 to 07:10. On this basis, during the time period from 07:00 to 07:10, the cache management device prohibits the execution of the compression task on the cache file corresponding to the client application of the rice cooker, so as not to perform the compression operation on the cache files of each page in the client application during the time period from 07:00 to 07:10.

[0072] In some embodiments of the present invention, optionally, the cache management method may further include the following steps 112 to 116:

[0073] Step 112, sending a heartbeat signal to the application to start the background program of the application;

[0074] Step 114, checking the completion status of the decompression task and / or compression task corresponding to the application program through the background program;

[0075] Step 116: Execute the decompression task and / or compression task in the interrupted state through the background program.

[0076] In this embodiment, in the process of managing the application cache of the application, the cache management device can also start the background program of the application by sending a heartbeat signal to the application, and then check the completion status of the decompression task and / or compression task corresponding to the application through the background program. On this basis, when the cache management device detects that any decompression task and / or compression task is in an interrupted state, the cache management device continues to execute the previously interrupted decompression task and / or compression task through the background program to continue to decompress and / or compress the application cache of the application. In this way, when the application is accidentally closed by the user, that is, when the decompression task and / or compression task corresponding to the application is accidentally interrupted, the previous decompression task and / or compression task can be continued to be completed, ensuring the smooth execution of the decompression task and / or compression task, thereby improving the accuracy of managing the application cache of the application.

[0077] In the actual application process, in the process of starting the background program of the application, in order to follow the specifications and restrictions of the Android system as much as possible, the background program of the application can be triggered based on the FCM (Firebase Cloud Messaging, cross-platform cloud messaging) push service. Among them, the FCM push service belongs to GMS (Google Mobile Service). In theory, except for the case where the user manually stops GMS, as long as the electronic device is in the power-on state, GMS will always run in the background. Specifically, in the process of starting the background program of the application, based on the FCM push service, when the electronic device is connected to the Internet, a heartbeat signal is pushed to the application at regular intervals, such as every hour. After the heartbeat signal is received by GMS, it will be forwarded to the corresponding application registered with the FCM push service. At this time, the application can start the background program and check the completion status of the decompression task and / or compression task corresponding to the application through the background program to continue processing the previously unfinished decompression task and / or compression task.

[0078] In some embodiments of the present invention, optionally, the cache management method may further include the following steps 118 and 120:

[0079] Step 118, determining a second page in the application program whose usage frequency is less than a preset threshold;

[0080] Step 120, delete the cache file corresponding to the second page.

[0081] In this embodiment, in the process of managing the application cache of the application, the cache management device can also determine a second page in the application whose usage frequency is less than a preset threshold. On this basis, the cache management device directly deletes the cache file corresponding to the determined second page. It can be understood that for pages with low usage frequency, even if the cache file of the page is compressed, the cache file of the page will become invalid because the user has not opened the page for a long time. Therefore, by directly cleaning up the cache files of infrequently used pages, the application cache of the application can be further reduced without affecting the normal use of the application by the user, thereby reducing the memory occupied by the application and improving the fluency of the application.

[0082] Among them, the specific value of the above-mentioned preset threshold can be set by those skilled in the art according to actual conditions, and no specific limitation is made here.

[0083] In some embodiments of the present invention, optionally, the above step 118 may specifically include the following step 118a and / or step 118b:

[0084] Step 118a, determining, according to the level of each page in the application, a second page in the application whose usage frequency is less than a preset threshold;

[0085] Step 118b: Determine a second page in the application program whose usage frequency is less than a preset threshold value according to the frequency of each page in the application program used by the user.

[0086] In this embodiment, in the process of the cache management device determining the second page in the application whose usage frequency is less than the preset threshold, the cache management device can specifically analyze the usage frequency of each page in the application according to the level of each page in the application, and then determine the second page in the application whose usage frequency is less than the preset threshold, such as the "Software License and User Service Agreement" page at the fourth or fifth level. Furthermore, the cache management device can also determine the second page in the application whose usage frequency is less than the preset threshold by counting the frequency of users using each page in the application, so as to avoid misjudging pages with higher levels but less frequent usage as high-frequency pages. In this way, combining the page level and the frequency of users using the page to determine the low-frequency pages in the application, it is possible to avoid misjudging pages with higher levels but less frequent usage as high-frequency pages, thereby ensuring the accuracy of determining low-frequency pages.

[0087] In some embodiments of the present invention, optionally, the step of compressing the multiple cache files corresponding to the N+1th level page corresponding to the first page may specifically include the following steps 122 to 126:

[0088] Step 122, obtaining the file type of each cache file;

[0089] Step 124, based on the first file in each file type, performing differential processing on at least one second file in each file type to obtain at least one differential file;

[0090] Step 126: compress the first file and at least one differential file corresponding to each file type into a cache folder.

[0091] In this embodiment, in the process of the cache management device compressing multiple cache files corresponding to the N+1-level page corresponding to the first page, the cache management device can obtain the file type of each cache file and group the multiple cache files based on the file type. Furthermore, for cache files of each file type, the cache management device performs differential processing on other second files in each file type based on the first file in each file type to obtain at least one differential file corresponding to each first file. On this basis, the cache management device then compresses all first files and differential files corresponding to the N+1-level page as a whole into a cache folder. In this way, after differential compression is performed on cache files of different file types at the same level, all cache files at the same level are compressed as a whole, which reduces the application cache of the application and facilitates the management of cache files.

[0092] For cache files of each file type, the first file is any cache file of the file type, and the second file is other cache files of the file type except the first file.

[0093] Exemplarily, the fourth page is a subpage of the third page, the fifth page is a subpage of the fourth page, and the cache files corresponding to the fifth page include: A1, A2, A3, A4, B1, B2, B3 and C, a total of 8 files. When the user controls the application to return from the fourth page to the third page, the cache management device begins to compress the cache files corresponding to the fifth page, namely A1, A2, A3, A4, B1, B2, B3 and C. Specifically, A1, A2, A3 and A4 are cache files of the same type, and the cache management device performs differential processing on A2, A3 and A4 based on A1. Among them, the differential file DIFF1 corresponding to A2 = A2-A1, the differential file DIFF2 corresponding to A3 = A3-A1, and the differential file DIFF3 corresponding to A4 = A4-A1. Similarly, B1, B2 and B3 are cache files of the same type, and the cache management device performs differential processing on B2 and B3 based on B1. Among them, the differential file DIFF4 corresponding to B2 = B2-B1, and the differential file DIFF5 corresponding to B3 = B3-B1. Furthermore, since the cache file of the file type to which C belongs is only C, the cache management device does not perform differential processing on C. On this basis, the cache management device further compresses A1, DIFF1, DIFF2, DIFF3, B1, DIFF4, DIFF5 and C as a whole to obtain the cache folder corresponding to the fifth page.

[0094] In actual application, when the cache management device performs differential processing on cache files of each file type, the cache management device can also generate a diff_config.json file, which is used to record the first file used as the differential basis in each file type. For example, cache files are classified according to file suffixes, where there are multiple cache files of the ".zip" file type. The cache management device selects the cache file a.zip as the differential basis to perform differential processing on other cache files of the same type. On this basis, the cache management device can generate a diff_config.json file with a structure of {"type":"zip","base":"a.zip"} to record that the differential basis of cache files of the ".zip" file type is a.zip.

[0095] In some embodiments of the present invention, optionally, the step of decompressing the multiple cache files corresponding to the N+1th level page corresponding to the first page may specifically include the following steps 128 to 132:

[0096] Step 128, obtaining a cache folder corresponding to the N+1th level page corresponding to the first page;

[0097] Step 130, decompressing the cache folder to obtain a first file and at least one differential file;

[0098] Step 132: merge the first file and at least one differential file respectively to obtain a plurality of cache files.

[0099] In this embodiment, in the process of the cache management device decompressing multiple cache files corresponding to the N+1-level page corresponding to the first page, the cache management device performs reverse operations according to the operation sequence of compressing the multiple cache files corresponding to the N+1-level page. Specifically, the cache management device obtains the cache folder corresponding to the N+1-level page corresponding to the first page, and decompresses the cache folder to obtain the first file and at least one differential file corresponding to different file types in the N+1-level page. Further, for each file type, the cache management device merges each differential file and the first file in the file type respectively to obtain the second file corresponding to each differential file, thereby obtaining multiple cache files of each file type, thereby restoring all cache files corresponding to the N+1-level page. In this way, the cache files are decompressed by performing reverse operations according to the operation sequence of compressing the cache files, thereby ensuring the accuracy of the decompression operation.

[0100] The cache management device may determine the first file used as a differential basis in each file type by reading the previously generated diff_config.json file.

[0101] Exemplarily, the cache folder corresponding to the fifth page includes four files, namely A1, DIFF1, DIFF2, and DIFF3, and the structure of the generated diff_config.json file is {"type":"A","base":"A1.zip"}. On this basis, when the cache management device decompresses the multiple cache files corresponding to the fifth page, the cache management device first decompresses the cache folder as a whole, and then determines that the differential basis of the cache file of the "A" file type is file A1 by reading the diff_config.json file. Furthermore, the cache management device merges A1 with DIFF1, DIFF2, and DIFF3, respectively, to obtain cache files A2, A3, and A4, respectively.

[0102] In one embodiment of the present invention, a cache management device is also provided. Figure 3 As shown, Figure 3 The structure block diagram of the cache management device 300 according to the embodiment of the present invention is shown. The cache management device 300 may specifically include the following processing unit 302:

[0103] The processing unit 302 is used to classify multiple pages in the application program;

[0104] The processing unit 302 is further used to determine the cache file corresponding to each page. When the page is not opened, the cache file corresponding to the page is in a compressed state;

[0105] The processing unit 302 is further configured to decompress a plurality of cache files corresponding to a page of the N+1th level corresponding to the first page when the first page of the Nth level is opened;

[0106] Wherein, N is a positive integer, and the (N+1)th level page corresponding to the first page is a subpage of the first page.

[0107] The cache management device 300 provided in the embodiment of the present invention includes a processing unit 302, which obtains multiple pages contained in each application installed in the electronic device and grades the multiple pages contained in each application. Further, the processing unit 302 determines the cache file corresponding to each page in each application when rendering. Wherein, when the page in the application is not opened, the cache file corresponding to the page is in a compressed state. Further, in the process of the user using the application, when the user opens the first page of the Nth level of the application, the processing unit 302 renders the first page, and after the rendering of the first page is completed, the background program is started to decompress the multiple cache files corresponding to the N+1th level page corresponding to the first page, so as to prepare for the user to open any N+1th level page corresponding to the first page. Wherein, N is a positive integer, and the N+1th level page corresponding to the first page is a subpage of the first page. In this way, when the page is not opened, the cache file corresponding to the page is in a compressed state, and the cache file of the page to be opened is decompressed in advance through page grading, which can reduce the application cache without affecting the normal use of the application, reduce the memory occupied by the application, and improve the fluency of the application.

[0108] Among them, the above-mentioned application can specifically be a client program for smart home devices installed in electronic devices, such as smart air conditioners, smart refrigerators, and smart TVs. The above-mentioned application can also specifically be software programs such as video applications, map applications, and shopping applications, and no specific restrictions are made here.

[0109] Furthermore, in the process of the processing unit 302 grading the multiple pages included in each application, the processing unit 302 can specifically grade the multiple pages included in each application according to the order in which the user opens each page and the inclusion and inclusion relationship between the multiple pages. Specifically, for each page in the application, the processing unit 302 can set the function page and plug-in page corresponding to each function control in the page as the next level page of the page. For example, when the current page is a first level page, the page corresponding to each function control and plug-in in the current page is set as a second level page.

[0110] Furthermore, to ensure the normal use of the application, the cache file corresponding to the homepage in the application can always be in a decompressed state so that the user can open the homepage of the application at any time.

[0111] In some embodiments of the present invention, optionally, the processing unit 302 is also used to: compress multiple cache files corresponding to the N+1th level page corresponding to the first page when returning from the first page to the N-1th level page corresponding to the first page; wherein N is a positive integer greater than 1.

[0112] In some embodiments of the present invention, optionally, the processing unit 302 is further configured to: obtain a time period during which the user uses the application; and manage the application cache of the application according to the time period.

[0113] In some embodiments of the present invention, optionally, the processing unit 302 is specifically used to: prohibit the execution of compression tasks on cache files corresponding to the application during the usage time period; and start the compression task on the cache files corresponding to the application outside the usage time period when the application is in a closed state.

[0114] In some embodiments of the present invention, optionally, the processing unit 302 is also used to: send a heartbeat signal to the application to start the background program of the application; check the completion status of the decompression task and / or compression task corresponding to the application through the background program; execute the decompression task and / or compression task in the interrupted state through the background program.

[0115] In some embodiments of the present invention, optionally, the processing unit 302 is further configured to: determine a second page in the application program whose usage frequency is less than a preset threshold; and delete a cache file corresponding to the second page.

[0116] In some embodiments of the present invention, optionally, the processing unit 302 is specifically used to: obtain the file type of each cache file; based on the first file in each file type, perform differential processing on at least one second file in each file type to obtain at least one differential file; compress the first file and at least one differential file corresponding to each file type into a cache folder.

[0117] In some embodiments of the present invention, optionally, the processing unit 302 is specifically used to: obtain a cache folder corresponding to the N+1th level page corresponding to the first page; decompress the cache folder to obtain a first file and at least one differential file; and merge the first file and at least one differential file respectively to obtain multiple cache files.

[0118] In one embodiment of the present invention, an electronic device is also provided. Figure 4 As shown, Figure 4 FIG. 4 is a block diagram of an electronic device 400 provided in an embodiment of the present invention. The electronic device 400 includes:

[0119] Memory 402, where programs or instructions are stored;

[0120] Processor 404, when executing the above program or instruction, implements the steps of the cache management method in any of the above embodiments.

[0121] The electronic device 400 provided in this embodiment includes a memory 402 and a processor 404. When the program or instructions in the memory 402 are executed by the processor 404, the steps of the cache management method in any of the above embodiments are implemented. Therefore, the electronic device 400 has all the beneficial effects of the cache management method in any of the above embodiments, which will not be repeated here.

[0122] Specifically, the memory 402 and the processor 404 may be connected via a bus or other means. The processor 404 may include one or more processing units, and the processor 404 may be a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), and other chips.

[0123] In one embodiment of the present invention, a readable storage medium is also provided, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the cache management method in any of the above embodiments are implemented.

[0124] The readable storage medium provided by the embodiment of the present invention can implement the steps of the cache management method in any of the above embodiments when the program or instruction stored therein is executed by the processor. Therefore, the readable storage medium has all the beneficial effects of the cache management method in any of the above embodiments, which will not be described in detail here.

[0125] Specifically, the above-mentioned readable storage medium may include any medium capable of storing or transmitting information. Examples of readable storage media include electronic circuits, semiconductor memory devices, read-only memory (ROM), random access memory (RAM), compact disc read-only memory (CD-ROM), flash memory, erasable ROM (EROM), magnetic tape, floppy disk, optical disk, hard disk, optical fiber medium, radio frequency (RF) link, optical data storage device, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0126] In one embodiment of the present invention, a computer program product is also proposed, including a computer program, which, when executed by a processor, implements the steps of the cache management method in any of the above embodiments. Therefore, the computer program product proposed by the present invention has all the beneficial effects of the cache management method in any of the above embodiments, which will not be described in detail here.

[0127] In actual application, the above-mentioned computer program products include but are not limited to: desktop computers, laptops, tablet computers, mobile phones, smart watches, smart home appliances, host computers and server platforms, etc., and no specific restrictions are made here.

[0128] In the description of this specification, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance unless otherwise clearly specified and limited; the terms "connection", "installation", "fixation" and the like should be understood in a broad sense, for example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0129] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "specific embodiments", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0130] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0131] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A cache management method, characterized in that: include: Grading multiple pages in an application; Determine a cache file corresponding to each page, when the page is not opened, the cache file corresponding to the page is in a compressed state; When a first page of the Nth level is opened, decompressing a plurality of cache files corresponding to a page of the N+1th level corresponding to the first page; Wherein, N is a positive integer, and the (N+1)th level page corresponding to the first page is a subpage of the first page.

2. The cache management method according to claim 1, characterized in that: The cache management method further includes: In the case of returning from the first page to the N-1th level page corresponding to the first page, compressing a plurality of cache files corresponding to the N+1th level page corresponding to the first page; Wherein, N is a positive integer greater than 1.

3. The cache management method according to claim 1, characterized in that: The cache management method further includes: Obtaining a time period during which the user uses the application; An application cache of the application program is managed according to the usage time period.

4. The cache management method according to claim 3, characterized in that: The managing the application cache of the application according to the usage time period includes: During the usage time period, it is prohibited to perform compression tasks on cache files corresponding to the application; Outside the usage time period, when the application is in a closed state, a compression task for the cache file corresponding to the application is started.

5. The cache management method according to claim 1, characterized in that: The cache management method further includes: Sending a heartbeat signal to the application to start a background program of the application; Checking the completion status of the decompression task and / or compression task corresponding to the application program through the background program; The decompression task and / or the compression task in an interrupted state is executed by the background program.

6. The cache management method according to claim 1, characterized in that: The cache management method further includes: Determine a second page in the application program whose usage frequency is less than a preset threshold; Delete the cache file corresponding to the second page.

7. The cache management method according to claim 6, characterized in that: The determining of the second page in the application program whose usage frequency is less than a preset threshold comprises: Determine, according to the level of each page in the application, a second page in the application whose usage frequency is less than a preset threshold; and / or According to the frequency of each page in the application being used by the user, a second page in the application whose use frequency is less than a preset threshold is determined.

8. The cache management method according to any one of claims 2 to 7, characterized in that: The compressing the multiple cache files corresponding to the N+1th level page corresponding to the first page includes: Get the file type of each cached file; Based on the first file in each file type, performing differential processing on at least one second file in each file type to obtain at least one differential file; The first file and the at least one differential file corresponding to each file type are compressed into a cache folder.

9. The cache management method according to claim 8, characterized in that: The decompressing the plurality of cache files corresponding to the N+1th level page corresponding to the first page includes: Obtain the cache folder corresponding to the N+1th level page corresponding to the first page; Decompressing the cache folder to obtain a first file and at least one differential file; The first file and the at least one differential file are merged respectively to obtain a plurality of cache files.

10. A cache management device, characterized in that: include: A processing unit for grading multiple pages in an application; The processing unit is further used to determine the cache file corresponding to each page, and when the page is not opened, the cache file corresponding to the page is in a compressed state; The processing unit is further configured to decompress a plurality of cache files corresponding to a page of the N+1th level corresponding to the first page of the Nth level when the first page of the Nth level is opened; Wherein, N is a positive integer, and the (N+1)th level page corresponding to the first page is a subpage of the first page.

11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the cache management method according to any one of claims 1 to 9 are implemented.

12. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the cache management method according to any one of claims 1 to 9 are implemented.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the cache management method according to any one of claims 1 to 9 are implemented.