CN106657274A - Method and device for processing application files - Google Patents
Method and device for processing application files Download PDFInfo
- Publication number
- CN106657274A CN106657274A CN201611024700.XA CN201611024700A CN106657274A CN 106657274 A CN106657274 A CN 106657274A CN 201611024700 A CN201611024700 A CN 201611024700A CN 106657274 A CN106657274 A CN 106657274A
- Authority
- CN
- China
- Prior art keywords
- file
- terminal
- application
- application file
- order
- 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.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
- H04L67/5682—Policies or rules for updating, deleting or replacing the stored data
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/565—Conversion or adaptation of application format or content
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a method and device for processing application files. The method includes that a terminal receives an application file processing command sent by an application server; the terminal analyzes the application file processing command and obtains a mark of a to-be-processed file and the type of processing operation; the terminal performs processing operation on the to-be-processed file according to the type of processing operation. The method and device can clear invalid application files effectively and reduces occupancy of terminal cache by invalid application files.
Description
Technical field
The present invention relates to field of computer technology, and in particular to a kind of method and device processed application file.
Background technology
Mobile terminal application program (or be referred to as:Using, software) in use, in order to improve efficiency, often
Using caching technology.With being on the increase for application program, also can be more and more using the quantity of documents of caching, thus can lead
Cause to apply volume more and more huger, cause to take system space resource in a large number.
Meanwhile, in the case where the configuration file of application malfunctions, it is possible to which can cause to apply normally to use.For example,
The reference address A of webpage has been cached before, but web page access address change is B during the application upgrade in later stage, now
The configuration file of caching is not effectively cleaned out, with regard to be likely to result in the page cannot normal load problem.
The content of the invention
In view of the above problems, it is proposed that the present invention so as to provide one kind overcome the problems referred to above or at least in part solve on
State the method and device of the cleaning using inactive file of problem.
A kind of one side according to embodiments of the present invention, there is provided method that application file is processed, including:Terminal
Receive the application file process order that application server sends;The terminal parses the application file and processes order, knows and treats
Process file identification and process action type;The terminal performs the process to pending file according to action type is processed
Operation.
Preferably, also include:Terminal periodically sends heartbeat packet, the heartbeat packet carried terminal IP ground to application server
Location, terminal device information;Application server receives the heartbeat packet, it is determined that keep communicating with terminal, so as to send out to terminal
The application file is sent to process order.
Preferably, the terminal receives the application file process order that application server sends, including:The terminal is received
The application file based on http protocol JSON forms that application server sends processes order;The terminal parses the practical writing
Part process order, including:The terminal parses the application file and processes order by FASTJSON modes.
Preferably, also include:In terminal local, application file cleaning timer is set;The terminal is clear according to application file
The application file of local cache is read in reason timer, timing, and judges that the memory space shared by the application file of the caching is big
It is little whether to be more than preset memory space cleaning threshold, if so, delete the application file of the caching.
Preferably, the application file of caching is read in the timing, including:The file provided using the JDK of Java is read
API, by the timing of File classes the application file of local cache is read.
According to another embodiment of the invention, there is provided a kind of device that application file is processed, including:Process life
Receiving unit is made, the application file for receiving application server transmission processes order;Command resolution unit is processed, for parsing
The application file processes order, knows pending file identification and processes action type;Operation execution unit is processed, is used for
According to action type is processed, perform the process to pending file and operate.
Preferably, also include:Heartbeat packet transmitting element, for periodically to application server transmission heartbeat packet, the heartbeat
Bag carried terminal IP address, terminal device information.
Preferably, it is described process order receiving unit specifically for:The terminal receive that application server sends based on
The application file of http protocol JSON forms processes order;It is described process command resolution unit specifically for:By FASTJSON
Mode parses the application file and processes order.
Preferably, also include:Local timing cleaning unit, for arranging application file cleaning timer in terminal local,
And, timer is cleared up according to application file, the application file of local cache is read in timing, and judges the practical writing of the caching
Whether the storage size shared by part is more than preset memory space cleaning threshold, if so, deletes the practical writing of the caching
Part.
Preferably, the local timing cleaning unit specifically for:The file provided using the JDK of Java reads API, leads to
Cross the application file that local cache is read in the timing of File classes.
It can be seen that, the application file processing method provided by the present invention is issued application file and processes order by server
Mode, realize rubbish dynamic cleaning purpose, for example, be updated for the configuration file of application program or escalation process
In, it is slow to terminal so as to reduce these inactive files for the scratch file for being related to version or upgrading carries out issuing delete command
The occupancy in space is deposited, mitigates the expense taken to disk, it is also possible to effectively avoided because the later stage causes system the problems such as upgrading
Loss of configuration is so as to causing the disabled problem of software.
Except above by server issue application file process order mode it is (particularly invalid to terminal inactive file
Configuration file) outside the mode that processed, may also be combined with terminal local to inactive file (particularly invalid operating file)
Manner of cleaning up, so as to can further effective control software itself disk take.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention,
And can be practiced according to the content of specification, and in order to allow the above and other objects of the present invention, feature and advantage can
Become apparent, below especially exemplified by the specific embodiment of the present invention.
Description of the drawings
By the detailed description for reading hereafter preferred embodiment, various other advantages and benefit is common for this area
Technical staff will be clear from understanding.Accompanying drawing is only used for illustrating the purpose of preferred embodiment, and is not considered as to the present invention
Restriction.And in whole accompanying drawing, it is denoted by the same reference numerals identical part.In the accompanying drawings:
Fig. 1 shows method flow diagram of the cleaning of the invention using inactive file;
Fig. 2 is shown in the method cleared up using inactive file according to an embodiment of the invention according to local timer
Delete the flow chart of cache file;
Fig. 3 shows apparatus structure schematic diagram of the cleaning of the invention using inactive file.
Specific embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing the disclosure in accompanying drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure and should not be by embodiments set forth here
Limited.On the contrary, there is provided these embodiments are able to be best understood from the disclosure, and can be by the scope of the present disclosure
Complete conveys to those skilled in the art.
As previously described, for the situation that application file is expired or invalid, if also still caching these application files, meeting
The waste to terminal storage space is caused, terminal response speed can be also affected when serious.In this regard, the embodiment of the present invention provides a kind of
The method processed application file, by server controls process order is issued, and instruction terminal carries out the place of application file
Reason.In addition, in preferred embodiment, the mode of application file is cleared up herein in connection with terminal local, inactive application is cleaned out in time
File.
Referring to Fig. 1, for a kind of method processed application file that the present invention is provided.
S101:Terminal receives the application file process order that application server sends.
Application file process order, refers to the instruction processed application file, for example, file is carried out the behaviour such as deleting
The instruction of work.Application file, refers to the associated documents of application program, for example, the configuration file of application program, the fortune of application program
Style of writing part, etc., wherein, configuration file is usually related to the version information of application program, upgrade information or user profile
File, and the operating file of application program refers to application program related file of recalls information in running.
In practical operation, application server sends application file and processes opportunity of order and do not limit to terminal, for example, can be with
Periodically issue application file and process order, or application file is issued as needed in technical attendant and process order, Huo Zhe
Version updating is carried out to application or application file is issued when deleting legacy version to process order, or terminal to report certain/a bit should
Order is processed with application file is issued when file is invalid.The application file processes order includes the text that instruction terminal is processed
Part identifies (such as file name) and processes action type.
In order to ensure terminal receives the application file process order that application server is issued, need to maintain terminal with application
Communication connection between server.For example, two can be maintained by way of terminal periodically sends heartbeat packet to application server
Communication connection between person.Specifically, terminal periodically to application server send heartbeat packet, heartbeat packet carried terminal IP address,
Terminal device information;Application server receives heartbeat packet, it is determined that keep communicating with terminal, so as to practical writing can be sent to terminal
Part process order.
It can be seen that, if it is desired to can implement by server lower section control life during application server and terminal communication
Order, now needs the heartbeat packet for maintaining and server.Heartbeat packet is mainly terminal periodically to server one sky of transmission
Order ensures that the connection of terminal and server will not disconnect because of time-out.Firstly, because process in terminal and server communication
In, if service end long-time does not receive the message of terminal, service end in order to discharge the resource that the terminal takes can disconnect with
The connection of terminal.If server and terminal are disconnected connection, then later terminal just cannot and server communication, if it is desired to
Continue to communicate, terminal must re-establish connection, but this process for setting up connection is very time-consuming, in order to solve this
Problem terminal can be solved by sending heartbeat packet.Next, terminal periodically sends heartbeat packet, and (heartbeat packet content carries client
Some essential informations, such as terminal mac address, device-dependent message, cell-phone number etc., main purpose is exactly and server carries out one
Secondary traffic operation), server finds that terminal periodically has and oneself communication, and server will be considered that terminal has always a demand for service, now
Server will not disconnect the connection with terminal.In addition, there is the transmission of heartbeat packet, it becomes possible to ensure terminal and server well
Connection do not turn off.
S102:Terminal parsing application file processes order, knows pending file identification and processes action type.
Pending file identification can be file name either file exclusive identification code or other represent files information,
Process mode of operation of the action type instruction to pending file is processed, for example, processing operation includes deletion action, updates operation
(old edition presents is replaced with new edition file), etc..
Specifically, server sends application file and processes order based on HTPP agreements to terminal, and for example, terminal receives application
The application file based on http protocol JSON forms that server sends processes order;Terminal parsing application file processes order
Mode is:Application file is parsed by FASTJSON modes and processes order.Wherein, JSON (JavaScript Object
Notation) it is a kind of data interchange format of lightweight, its a subset based on ECMAScript, JSON is using completely solely
Stand on the text formatting of language, but also using similar to C language family custom (including C, C++, C#, Java,
JavaScript, Perl, Python etc.).FASTJSON is the JSON processors that Java language is write, compared with JSON,
FASTJSO has the faster advantage of processing speed.
For example, the structure of application file process order is as follows:
{
"fileName":"myConfig.xml",
"fileOperation":"delete",
}
Wherein:
fileName:Expression needs to be deleted in file name, this example and needs to be deleted the title of file and be
myConfig.xml。
fileOperation:It is the operation for needing to carry out this file, the particular content of this operation is that delete is represented
Need to carry out deletion action to this file.
Such as above example, application file process order is that the data transfer of JSON forms is come by http protocol,
Terminal is received after the JSON data that server is passed over, and the JSON forms can be carried out using general FASTJSON modes
Parsing operation, parses the file name for needing to delete.For example, the file name after being parsed in above example is
myConfig.xml。
S103:Terminal performs the process to pending file and operates according to action type is processed.
Terminal parsing application file is processed after order, is performed the process to pending file and is operated.Specifically, can make
Specific process is performed with the various methods in the File classes of JDK offers to operate.Wherein, JDK is the software development of Java language
Kit, the java application being mainly used on mobile device, embedded device.JDK is the core of whole Java exploitations, it
Contain the class libraries of the running environment of Java, Java instruments and Java bases.File's classes (files classes) in by calling JDK
Various methods, it is possible to achieve the process to file is operated.For example, for deletion action, then the File classes that JDK can be used to provide
In delet method (Delete functions) deletion action performed to file process, Delete functions are one in file deletion letters
Number, its major function is to delete file from disk.
The application file processing method provided by the present invention, by server the side that application file processes order is issued
Formula, realize rubbish dynamic cleaning purpose, for example, for the configuration file of application program be updated or escalation process in, it is right
Carry out issuing delete command in the scratch file for being related to version or upgrading, so as to reduce these inactive files to terminal buffers space
Occupancy, mitigate the expense taken to disk, it is also possible to effectively avoid because the later stage causes system configuration to be lost the problems such as upgrade
Imitate so as to cause the disabled problem of software.
Except above by server issue application file process order mode it is (particularly invalid to terminal inactive file
Configuration file) outside the mode that processed, may also be combined with terminal local to inactive file (particularly invalid operating file)
Manner of cleaning up, so as to can further effective control software itself disk take.
Referring to Fig. 2, cleaning according to an embodiment of the invention is gone out and has been determined according to local using in the method for inactive file
When device delete cache file flow chart, comprise the steps:
S201:In terminal local, application file cleaning timer is set;
S202:Timer is cleared up according to application file, the application file of caching is read in timing;
S203:It is determined that the storage size shared by the application file of caching is more than preset memory space cleaning threshold;
S204:Delete the application file of caching.
Below by taking the terminal of android system as an example, it is described in further detail for aforementioned four step.
First, with regard to step S201 " arranging application file cleaning timer "
Local timer is configured:
The Special timer AlarmManager that Android can be adopted to provide, under system resting state, if
Timer expiry, Android can automatically waken up system to trigger timed task.AlarmManager has the work(for waking up CPU
Can, it is ensured that when every time needing to perform particular task CPU can normal work, register when CPU is in dormancy in other words
Alarm clock can be retained (can wake up CPU).
To set timer as example by AlarmManger in embodiment of the present invention.
The use of AlarmManager is divided into following two steps:
(1) timer AlarmManager is obtained
AlarmManager is the timing services that android system is provided, head when needing to use timing services
This service of android system offer first must be provided.Concrete acquisition methods are as follows:
AlarmManager alarmManager=
(AlarmManager)getSystemService(ALARM_SERVICE);
Directly invoke this method of getSystemService, it becomes possible to get the reality of timer AlarmManager
Example.Wherein getSystemService is the interface dedicated for obtaining system service that android system is provided.
(2) arrange and repeat timer
There is one in AlarmManager dedicated for arranging the function setRepeating for repeating timer, this function
Major function be arrange timed task, this timed task once arrival after, system can reopen new timed task, newly
Timing it is identical with old timing.
The use of this function is as follows:
SetRepeating (int type, long startTime, long intervalTime, PendingIntent
pi):
In the example of embodiment of the present invention, because periodically to carry out cleaning process to inactive file, it is advantageous to using
SetRepeating timers are setting timer.SetRepeating function setups be a cycle timer,
Periodically timer is able to ensure that task is performed by constantly timing.
2nd, with regard to step 202 " clearing up timer according to application file, the application file of caching is read in timing "
It is, for example possible to use the file that the JDK of Java is provided reads API, the application of caching is read by the timing of File classes
File.Specifically, the API that a set of file of the JDK offers of the Java that file is used reads is read, using File classes come to file
It is read out.The mode that File classes read file is as follows:File (file path), by the path of file the construction of File is delivered to
In function, such system will return the example file of this document.Subsequently letter can be carried out to file by document instance file
The acquisition of breath or the associative operation of file.
3rd, " judge the storage size shared by the application file for caching whether more than preset storage with regard to step 203
Space cleaning threshold "
Still by above in the way of " file that the JDK of Java is provided reads API ", read file document instance it
Afterwards, length methods therein can be called to obtain the size of file.The wherein major function of this function of length methods
It is the size information for returning current file.Thus, it is possible to which the size of current file has been got by length functions.
Need in advance to arrange a memory space cleaning threshold (file threshold value), be in order to big file is deleted, such as
The Documents Comparison of fruit caching is little, now it is considered that there is no need to delete it, because little cache file is to system disk
Expense it is smaller, affect to be negligible.If file is excessive will to produce certain have impact on to system.For example, originally
Threshold value is set to 50M in example, and in actual use the value can be configured size according to real needs, will read
Size and threshold value 50M to file carries out size contrast.
4th, with regard to step S204 " deleting the application file of caching "
Still such as above example, if file size is bigger than threshold value 50M, now deletion action is carried out to file.Delete text
The method of part be by calling file in delete functions deleting file, Delete functions are one in file
Function is deleted, its major function is to delete file from disk.If cache file is not above threshold size, now not
Any operation is done, i.e., for small documents will not carry out deletion action to it.
Corresponding with said method embodiment, the present invention also provides a kind of device processed application file.Referring to
Fig. 3, shows the apparatus structure schematic diagram that the present invention is processed application file, and the device includes:
Order receiving unit 301 is processed, the application file for receiving application server transmission processes order;
Process command resolution unit 302, for parsing the application file order processed, know pending file identification with
And process action type;
Operation execution unit 303 is processed, for according to action type is processed, performing the process to pending file and operating.
Pending file identification can be file name either file exclusive identification code or other represent files information,
Process mode of operation of the action type instruction to pending file is processed, for example, processing operation includes deletion action, updates operation
(old edition presents is replaced with new edition file), etc..
In practical operation, application server sends application file and processes opportunity of order and do not limit to terminal, for example, can be with
Periodically issue application file and process order, or application file is issued as needed in technical attendant and process order, Huo Zhe
Version updating is carried out to application or application file is issued when deleting legacy version to process order, or terminal to report certain/a bit should
Order is processed with application file is issued when file is invalid.The application file processes order includes the text that instruction terminal is processed
Part title and process action type.
In order to ensure terminal receives the application file process order that application server is issued, need to maintain terminal with application
Communication connection between server.For example, two can be maintained by way of terminal periodically sends heartbeat packet to application server
Communication connection between person.Specifically, terminal periodically to application server send heartbeat packet, heartbeat packet carried terminal IP address,
Terminal device information;Application server receives heartbeat packet, it is determined that keep communicating with terminal, so as to practical writing can be sent to terminal
Part process order.
Preferably, the device also includes:Heartbeat packet transmitting element 304, for periodically to application server send heartbeat packet,
The heartbeat packet carried terminal IP address, terminal device information.
It can be seen that, if it is desired to can implement by server lower section control life during application server and terminal communication
Order, now needs the heartbeat packet for maintaining and server.Heartbeat packet is mainly terminal periodically to server one sky of transmission
Order ensures that the connection of terminal and server will not disconnect because of time-out.Firstly, because process in terminal and server communication
In, if service end long-time does not receive the message of terminal, service end in order to discharge the resource that the terminal takes can disconnect with
The connection of terminal.If server and terminal are disconnected connection, then later terminal just cannot and server communication, if it is desired to
Continue to communicate, terminal must re-establish connection, but this process for setting up connection is very time-consuming, in order to solve this
Problem terminal can be solved by sending heartbeat packet.Next, terminal periodically sends heartbeat packet, and (heartbeat packet content carries client
Some essential informations, such as terminal mac address, device-dependent message, cell-phone number etc., main purpose is exactly and server carries out one
Secondary traffic operation), server finds that terminal periodically has and oneself communication, and server will be considered that terminal has always a demand for service, now
Server will not disconnect the connection with terminal.In addition, there is the transmission of heartbeat packet, it becomes possible to ensure terminal and server well
Connection do not turn off.
Preferably, the process order receiving unit 301 specifically for:The terminal receives the base that application server sends
Order is processed in the application file of http protocol JSON forms;It is described process command resolution unit 302 specifically for:Pass through
FASTJSON modes parse the application file and process order.
Pending file identification can be file name either file exclusive identification code or other represent files information,
Process mode of operation of the action type instruction to pending file is processed, for example, processing operation includes deletion action, updates operation
(old edition presents is replaced with new edition file), etc..
Specifically, server sends application file and processes order based on HTPP agreements to terminal, and for example, terminal receives application
The application file based on http protocol JSON forms that server sends processes order;Terminal parsing application file processes order
Mode is:Application file is parsed by FASTJSON modes and processes order.Wherein, JSON (JavaScript Object
Notation) it is a kind of data interchange format of lightweight, its a subset based on ECMAScript, JSON is using completely solely
Stand on the text formatting of language, but also using similar to C language family custom (including C, C++, C#, Java,
JavaScript, Perl, Python etc.).FASTJSON is the JSON processors that Java language is write, compared with JSON,
FASTJSO has the faster advantage of processing speed.
For example, the structure of application file process order is as follows:
{
"fileName":"myConfig.xml",
"fileOperation":"delete",
}
Wherein:
fileName:Expression needs to be deleted in file name, this example and needs to be deleted the title of file and be
myConfig.xml。
fileOperation:It is the operation for needing to carry out this file, the particular content of this operation is that delete is represented
Need to carry out deletion action to this file.
Such as above example, application file process order is that the data transfer of JSON forms is come by http protocol,
Terminal is received after the JSON data that server is passed over, and the JSON forms can be carried out using general FASTJSON modes
Parsing operation, parses the file name for needing to delete.For example, the file name after being parsed in above example is
myConfig.xml。
Except above by server issue application file process order mode it is (particularly invalid to terminal inactive file
Configuration file) outside the mode that processed, may also be combined with terminal local to inactive file (particularly invalid operating file)
Manner of cleaning up, so as to can further effective control software itself disk take.
Preferably, the device also includes:Local timing cleaning unit 305 is clear for arranging application file in terminal local
Reason timer, and, timer is cleared up according to application file, the application file of local cache is read in timing, and judges described slow
Whether the storage size shared by application file deposited is more than preset memory space cleaning threshold, if so, deletes described slow
The application file deposited.Preferably, the local timing cleaning unit 305 specifically for:The file provided using the JDK of Java is read
API is taken, the application file of local cache is read by the timing of File classes.
Below by taking the terminal of android system as an example, further it is situated between in detail for above-mentioned local timing cleaning unit 305
Continue.
First, with regard to " arranging application file cleaning timer "
Local timer is configured:
The Special timer AlarmManager that Android can be adopted to provide, under system resting state, if
Timer expiry, Android can automatically waken up system to trigger timed task.AlarmManager has the work(for waking up CPU
Can, it is ensured that when every time needing to perform particular task CPU can normal work, register when CPU is in dormancy in other words
Alarm clock can be retained (can wake up CPU).
To set timer as example by AlarmManger in embodiment of the present invention.
The use of AlarmManager is divided into following two steps:
(1) timer AlarmManager is obtained
AlarmManager is the timing services that android system is provided, head when needing to use timing services
This service of android system offer first must be provided.Concrete acquisition methods are as follows:
AlarmManager alarmManager=
(AlarmManager)getSystemService(ALARM_SERVICE);
Directly invoke this method of getSystemService, it becomes possible to get the reality of timer AlarmManager
Example.Wherein getSystemService is the interface dedicated for obtaining system service that android system is provided.
(2) arrange and repeat timer
There is one in AlarmManager dedicated for arranging the function setRepeating for repeating timer, this function
Major function be arrange timed task, this timed task once arrival after, system can reopen new timed task, newly
Timing it is identical with old timing.
The use of this function is as follows:
SetRepeating (int type, long startTime, long intervalTime, PendingIntent
pi):
In the example of embodiment of the present invention, because periodically to carry out cleaning process to inactive file, it is advantageous to using
SetRepeating timers are setting timer.SetRepeating function setups be a cycle timer,
Periodically timer is able to ensure that task is performed by constantly timing.
2nd, with regard to " clearing up timer according to application file, the application file of caching is read in timing "
It is, for example possible to use the file that the JDK of Java is provided reads API, the application of caching is read by the timing of File classes
File.Specifically, the API that a set of file of the JDK offers of the Java that file is used reads is read, using File classes come to file
It is read out.The mode that File classes read file is as follows:File (file path), by the path of file the construction of File is delivered to
In function, such system will return the example file of this document.Subsequently letter can be carried out to file by document instance file
The acquisition of breath or the associative operation of file.
3rd, with regard to " judging whether the storage size shared by the application file for caching is more than preset memory space clear
Reason threshold value "
Still by above in the way of " file that the JDK of Java is provided reads API ", read file document instance it
Afterwards, length methods therein can be called to obtain the size of file.The wherein major function of this function of length methods
It is the size information for returning current file.Thus, it is possible to which the size of current file has been got by length functions.
Need in advance to arrange a memory space cleaning threshold (file threshold value), be in order to big file is deleted, such as
The Documents Comparison of fruit caching is little, now it is considered that there is no need to delete it, because little cache file is to system disk
Expense it is smaller, affect to be negligible.If file is excessive will to produce certain have impact on to system.For example, originally
Threshold value is set to 50M in example, and in actual use the value can be configured size according to real needs, will read
Size and threshold value 50M to file carries out size contrast.
4th, with regard to " deleting the application file of caching "
Still such as above example, if file size is bigger than threshold value 50M, now deletion action is carried out to file.Delete text
The method of part be by calling file in delete functions deleting file, Delete functions are one in file
Function is deleted, its major function is to delete file from disk.If cache file is not above threshold size, now not
Any operation is done, i.e., for small documents will not carry out deletion action to it.
Provided herein algorithm and display be not inherently related to any certain computer, virtual system or miscellaneous equipment.
Various general-purpose systems can also be used together based on teaching in this.As described above, construct required by this kind of system
Structure be obvious.Additionally, the present invention is also not for any certain programmed language.It is understood that, it is possible to use it is various
Programming language realizes the content of invention described herein, and the description done to language-specific above is to disclose this
Bright preferred forms.
The present invention all parts embodiment can be realized with hardware, or with one or more processor operation
Software module realize, or with combinations thereof realization.It will be understood by those of skill in the art that can use in practice
Microprocessor or digital signal processor (DSP) are come in the system for realizing user's variable body control according to embodiments of the present invention
The some or all functions of some or all parts.The present invention is also implemented as performing method as described herein
Some or all equipment or program of device (for example, computer program and computer program).Such reality
The program of the existing present invention can be stored on a computer-readable medium, or can have the form of one or more signal.
Such signal can be downloaded from internet website and obtained, or be provided on carrier signal, or in any other form
There is provided.
It should be noted that above-described embodiment the present invention will be described rather than limits the invention, and ability
Field technique personnel can design without departing from the scope of the appended claims alternative embodiment.In the claims,
Any reference symbol between bracket should not be configured to limitations on claims.Word "comprising" is not excluded the presence of not
Element listed in the claims or step.Word "a" or "an" before element does not exclude the presence of multiple such
Element.The present invention can come real by means of the hardware for including some different elements and by means of properly programmed computer
It is existing.If in the unit claim for listing equipment for drying, several in these devices can be by same hardware branch
To embody.The use of word first, second, and third does not indicate that any order.These words can be explained and be run after fame
Claim.
Claims (10)
1. a kind of method that application file is processed, it is characterised in that include:
Terminal receives the application file process order that application server sends;
The terminal parses the application file and processes order, knows pending file identification and processes action type;
The terminal performs the process to pending file and operates according to action type is processed.
2. the method for claim 1, it is characterised in that also include:
Terminal periodically sends heartbeat packet, the heartbeat packet carried terminal IP address, terminal device information to application server;
Application server receives the heartbeat packet, it is determined that keep communicating with terminal, so as to the practical writing can be sent to terminal
Part process order.
3. the method for claim 1, it is characterised in that
The terminal receives the application file process order that application server sends, including:The terminal receives application server
The application file based on http protocol JSON forms for sending processes order;
The terminal parses the application file and processes order, including:The terminal parses described answering by FASTJSON modes
Use file manipulation command.
4. the method as described in any one of claim 1-3, it is characterised in that also include:
In terminal local, application file cleaning timer is set;
The terminal clears up timer according to application file, and the application file of local cache is read in timing, and judges the caching
Application file shared by storage size whether be more than preset memory space cleaning threshold, if so, delete the caching
Application file.
5. method as claimed in claim 4, it is characterised in that the application file of caching is read in the timing, including:
The file provided using the JDK of Java reads API, and by the timing of File classes the application file of local cache is read.
6. a kind of device that application file is processed, it is characterised in that include:
Order receiving unit is processed, the application file for receiving application server transmission processes order;
Command resolution unit is processed, for parsing the application file order is processed, know pending file identification and process
Action type;
Operation execution unit is processed, for according to action type is processed, performing the process to pending file and operating.
7. device as claimed in claim 6, it is characterised in that also include:
Heartbeat packet transmitting element, for periodically to application server transmission heartbeat packet, the heartbeat packet carried terminal IP address, end
End equipment information.
8. method as claimed in claim 6, it is characterised in that
It is described process order receiving unit specifically for:The terminal receive that application server sends based on http protocol JSON
The application file of form processes order;
It is described process command resolution unit specifically for:The application file is parsed by FASTJSON modes and processes order.
9. the device as described in any one of claim 6-8, it is characterised in that also include:
Local timing cleaning unit, for arranging application file cleaning timer in terminal local, and, it is clear according to application file
The application file of local cache is read in reason timer, timing, and judges that the memory space shared by the application file of the caching is big
It is little whether to be more than preset memory space cleaning threshold, if so, delete the application file of the caching.
10. device as claimed in claim 9, it is characterised in that the local timing cleaning unit specifically for:Using Java
JDK provide file read API, by File classes timing read local cache application file.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611024700.XA CN106657274A (en) | 2016-11-16 | 2016-11-16 | Method and device for processing application files |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611024700.XA CN106657274A (en) | 2016-11-16 | 2016-11-16 | Method and device for processing application files |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106657274A true CN106657274A (en) | 2017-05-10 |
Family
ID=58808352
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611024700.XA Pending CN106657274A (en) | 2016-11-16 | 2016-11-16 | Method and device for processing application files |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106657274A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102262544A (en) * | 2010-05-24 | 2011-11-30 | 腾讯科技(深圳)有限公司 | Method and device for upgrading software |
CN102404338A (en) * | 2011-12-13 | 2012-04-04 | 华为技术有限公司 | File synchronization method and device |
US20120117127A1 (en) * | 2010-11-08 | 2012-05-10 | Macdonald Carl | Apparatus and methods for improving uninstall process |
CN103365882A (en) * | 2012-03-30 | 2013-10-23 | 网秦无限(北京)科技有限公司 | Method and system for cleaning junk files on mobile terminal |
CN103714016A (en) * | 2014-01-14 | 2014-04-09 | 贝壳网际(北京)安全技术有限公司 | Cache cleaning method, device and client side |
CN103761306A (en) * | 2014-01-22 | 2014-04-30 | 深圳市欧珀通信软件有限公司 | Smart terminal file cleaning method and device |
-
2016
- 2016-11-16 CN CN201611024700.XA patent/CN106657274A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102262544A (en) * | 2010-05-24 | 2011-11-30 | 腾讯科技(深圳)有限公司 | Method and device for upgrading software |
US20120117127A1 (en) * | 2010-11-08 | 2012-05-10 | Macdonald Carl | Apparatus and methods for improving uninstall process |
CN102404338A (en) * | 2011-12-13 | 2012-04-04 | 华为技术有限公司 | File synchronization method and device |
CN103365882A (en) * | 2012-03-30 | 2013-10-23 | 网秦无限(北京)科技有限公司 | Method and system for cleaning junk files on mobile terminal |
CN103714016A (en) * | 2014-01-14 | 2014-04-09 | 贝壳网际(北京)安全技术有限公司 | Cache cleaning method, device and client side |
CN103761306A (en) * | 2014-01-22 | 2014-04-30 | 深圳市欧珀通信软件有限公司 | Smart terminal file cleaning method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105095226B (en) | Web page resources loading method and device | |
EP3734933A1 (en) | Resource acquisition method, resource return method, server and storage medium | |
CN103645914B (en) | Software cleaning method and device | |
CN104537119B (en) | A kind of data cached update method, data use end and system | |
US8996725B2 (en) | Programmatic redirect management | |
CN106815329A (en) | A kind of data cached update method and device | |
KR20160135250A (en) | Prefetching application data for periods of disconnectivity | |
US20110107033A1 (en) | Method and apparatus for providing an application-level cache | |
CN106776761A (en) | A kind of mobile browser renders the method and device of webpage | |
CN102571997A (en) | Method, system and device for data access | |
JP2007241989A (en) | Mobile electronic device | |
CN109951538A (en) | Data processing method, device, system, electronic equipment and storage medium | |
CN104601736A (en) | Method and device for realizing short uniform resource locator (URL) service | |
CN107122379A (en) | Collect the Transaction Information associated with the data file being locally stored | |
CN102999500A (en) | Statistical method and system for click rate | |
CN105468707A (en) | Cache-based data processing method and device | |
CN101123750A (en) | Apparatus and associated method for facilitating background processing of push content | |
CN106709323A (en) | Method and apparatus for identifying cloaked downloading link | |
CN103475744A (en) | Resource downloading method, device and system on basis of Web application | |
CN103414693A (en) | Dotting method and dotting device | |
CN106843954A (en) | Sensor node remote upgrade method | |
CN108280174A (en) | Front end file construction method and server, page access method and terminal | |
CN110442286A (en) | A kind of page display method, device and electronic equipment | |
CN105808282A (en) | Method and device for updating webpage contents of application program | |
CN108243265A (en) | A kind of dns resolution processing method and processing device |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170510 |