CN107291632B - Method and device for clearing cache data and terminal equipment - Google Patents

Method and device for clearing cache data and terminal equipment Download PDF

Info

Publication number
CN107291632B
CN107291632B CN201710419678.7A CN201710419678A CN107291632B CN 107291632 B CN107291632 B CN 107291632B CN 201710419678 A CN201710419678 A CN 201710419678A CN 107291632 B CN107291632 B CN 107291632B
Authority
CN
China
Prior art keywords
cleaning
operating system
cache data
terminal equipment
target program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710419678.7A
Other languages
Chinese (zh)
Other versions
CN107291632A (en
Inventor
张博慧
王冠翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Internet Security Software Co Ltd
Original Assignee
Beijing Kingsoft Internet Security Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Internet Security Software Co Ltd filed Critical Beijing Kingsoft Internet Security Software Co Ltd
Priority to CN201710419678.7A priority Critical patent/CN107291632B/en
Publication of CN107291632A publication Critical patent/CN107291632A/en
Application granted granted Critical
Publication of CN107291632B publication Critical patent/CN107291632B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0891Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches using clearing, invalidating or resetting means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The invention discloses a method and a device for clearing cache data and terminal equipment. The method comprises the following steps: when a cleaning request input by a user for cache data in the terminal equipment is received, judging whether the system auxiliary authority of an operating system of the terminal equipment is possessed at present; if the system auxiliary authority of the operating system of the terminal equipment is possessed currently, the cleaning function of the target program is closed, and the operating system is controlled to carry out first cleaning operation on the cached data in the terminal equipment according to the system auxiliary authority; when a cleaning return value fed back by the operating system for the first cleaning operation is received, judging whether the operating system successfully completes the first cleaning operation according to the cleaning return value; if not, starting a cleaning function of the target program, and performing second cleaning operation on the cache data through the cleaning function of the target program. The embodiment of the invention adds a module for receiving the return value of the system cleaning result of the operating system, and the judgment on whether the system cleaning is successfully completed is more effective.

Description

Method and device for clearing cache data and terminal equipment
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method and an apparatus for clearing cache data, and a terminal device.
Background
With the continuous development of intelligent technologies, more and more terminal devices (e.g., smart phones, tablet computers, notebook computers, desktop computers, all-in-one machines, etc.) enter the daily work and life of people. The user can perform information interaction with other users through the chat application program in the terminal equipment, and also can acquire some information such as characters, videos or pictures and the like from the network through the search application program in the terminal equipment. During the process of using various applications of the terminal device by the user, data information that may be generated when the various applications are used is stored in the terminal device, and these data stored locally in the terminal device are called cache data (e.g., picture data, web browsing data, etc.). As the application program is used continuously, a large amount of cache data will be generated in the terminal device, and the storage space of the terminal device is relatively limited, so that the cache data stored on the terminal device needs to be cleaned regularly.
In the related art, a cleaning application is generally used to clean the cached data in the terminal device. However, currently, when the cleaning application cleans the cache, a cleaning failure may occur. However, the existing cleaning application programs generally only adopt an excessive animation and result guidance mode for the cleaning failure situation to perceptively deliver the cleaned information to the user, but actually, if the user checks the garbage amount of the terminal device and finds that no change or the change is not ideal, the user may be distrusted, and the stickiness between the user and the product is reduced.
Disclosure of Invention
The object of the present invention is to solve at least to some extent one of the above mentioned technical problems.
To this end, an object of the present invention is to provide a method for cleaning cache data. The method adds a module for receiving a system cleaning result return value of the operating system, so that the judgment on whether the system cleaning is successfully completed is more effective, and when the system cleaning is determined to be unsuccessfully completed, the target program is immediately started to clean, so that the secondary cleaning of the undeleted cache is realized, and the problem of the cleaning failure of the cleaning application program in the prior art is optimized.
The second purpose of the invention is to provide a device for cleaning the cache data.
A third object of the present invention is to provide a terminal device.
A fourth object of the invention is to propose a non-transitory computer-readable storage medium.
A fifth object of the invention is to propose a computer program product.
To achieve the above object, an embodiment of the present invention provides a method for clearing cache data, including: when a cleaning request input by a user for cache data in terminal equipment is received, judging whether the system auxiliary authority of an operating system of the terminal equipment is possessed currently; if the system auxiliary authority of the operating system of the terminal equipment is possessed currently, the cleaning function of the target program is closed, and the operating system is controlled to carry out first cleaning operation on the cached data in the terminal equipment according to the system auxiliary authority; when a cleaning return value fed back by the operating system for the first cleaning operation is received, judging whether the operating system successfully completes the first cleaning operation according to the cleaning return value; and if not, starting a cleaning function of the target program, and performing second cleaning operation on the cache data through the cleaning function of the target program.
According to the method for clearing the cache data, when a clearing request input by a user for the cache data in the terminal equipment is received, whether the system auxiliary authority of an operating system of the terminal equipment is possessed or not is judged, if yes, a clearing function of a target program is closed, the operating system is controlled to carry out first clearing operation on the cache data in the terminal equipment according to the system auxiliary authority, and when a clearing return value fed back by the operating system for the first clearing operation is received, whether the operating system successfully completes the first clearing operation or not is judged according to the clearing return value, if not, the clearing function of the target program is opened, and second clearing operation is carried out on the cache data through the clearing function of the target program. The embodiment of the invention adds a module for receiving the return value of the system cleaning result of the operating system, so that the judgment on whether the system cleaning is successfully completed is more effective, and when the system cleaning is determined to be unsuccessfully completed, the target program is immediately started to clean, so that the purpose of secondarily cleaning the undeleted cache is realized, the problem of cleaning failure of the cleaning application program in the prior art is optimized, the success rate of cache cleaning is improved, the stickiness between a user and a product is improved, and the user experience is improved.
According to an embodiment of the present invention, the controlling, according to the system auxiliary authority, the operating system to perform a first cleaning operation on the cached data in the terminal device includes: controlling the operating system to simulate the cleaning request input by the user according to the system auxiliary authority; and performing first cleaning operation on the cache data under the target path in the terminal equipment according to the cleaning request simulated by the operating system.
According to an embodiment of the present invention, when the target program has a white list, where the white list includes at least one application program, after determining that the system auxiliary right of the operating system of the terminal device is currently owned, before the cleaning function of the target program is closed, the method further includes: modifying a package name of the at least one application in the whitelist;
after receiving a cleaning return value fed back by the operating system for the first cleaning operation, the method further comprises: and restoring the modified package name of the at least one application program.
According to an embodiment of the present invention, the performing, by the scrubbing function of the target program, a second scrubbing operation on the cache data includes: scanning the packet names of the application programs which are not contained in the white list through a cleaning function of the target program; and performing second cleaning operation on the cache data in the terminal equipment according to the scanned package name of the application program.
According to an embodiment of the present invention, after the operating system successfully completes the first scrubbing operation, or after a second scrubbing operation is performed on the cached data by a scrubbing function of the target program, the method further includes: generating a corresponding cleaning result and providing the cleaning result to the user in a predetermined form.
In order to achieve the above object, an apparatus for clearing cache data according to an embodiment of the second aspect of the present invention includes: the first judgment module is used for judging whether the system auxiliary authority of an operating system of the terminal equipment is possessed currently or not when a cleaning request input by a user for cache data in the terminal equipment is received; the first control module is used for closing the cleaning function of the target program when the system auxiliary authority of the operating system of the terminal equipment is possessed currently, and controlling the operating system to carry out first cleaning operation on the cache data in the terminal equipment according to the system auxiliary authority; the second judging module is used for judging whether the operating system successfully completes the first cleaning operation according to the cleaning return value when receiving the cleaning return value fed back by the operating system for the first cleaning operation; and the second control module is used for starting the cleaning function of the target program when the operating system does not successfully finish the first cleaning operation, and performing second cleaning operation on the cache data through the cleaning function of the target program.
According to the device for clearing the cache data, whether the device has the system auxiliary authority of the operating system of the terminal equipment or not can be judged through the first judging module when a clearing request input by a user for the cache data in the terminal equipment is received, if yes, the first control module closes the clearing function of the target program and controls the operating system to carry out first clearing operation on the cache data in the terminal equipment according to the system auxiliary authority, if not, the second judging module starts the clearing function of the target program and carries out second clearing operation on the cache data through the clearing function of the target program, and if not, the second judging module judges whether the operating system successfully finishes the first clearing operation according to a clearing return value fed back by the operating system for the first clearing operation. The embodiment of the invention adds a module for receiving the return value of the system cleaning result of the operating system, so that the judgment on whether the system cleaning is successfully completed is more effective, and when the system cleaning is determined to be unsuccessfully completed, the target program is immediately started to clean, so that the purpose of secondarily cleaning the undeleted cache is realized, the problem of cleaning failure of the cleaning application program in the prior art is optimized, the success rate of cache cleaning is improved, the stickiness between a user and a product is improved, and the user experience is improved.
According to one embodiment of the invention, the first control module comprises: the simulation unit is used for controlling the operating system to simulate the cleaning request input by the user according to the system auxiliary authority; and the control unit is used for carrying out first cleaning operation on the cache data under the target path in the terminal equipment according to the cleaning request simulated by the operating system.
According to an embodiment of the present invention, when the target program has a white list, and the white list includes at least one application program, after the first determining module determines that the first determining module currently has the system auxiliary authority of the operating system of the terminal device, before the first controlling module closes the cleaning function of the target program, the apparatus further includes: a package name modification module for modifying the package name of the at least one application program in the white list;
after the second determination module receives a cleaning return value fed back by the operating system for the first cleaning operation, the apparatus further includes: and the package name restoration module is used for restoring the modified package name of the at least one application program.
According to an embodiment of the present invention, the second control module is specifically configured to: scanning the packet names of the application programs which are not contained in the white list through a cleaning function of the target program; and performing second cleaning operation on the cache data in the terminal equipment according to the scanned package name of the application program.
According to an embodiment of the present invention, after the second determining module determines that the operating system successfully completes the first cleaning operation, or after the second controlling module performs a second cleaning operation on the cached data through a cleaning function of the target program, the apparatus further includes: the generating module is used for generating a corresponding cleaning result; a providing module for providing the cleaning result to the user in a predetermined form.
To achieve the above object, a terminal device according to a third aspect of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the method for clearing cache data according to the first aspect of the present invention.
To achieve the above object, a non-transitory computer-readable storage medium according to a fourth embodiment of the present invention stores thereon a computer program, which when executed by a processor implements the method for clearing cache data according to the first embodiment of the present invention.
To achieve the above object, a computer program product according to a fifth embodiment of the present invention executes a method for clearing cache data when instructions in the computer program product are executed by a processor, the method comprising: when a cleaning request input by a user for cache data in terminal equipment is received, judging whether the system auxiliary authority of an operating system of the terminal equipment is possessed currently; if the system auxiliary authority of the operating system of the terminal equipment is possessed currently, the cleaning function of the target program is closed, and the operating system is controlled to carry out first cleaning operation on the cached data in the terminal equipment according to the system auxiliary authority; when a cleaning return value fed back by the operating system for the first cleaning operation is received, judging whether the operating system successfully completes the first cleaning operation according to the cleaning return value; and if not, starting a cleaning function of the target program, and performing second cleaning operation on the cache data through the cleaning function of the target program.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a flow diagram of a method of cleaning cached data according to one embodiment of the invention;
FIG. 2 is a flow diagram of a method of cleaning cached data in accordance with one embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an apparatus for cleaning cache data according to an embodiment of the present invention;
FIG. 4 is a block diagram of an apparatus for cleaning cache data according to an embodiment of the present invention;
FIG. 5 is a block diagram of an apparatus for cleaning cache data according to another embodiment of the present invention;
FIG. 6 is a block diagram of an apparatus for cleaning cache data according to another embodiment of the present invention;
fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
The following describes a method, an apparatus, and a terminal device for clearing cache data according to an embodiment of the present invention with reference to the drawings.
FIG. 1 is a flow diagram of a method of scrubbing cached data according to one embodiment of the invention. It should be noted that the method for clearing cache data according to the embodiment of the present invention may be applied to an apparatus for clearing cache data according to the embodiment of the present invention, and the apparatus may be configured in a terminal device (e.g., a mobile terminal, etc.). The terminal equipment can provide a target program for a user, and the user can clear the cache data of the terminal equipment through the target program. That is to say, the method for cleaning the cache data according to the embodiment of the present invention may be described on the object program side.
As shown in fig. 1, the method for cleaning the cache data may include:
s110, when a cleaning request input by a user for the cached data in the terminal equipment is received, judging whether the system auxiliary authority of the operating system of the terminal equipment is possessed currently.
For example, it is assumed that the method for cleaning cached data according to the embodiment of the present invention is applicable to a terminal device, and the terminal device provides a target program with a cleaning function for a user, and the user can clean the cached data in the terminal device through the target program. The target program may provide a cleaning button for a user, receive a cleaning request input by the user for the cached data in the terminal device when it is detected that the user clicks the cleaning button, then determine whether the terminal device currently has a system auxiliary permission of the operating system, if so, determine that the current environment meets the system cleaning condition, and may execute step S120. It can be understood that, in the embodiment of the present invention, if the terminal device does not currently possess the system auxiliary permission of the operating system, it is considered that the system cleaning interface cannot be called to clean the cache data currently, and at this time, the cache data can be cleaned through the cleaning function of the target program itself.
And S120, if the system auxiliary authority of the operating system of the terminal equipment is possessed currently, closing the cleaning function of the target program, and controlling the operating system to carry out first cleaning operation on the cache data in the terminal equipment according to the system auxiliary authority.
Specifically, in an embodiment of the present invention, when the system auxiliary authority of the operating system of the terminal device is currently owned, the cleaning function of the target program itself may be closed, and then, the operating system may be controlled to simulate a cleaning request input by a user according to the system auxiliary authority, and a first cleaning operation may be performed on the cache data in the target path in the terminal device according to the cleaning request simulated by the operating system.
More specifically, when the cache cleaning is implemented through a system cleaning interface of the operating system, the operating system may be controlled to perform simulated clicking, that is, an operation of a user clicking a cleaning button provided by the target program is simulated to simulate a cleaning request input by the user, when the simulated cleaning request is received, an application package name in the terminal device may be scanned, a target path in the terminal device, in which cache data is stored, may be found, and cache data corresponding to the application program may be deleted from the target path according to the application package name. For example, taking an operating system as an Android system as an example, the target path may include an Android/Data/appname/cache path and a Data/appname/cache path.
S130, when a cleaning return value fed back by the operating system for the first cleaning operation is received, whether the operating system successfully completes the first cleaning operation is judged according to the cleaning return value.
Specifically, after the system cleaning operation is finished, the operating system may detect whether the system cleaning is successfully completed by feeding back a return value.
And S140, if not, starting a cleaning function of the target program, and performing a second cleaning operation on the cache data through the cleaning function of the target program.
Specifically, when it is determined that the operating system has not successfully completed the first cleaning operation (i.e., the system cleaning has not successfully completed) according to the cleaning return value, the target program may be immediately started, the application package name in the terminal device is scanned through the cleaning function of the target program, the target path in the terminal device, in which the cache data is stored, is found, and the cache data corresponding to the application program is deleted from the target path according to the application package name. For example, taking an operating system as an Android system as an example, the target path may include an Android/Data/appname/cache path and a Data/appname/cache path.
According to the method for clearing the cache data, when a clearing request input by a user for the cache data in the terminal equipment is received, whether the system auxiliary authority of an operating system of the terminal equipment is possessed or not is judged, if yes, a clearing function of a target program is closed, the operating system is controlled to carry out first clearing operation on the cache data in the terminal equipment according to the system auxiliary authority, and when a clearing return value fed back by the operating system for the first clearing operation is received, whether the operating system successfully completes the first clearing operation or not is judged according to the clearing return value, if not, the clearing function of the target program is opened, and second clearing operation is carried out on the cache data through the clearing function of the target program. The embodiment of the invention adds a module for receiving the return value of the system cleaning result of the operating system, so that the judgment on whether the system cleaning is successfully completed is more effective, and when the system cleaning is determined to be unsuccessfully completed, the target program is immediately started to clean, so that the purpose of secondarily cleaning the undeleted cache is realized, the problem of cleaning failure of the cleaning application program in the prior art is optimized, the success rate of cache cleaning is improved, the stickiness between a user and a product is improved, and the user experience is improved.
FIG. 2 is a flow chart of a method of cleaning cached data according to an embodiment of the present invention.
In order to improve the usability and feasibility of the invention and meet the product personalization requirement, in the embodiment of the invention, a white list may be set in the target program, and the white list may include at least one application program, so that by setting the white list, when the cached data in the terminal device is cleaned, the cached data generated by the application program in the white list may not be cleaned. Specifically, as shown in fig. 2, the method for clearing cache data may include:
s210, when a cleaning request input by a user for the cached data in the terminal equipment is received, judging whether the system auxiliary authority of the operating system of the terminal equipment is possessed currently.
S220, if the system auxiliary authority of the operating system of the terminal equipment is possessed currently, the package name of at least one application program in the white list is modified.
Specifically, when the system auxiliary right of the operating system of the terminal device is currently owned, the packet name of at least one application program in the white list may be modified first, so as to avoid that the system cleaning interface cleans the cache data generated by the application program in the white list.
And S230, closing the cleaning function of the target program, and controlling the operating system to perform a first cleaning operation on the cache data in the terminal equipment according to the system auxiliary authority.
Specifically, in an embodiment of the present invention, the cleaning function of the target program itself may be closed, and then, the operating system may be controlled to simulate the cleaning request input by the user according to the system auxiliary authority, and the first cleaning operation may be performed on the cache data in the target path in the terminal device according to the cleaning request simulated by the operating system.
More specifically, when the cache cleaning is implemented through a system cleaning interface of the operating system, the operating system may be controlled to perform simulated clicking, that is, an operation of a user clicking a cleaning button provided by the target program is simulated to simulate a cleaning request input by the user, when the simulated cleaning request is received, an application package name in the terminal device may be scanned, a target path in the terminal device, in which cache data is stored, may be found, and cache data corresponding to the application program may be deleted from the target path according to the application package name. Because the package name of the application program in the white list is modified, the cache data generated by the application program with the modified package name stored in the target path is not cleaned by the system, so that the personalized requirement of the product is met.
S240, when a cleaning return value fed back by the operating system for the first cleaning operation is received, judging whether the operating system successfully completes the first cleaning operation according to the cleaning return value.
Specifically, after the system cleaning operation is finished, the operating system may detect whether the system cleaning is successfully completed by feeding back a return value.
Further, after receiving a cleaning return value fed back by the operating system for the first cleaning operation, regardless of whether the operating system successfully completes the cleaning operation, the modified packet name of the at least one application program needs to be restored, that is, the packet name of the at least one application program in the white list needs to be restored, so as to ensure that the packet name of the application program in the white list is in an original state.
And S250, if not, starting a cleaning function of the target program, and performing a second cleaning operation on the cache data through the cleaning function of the target program.
Specifically, when it is determined that the operating system has not successfully completed the first cleaning operation (i.e., the system cleaning has not successfully completed) according to the cleaning return value, the target program may be immediately started, and the packet name of the application program that is not included in the white list may be scanned by the cleaning function of the target program, and then, the second cleaning operation may be performed on the cache data in the terminal device according to the scanned packet name of the application program. Therefore, the cache data generated by the application program in the white list can be filtered out through the setting of the white list, namely the cache data generated by the application program in the white list is not cleaned.
In order to improve the usability and feasibility of the present invention, optionally, in an embodiment of the present invention, in the process of controlling the operating system to simulate the cleaning request input by the user according to the system auxiliary authority, if the cleaning request input by the user is not simulated successfully by the operating system, the cleaning function of the target program is started, and the modified packet name of at least one application program is restored, and then the packet name of the application program not included in the white list is scanned by the cleaning function of the target program, and finally, the second cleaning operation may be performed on the cached data in the terminal device according to the scanned packet name of the application program.
To improve the user experience, further, in an embodiment of the present invention, after the operating system successfully completes the first cleaning operation, or after the second cleaning operation is performed on the cached data by the cleaning function of the target program, the method for cleaning the cached data may further include: and generating a corresponding cleaning result, and providing the cleaning result to the user in a preset form. In the embodiment of the present invention, the predetermined format may be an animation format, a digital format, a voice broadcast format, or the like.
According to the method for clearing the cache data, the white list can be arranged in the target program, and the white list can contain at least one application program, so that the cache data generated by the application program in the white list can not be cleared when the cache data in the terminal equipment is cleared by arranging the white list, the personalized requirements of products are met, and the usability and the feasibility of the method are improved.
Corresponding to the methods for clearing cache data provided in the foregoing embodiments, an embodiment of the present invention further provides a device for clearing cache data, and since the device for clearing cache data provided in the embodiment of the present invention corresponds to the methods for clearing cache data provided in the foregoing embodiments, the implementation manner of the method for clearing cache data is also applicable to the device for clearing cache data provided in this embodiment, and is not described in detail in this embodiment. Fig. 3 is a schematic structural diagram of an apparatus for cleaning cached data according to an embodiment of the present invention. As shown in fig. 3, the apparatus for cleaning the cache data may include: a first determination module 310, a first control module 320, a second determination module 330, and a second control module 340.
Specifically, the first determining module 310 is configured to determine whether the system auxiliary permission of the operating system of the terminal device is currently owned when a cleaning request input by a user for cached data in the terminal device is received.
The first control module 320 is configured to, when the system auxiliary authority of the operating system of the terminal device is currently owned, close the cleaning function of the target program, and control the operating system to perform a first cleaning operation on the cached data in the terminal device according to the system auxiliary authority. As an example, as shown in fig. 4, the first control module 320 may include: an analog unit 321 and a control unit 322. The simulation unit 321 is configured to control the operating system to simulate a cleaning request input by a user according to the system auxiliary authority. The control unit 322 is configured to perform a first cleaning operation on the cache data in the target path in the terminal device according to the cleaning request simulated by the operating system.
The second determining module 330 is configured to, when receiving a cleaning return value fed back by the operating system for the first cleaning operation, determine whether the operating system successfully completes the first cleaning operation according to the cleaning return value.
The second control module 340 is configured to, when the operating system does not successfully complete the first cleaning operation, start a cleaning function of the target program, and perform a second cleaning operation on the cached data through the cleaning function of the target program.
In order to improve the usability and feasibility of the invention and meet the product personalization requirement, in the embodiment of the invention, a white list may be set in the target program, and the white list may include at least one application program, so that by setting the white list, when the cached data in the terminal device is cleaned, the cached data generated by the application program in the white list may not be cleaned. As an example, when the target program has a white list containing at least one application program, as shown in fig. 5, the apparatus for cleaning the cache data may further include: a package name modification module 350 and a package name restoration module 360. The package name modifying module 350 may be configured to modify the package name of at least one application program in the white list before the first controlling module 320 closes the cleaning function of the target program after the first determining module 310 determines that the system auxiliary permission of the operating system of the terminal device currently owns. The package name restoring module 360 restores the modified package name of the at least one application program after the second determining module 330 receives the cleaning return value fed back by the operating system for the first cleaning operation.
In this example, the specific implementation process of the second control module 340 performing the second cleaning operation on the cache data through the cleaning function of the target program may be as follows: and scanning the packet names of the application programs which are not contained in the white list through the cleaning function of the target program, and then performing second cleaning operation on the cache data in the terminal equipment according to the scanned packet names of the application programs.
To enhance the user experience, in an embodiment of the present invention, as shown in fig. 6, the apparatus for clearing cache data may further include: a generation module 370 and a provision module 380. The generating module 370 is configured to generate a corresponding cleaning result after the second determining module 330 determines that the operating system successfully completes the first cleaning operation, or after the second controlling module 340 performs the second cleaning operation on the cached data through the cleaning function of the target program. The providing module 380 may be used to provide the cleaning results to the user in a predetermined form.
According to the device for clearing the cache data, whether the device has the system auxiliary authority of the operating system of the terminal equipment or not can be judged through the first judging module when a clearing request input by a user for the cache data in the terminal equipment is received, if yes, the first control module closes the clearing function of the target program and controls the operating system to carry out first clearing operation on the cache data in the terminal equipment according to the system auxiliary authority, if not, the second judging module starts the clearing function of the target program and carries out second clearing operation on the cache data through the clearing function of the target program, and if not, the second judging module judges whether the operating system successfully finishes the first clearing operation according to a clearing return value fed back by the operating system for the first clearing operation. The embodiment of the invention adds a module for receiving the return value of the system cleaning result of the operating system, so that the judgment on whether the system cleaning is successfully completed is more effective, and when the system cleaning is determined to be unsuccessfully completed, the target program is immediately started to clean, so that the purpose of secondarily cleaning the undeleted cache is realized, the problem of cleaning failure of the cleaning application program in the prior art is optimized, the success rate of cache cleaning is improved, the stickiness between a user and a product is improved, and the user experience is improved.
In order to implement the above embodiments, the present invention further provides a terminal device.
Fig. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present invention. As shown in fig. 7, the terminal device 70 may include: the memory 71, the processor 72, and the computer program 73 stored in the memory 71 and operable on the processor 72, when the processor 72 executes the program 73, the method for clearing the cache data according to any of the above embodiments of the present invention is implemented.
In order to implement the above embodiments, the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the method for clearing cache data according to any of the above embodiments of the present invention.
To achieve the above embodiments, the present invention further provides a computer program product, wherein when instructions in the computer program product are executed by a processor, the computer program product performs a method for cleaning cache data, and the method comprises:
s110', when a cleaning request input by a user for the cached data in the terminal equipment is received, whether the system auxiliary authority of the operating system of the terminal equipment is possessed or not is judged.
S120', if the system auxiliary authority of the operating system of the terminal equipment is possessed currently, the cleaning function of the target program is closed, and the operating system is controlled to carry out first cleaning operation on the cache data in the terminal equipment according to the system auxiliary authority.
S130', when a cleaning return value fed back by the operating system for the first cleaning operation is received, whether the operating system successfully completes the first cleaning operation is judged according to the cleaning return value.
S140', if not, starting a cleaning function of the target program, and performing a second cleaning operation on the cache data through the cleaning function of the target program.
In the description of the present invention, it is to be understood that the terms "first", "second" and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (10)

1. A method for cleaning cache data is characterized by comprising the following steps:
when a cleaning request input by a user for cache data in terminal equipment is received, judging whether the system auxiliary authority of an operating system of the terminal equipment is possessed currently;
if the system auxiliary authority of the operating system of the terminal equipment is possessed currently, the cleaning function of the target program is closed, and the operating system is controlled to carry out first cleaning operation on the cached data in the terminal equipment according to the system auxiliary authority;
when a cleaning return value fed back by the operating system for the first cleaning operation is received, judging whether the operating system successfully completes the first cleaning operation according to the cleaning return value;
if not, starting a cleaning function of the target program, and performing a second cleaning operation on the cache data through the cleaning function of the target program;
when the target program has a white list, and the white list includes at least one application program, after determining that the system auxiliary authority of the operating system of the terminal device is currently owned, before closing the cleaning function of the target program, the method further includes:
modifying a package name of the at least one application in the whitelist;
after receiving a cleaning return value fed back by the operating system for the first cleaning operation, the method further comprises:
and restoring the modified package name of the at least one application program.
2. The method of claim 1, wherein the controlling the operating system to perform a first cleaning operation on the cached data in the terminal device according to the system auxiliary authority comprises:
controlling the operating system to simulate the cleaning request input by the user according to the system auxiliary authority;
and performing first cleaning operation on the cache data under the target path in the terminal equipment according to the cleaning request simulated by the operating system.
3. The method of claim 1, wherein performing a second scrubbing operation on the cached data by a scrubbing function of the target program comprises:
scanning the packet names of the application programs which are not contained in the white list through a cleaning function of the target program;
and performing second cleaning operation on the cache data in the terminal equipment according to the scanned package name of the application program.
4. The method of claim 1, wherein after the operating system successfully completes the first scrubbing operation or after performing a second scrubbing operation on the cached data by a scrubbing function of the target program, the method further comprises:
generating a corresponding cleaning result and providing the cleaning result to the user in a predetermined form.
5. An apparatus for cleaning cache data, comprising:
the first judgment module is used for judging whether the system auxiliary authority of an operating system of the terminal equipment is possessed currently or not when a cleaning request input by a user for cache data in the terminal equipment is received;
the first control module is used for closing the cleaning function of the target program when the system auxiliary authority of the operating system of the terminal equipment is possessed currently, and controlling the operating system to carry out first cleaning operation on the cache data in the terminal equipment according to the system auxiliary authority;
the second judging module is used for judging whether the operating system successfully completes the first cleaning operation according to the cleaning return value when receiving the cleaning return value fed back by the operating system for the first cleaning operation;
the second control module is used for starting the cleaning function of the target program when the operating system does not successfully finish the first cleaning operation, and performing second cleaning operation on the cache data through the cleaning function of the target program;
when the target program has a white list, where the white list includes at least one application program, after the first determining module determines that the system auxiliary right of the operating system of the terminal device is currently owned, and before the first controlling module closes the cleaning function of the target program, the apparatus further includes:
a package name modification module for modifying the package name of the at least one application program in the white list;
after the second determination module receives a cleaning return value fed back by the operating system for the first cleaning operation, the apparatus further includes:
and the package name restoration module is used for restoring the modified package name of the at least one application program.
6. The apparatus of claim 5, wherein the first control module comprises:
the simulation unit is used for controlling the operating system to simulate the cleaning request input by the user according to the system auxiliary authority;
and the control unit is used for carrying out first cleaning operation on the cache data under the target path in the terminal equipment according to the cleaning request simulated by the operating system.
7. The apparatus of claim 5, wherein the second control module is specifically configured to:
scanning the packet names of the application programs which are not contained in the white list through a cleaning function of the target program;
and performing second cleaning operation on the cache data in the terminal equipment according to the scanned package name of the application program.
8. The apparatus of claim 5, wherein after the second determining module determines that the operating system successfully completes the first scrubbing operation, or after the second controlling module performs a second scrubbing operation on the cached data through a scrubbing function of the target program, the apparatus further comprises:
the generating module is used for generating a corresponding cleaning result;
a providing module for providing the cleaning result to the user in a predetermined form.
9. A terminal device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the program, implements a method of cleaning cached data as claimed in any one of claims 1 to 4.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements a method of cleaning cached data as recited in any one of claims 1 to 4.
CN201710419678.7A 2017-06-06 2017-06-06 Method and device for clearing cache data and terminal equipment Active CN107291632B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710419678.7A CN107291632B (en) 2017-06-06 2017-06-06 Method and device for clearing cache data and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710419678.7A CN107291632B (en) 2017-06-06 2017-06-06 Method and device for clearing cache data and terminal equipment

Publications (2)

Publication Number Publication Date
CN107291632A CN107291632A (en) 2017-10-24
CN107291632B true CN107291632B (en) 2020-03-27

Family

ID=60094831

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710419678.7A Active CN107291632B (en) 2017-06-06 2017-06-06 Method and device for clearing cache data and terminal equipment

Country Status (1)

Country Link
CN (1) CN107291632B (en)

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530235B (en) * 2013-10-18 2017-04-12 北京奇虎科技有限公司 Method and device for clearing internal storage in mobile terminal
CN104754002B (en) * 2013-12-30 2019-03-26 北京猎豹网络科技有限公司 Clear up method, apparatus, mobile terminal and the cloud server of file
CN104391743B (en) * 2014-11-26 2018-01-12 北京奇虎科技有限公司 Optimize the method and apparatus of the speed of service of mobile terminal
CN104461922A (en) * 2014-12-29 2015-03-25 北京奇虎科技有限公司 System optimization method and device
CN105260319A (en) * 2015-09-11 2016-01-20 上海卓易科技股份有限公司 Cleaning method and cleaning system for mobile terminal
CN105893278A (en) * 2016-03-30 2016-08-24 北京金山安全软件有限公司 System cache garbage cleaning method and device and terminal equipment
CN106372003B (en) * 2016-09-08 2020-01-10 Oppo广东移动通信有限公司 Cache data cleaning method and device and terminal
CN106777286A (en) * 2016-12-29 2017-05-31 北京猎豹移动科技有限公司 A kind of method for cleaning and electronic equipment

Also Published As

Publication number Publication date
CN107291632A (en) 2017-10-24

Similar Documents

Publication Publication Date Title
CN110162371B (en) Display control method and device, electronic equipment and storage medium
EP3567476B1 (en) Application data processing method and apparatus, and storage medium
CN105786473A (en) Task management method and device of multi-task interface as well as terminal equipment
CN104252284A (en) File display method and device
CN111984130B (en) Shortcut operation method and device and electronic equipment
US20090222499A1 (en) Method, apparatus and storage device for data protection
CN104380769A (en) Information reminding method, apparatus, and electronic terminal
CN105630628A (en) Application restoration method and apparatus
CN107577471B (en) Application control method and mobile terminal
CN107665147A (en) The cleaned system method and mobile device of a kind of mobile device
CN105893471B (en) Data processing method and electronic equipment
CN111767012A (en) Screen projection method and device
CN108153454B (en) Multi-touch switching method and device, storage medium and terminal equipment
CN106879263A (en) A kind of image pickup method and mobile device
CN112214376A (en) Storage space prompting method and device
CN105739826A (en) Method and equipment for rapidly uninstalling multiple application programs
CN111142900A (en) Program updating method and device and terminal equipment
CN105653304A (en) Method for switching operation mode, device for switching operation mode, and terminal
CN107291632B (en) Method and device for clearing cache data and terminal equipment
CN113721936B (en) Application management method, intelligent terminal, device and storage medium
CN108011860A (en) A kind of method and device for handling broadcast message
CN107766057B (en) Unloading control method, device, terminal and readable storage medium
CN111666023B (en) Interface display method and device, electronic equipment and readable storage medium
CN112306373B (en) Cluster capacity expansion method and system, electronic equipment and storage medium
CN111913918A (en) File storage method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant