Summary of the invention
The embodiment of the present invention is designed to provide a kind of date storage method and device, to improve flash memory type memory
Service life.
In order to achieve the above objectives, the embodiment of the invention discloses a kind of date storage methods, are applied to mobile terminal device,
Include:
Obtain the daily record data for Update log file that the mobile terminal device is currently generated;
According to preset rules, the rank of daily record data obtained is determined;
According to the rank of identified daily record data, the storage location of daily record data obtained is determined;
Daily record data obtained is stored in identified storage location.
Preferably, the rank of the daily record data according to determined by, determines the storage location of daily record data obtained,
Include:
In the case where the rank of identified daily record data is kernel level, by the external storage of the mobile terminal device
Journal file in device is determined as the storage location of daily record data obtained;
In the case where the rank of identified daily record data is system service rank or the other situation of application-level, by the shifting
The built-in storage of dynamic terminal device, is determined as the storage location of daily record data obtained.
Preferably, allocating depositing for the daily record data of storage different stage in the built-in storage of the mobile terminal device in advance
Store up space;
The rank in identified daily record data is in system service rank or the other situation of application-level, by institute
The built-in storage for stating mobile terminal device is determined as the storage location of daily record data obtained, comprising:
In the case where the rank of identified daily record data is system service rank or the other situation of application-level, by the shifting
It moves in the built-in storage of terminal device, memory space corresponding with the rank of identified daily record data, is determined as obtained
The storage location of daily record data.
Preferably, the method also includes:
By the daily record data in the built-in storage for being stored in the mobile terminal device according to the pre-set write time
Period is periodically written in the journal file in the external memory of the mobile terminal device;Or
When pre-set write time point reaches, by the day in the built-in storage for being stored in the mobile terminal device
Will data are written in the journal file in the external memory of the mobile terminal device;Or
In the case where presetting the memory capacity of the memory space, judge whether the memory space has expired, such as
Fruit is the log being written to the daily record data being stored in the memory space in the external memory of the mobile terminal device
In file;The daily record data being stored in the memory space is deleted;Or
Judge whether to receive the instruction of restarting or shutdown command for the mobile terminal device;If so, will storage
In the external memory that the daily record data in the built-in storage of the mobile terminal device is written to the mobile terminal device
In journal file.
Preferably, the mobile terminal device and log server communicate to connect;The method also includes:
Obtain the networking mode of the mobile terminal device;
It, will be described in the case where the networking mode of the mobile terminal device is to be networked by Wireless LAN
Journal file is uploaded to the log server.
In order to achieve the above objectives, the embodiment of the invention discloses a kind of data storage devices, are applied to mobile terminal device,
It include: that daily record data obtains module, rank determination module, storage location determining module and the first memory module, wherein
The daily record data obtains module, for obtaining that the mobile terminal device is currently generated for Update log text
The daily record data of part;
The rank determination module is obtained for according to preset rules, determining that the daily record data obtains module
Daily record data rank;
The storage location determining module, for the rank of the daily record data according to determined by the rank determination module,
Determine that the daily record data obtains the storage location for the daily record data that module obtains;
First memory module is stored in described deposit for the daily record data to be obtained the daily record data that module obtains
Store up the storage location that position determination module determines.
Preferably, the storage location determining module, comprising: the first storage location determines submodule and the second storage location
Determine submodule, wherein
First storage location determines submodule, the rank of the daily record data for determining in the rank determination module
In the case where for kernel level, by the journal file in the external memory of the mobile terminal device, it is determined as day obtained
The storage location of will data;
Second storage location determines submodule, the rank of the daily record data for determining in the rank determination module
Under system service rank or the other situation of application-level, the built-in storage of the mobile terminal device to be determined as being obtained
The storage location of the daily record data obtained.
Preferably, allocating depositing for the daily record data of storage different stage in the built-in storage of the mobile terminal device in advance
Store up space;Second storage location determines submodule, is specifically used for:
It is that system service rank or application-level are other in the rank for the daily record data that the rank determination module determines
In the case of, by the built-in storage of the mobile terminal device, memory space corresponding with the rank of identified daily record data,
It is determined as the storage location of daily record data obtained.
Preferably, described device further include: the second memory module, third memory module, the 4th memory module and the 5th are deposited
Store up at least one of module;Wherein,
Second memory module, the daily record data in built-in storage for the mobile terminal device will to be stored in by
According to pre-set period write time, the journal file being periodically written in the external memory of the mobile terminal device
In;
The third memory module, it is described mobile whole for that will be stored in when pre-set write time point reaches
Daily record data in the built-in storage of end equipment is written in the journal file in the external memory of the mobile terminal device;
4th memory module, for judging institute in the case where presetting the memory capacity of the memory space
State whether memory space has expired, if so, the daily record data being stored in the memory space is written to the mobile terminal
In journal file in the external memory of equipment;The daily record data being stored in the memory space is deleted;
5th memory module receives the instruction of restarting for the mobile terminal device or pass for judging whether
Machine instruction;If so, the daily record data in the built-in storage for being stored in the mobile terminal device is written to described mobile whole
In journal file in the external memory of end equipment.
Preferably, the mobile terminal device and log server communicate to connect;Described device further include: networking mode obtains
Obtain module and journal file uploading module, wherein
The networking mode obtains module, for obtaining the networking mode of the mobile terminal device;
The journal file uploading module is to pass through nothing for obtaining the networking mode that module obtains in the networking mode
In the case that line local area network is networked, the journal file is uploaded to the log server.
As seen from the above technical solutions, the embodiment of the invention provides a kind of date storage method and device, it is applied to
Mobile terminal device, method include: the log number for Update log file for obtaining the mobile terminal device and being currently generated
According to;According to preset rules, the rank of daily record data obtained is determined;According to the rank of identified daily record data,
Determine the storage location of daily record data obtained;Daily record data obtained is stored in identified storage location.Due to
It is the storage location for being stored according to the rank of daily record data to daily record data, and being stored in determining, every time will is not
The daily record data of generation is stored in the external memory of mobile terminal device, therefore, reduces the external storage of mobile terminal device
The write-in number of device, improves the service life of external memory.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
It should be noted that the embodiment of the present invention is preferably applied to mobile terminal device, for example, being mounted with that iOS is operated
(android system is a kind of for system (iOS is the handheld equipment operating system developed by Apple Inc.) or Android operation system
The operating system of freedom and open source code based on Linux) or Windows Phone operating system (Windows Phone
Be Microsoft publication Mobile phone operating system) mobile terminal device, be of course also apply to other mobile terminal devices,
This is not limited by the present invention.
Below by specific embodiment, the present invention is described in detail.
Fig. 1 is that the first process of the date storage method provided in an embodiment of the present invention applied to mobile terminal device is shown
It is intended to;May include:
S101: the daily record data for Update log file that the mobile terminal device is currently generated is obtained;
S102: according to preset rules, the rank of daily record data obtained is determined;
S103: according to the rank of identified daily record data, the storage location of daily record data obtained is determined;
S104: daily record data obtained is stored in identified storage location.
In practical applications, daily record data can be according to user for mobile terminal device operation generate, such as:
User deletes the daily record data of the generation of the content in certain document;It is also possible to mobile terminal device and detects there is event in system
It automatically generates, such as: the system of detecting receives the daily record data, etc. of e-mail messages generation.
Illustratively, it is assumed that user in order to avoid mobile terminal device system by virus destruction, in mobile terminal
It is mounted with certain antivirus software in equipment, and is provided with the antivirus software and automatically updates upgrading, it is assumed that on December 25th, 2013
In the case that 10:19:48 detects the presence of update, then upgrade information file is downloaded, the daily record data of generation is as follows:
Log generates object: certain antivirus software;Time: on December 25th, 2013 10:19:48;Log Names:
Security;Event: downloading upgrade information file;Upgrade information file name: A;Upgrade information file source address: http://A
Address.
Determine the rank of the daily record data of above-mentioned generation, specifically, daily record data can be divided into four ranks in advance,
It is respectively as follows: kernel level, system service rank, application program rank and debugging level, wherein the daily record data of kernel level
Are as follows: the abnormal interrupt that occurs in kernel such as exits at serious problems, the daily record data of generation;The daily record data of system service rank
Are as follows: system service goes wrong, the daily record data of generation;The other daily record data of application-level are as follows: application program goes wrong,
The daily record data of generation;The daily record data of debugging level are as follows: problem when debugging, the daily record data of generation.
Object can be generated according to the log of daily record data, the rank of daily record data be determined, such as by the log of above-mentioned generation
" log generates object: certain antivirus software to data;Time: on December 25th, 2013 10:19:48;Log Names: Security;Thing
Part: downloading upgrade information file;Upgrade information file name: A;Upgrade information file source address: the address of http://A ", day
It is certain antivirus software that will, which generates object, this daily record data is determined as application program rank.By the memory of mobile terminal device
Reservoir is determined as the storage location of the daily record data, this daily record data is stored in the built-in storage of mobile terminal device.
In the case where the rank of daily record data is determined as kernel level, by the day of the external memory of mobile terminal device
Will file is determined as the storage location of daily record data;Daily record data is stored in the log of the external memory of mobile terminal device
In file;
In the case where the rank of daily record data is determined as system service rank, by the interior storage of mobile terminal device
Device is determined as the storage location of daily record data;Daily record data is stored in the built-in storage of mobile terminal device.
In the case where the rank of daily record data is determined as debugging level, since the daily record data of debugging level exists immediately
It is shown in the screen of mobile terminal device, carries out debugging use for user, after user, which debugs, to complete, the daily record data
I.e. without any effect, therefore the daily record data of debugging level is without being stored.
In practical applications, the daily record data of storage different stage is allocated in the built-in storage of mobile terminal device in advance
Memory space, such as be used for the daily record data of storage system service rank in the built-in storage distribution of mobile terminal device in advance
The initial address of memory space is 00200000H, termination address 015FFFFFH;It distributes other for storing application-level
The initial address of the memory space of daily record data is 01600000H, termination address 033FFFFFH.
Then in the case where determining daily record data rank is system service rank, by the daily record data of system service rank
Being stored in initial address is 00200000H, and termination address is in the memory space of 015FFFFFH;In determining daily record data grade
Wei not be in the other situation of application-level, it is 01600000H that the other daily record data of application-level, which is stored in initial address, eventually
Only address is in the memory space of 033FFFFFH.
Using embodiment illustrated in fig. 1 of the present invention, daily record data is stored by the rank thus according to daily record data, and
And it is stored in determining storage location, it is not the external memory that the daily record data of generation is stored in mobile terminal device every time
In, therefore, reduces the write-in number of the external memory of mobile terminal device, improve the service life of external memory.
Fig. 2 is that second of process of the date storage method provided in an embodiment of the present invention applied to mobile terminal device is shown
It is intended to;On the basis of embodiment illustrated in fig. 2 embodiment shown in Fig. 1 of the present invention, S103 includes S1031: in identified log
In the case that the rank of data is kernel level, the journal file in the external memory of the mobile terminal device is determined as
The storage location of daily record data obtained;It is system service rank or application-level in the rank of identified daily record data
In other situation, by the built-in storage of the mobile terminal device, it is determined as the storage location of daily record data obtained.Increase
S105: by the daily record data in the built-in storage for being stored in the mobile terminal device according to pre-set week write time
Phase is periodically written in the journal file in the external memory of the mobile terminal device.
In practical applications, it can preset and write the daily record data in the built-in storage for being stored in mobile terminal device
Enter to period write time in the journal file in the external memory of mobile terminal device, will periodically be stored in the shifting
Daily record data in the built-in storage of dynamic terminal device is written in the journal file in the external memory of mobile terminal device;Example
Such as, pre-set period write time is two hours, then will every two hours be stored in the interior storage of the mobile terminal device
Daily record data in device is written in the journal file in the external memory of mobile terminal device.
In practical applications, it can also preset the log in the built-in storage for being stored in the mobile terminal device
Data are written to the write time point in the journal file in the external memory of mobile terminal device, in pre-set write-in
Between put reach when, the daily record data in the built-in storage for being stored in the mobile terminal device is written to mobile terminal device
In journal file in external memory;For example, pre-set write time point be daily 0:00,12:00 and 22:00, then
Daily record data in the built-in storage for being stored in the mobile terminal device is written to shifting by daily 0:00,12:00 and 22:00
In journal file in the external memory of dynamic terminal device.
In practical applications, the memory capacity of memory space can also be preset, it is assumed that for storing daily record data
The initial address of memory space are as follows: 00200000H, termination address are as follows: 033FFFFFH, then the memory capacity of the memory space be
50M, judges whether the daily record data stored in memory space has stored 50M, if it is, by the daily record data in memory space
It is written in the journal file in the external memory of mobile terminal device;The daily record data being stored in memory space is deleted.
In practical applications, the data in built-in storage can lose in the case where power-off (such as restart or shut down), because
This, can detecte the instruction of restarting or shutdown command whether received for mobile terminal device, if received, will deposit at this time
Storage is in the external memory that the daily record data in the built-in storage of the mobile terminal device is written to the mobile terminal device
Journal file in.
Using embodiment illustrated in fig. 2 of the present invention, daily record data is stored by the rank thus according to daily record data, and
And it is stored in determining storage location, it is not the external memory that the daily record data of generation is stored in mobile terminal device every time
In, therefore, reduces the write-in number of the external memory of mobile terminal device, improve the service life of external memory.
Fig. 3 is that the third process of the date storage method provided in an embodiment of the present invention applied to mobile terminal device is shown
It is intended to;Mobile terminal device and log server communicate to connect;The base of embodiment illustrated in fig. 3 embodiment shown in Fig. 2 of the present invention
Increase following two step on plinth;
S106: the networking mode of the mobile terminal device is obtained;
S107: in the case where the networking mode of the mobile terminal device is to be networked by Wireless LAN,
The journal file is uploaded to the log server.
Journal file in the external memory of mobile terminal device, which has, occupies the memory space upper limit;Illustratively, it is assumed that
It is log for the journal file in the external memory of the mobile terminal device of storing daily record data, occupying the memory space upper limit is
10M。
Daily record data in the built-in storage of mobile terminal device can be written in log, when log reaches 10M, creation
The copy of log, while the daily record data in log is deleted, then the daily record data in the built-in storage of mobile terminal device is written
Into log, when the copy amount of log reaches preset quantity, all copies of log is uploaded to server, uploads and completes
All copies of log are deleted afterwards.
Daily record data in the built-in storage of mobile terminal device can also be written in log, it, will when log reaches 10M
Log is named as log1, then creates log, then the daily record data in the built-in storage of mobile terminal device is written in log, log
When reaching 10M, log is named as log2, then create log, and so on, exist until in the external memory of mobile terminal device
LogN, N are pre-set value, and log1 to logN is uploaded to server at this time, delete log1 to logN after the completion of uploading.
In practical applications, the networking mode of mobile terminal device can be to be carried out by general packet radio service technology
Networking, i.e., mobile network provide mobile data services GPRS (General Packet Radio Service, general packet without
Line service technology), or it is networked by Wireless LAN.
Using embodiment illustrated in fig. 3 of the present invention, journal file is uploaded to log server, it is therefore prevented that daily record data is lost
It loses, while in the case where the networking mode of mobile terminal device is to be networked by Wireless LAN, by journal file
It is uploaded to log server, saves the data traffic of mobile terminal device.
Corresponding with above-mentioned embodiment of the method, the embodiment of the invention also provides the data for being applied to mobile terminal device
Storage device.
Fig. 4 is that the first structure of the data storage device provided in an embodiment of the present invention applied to mobile terminal device is shown
It is intended to;It may include: that daily record data obtains module 201, rank determination module 202, storage location determining module 203 and first are deposited
Store up module 204, wherein
Daily record data obtains module 201, for obtaining that the mobile terminal device is currently generated for Update log text
The daily record data of part;
Rank determination module 202, for according to preset rules, determining that daily record data obtains what module 201 obtained
The rank of daily record data;
Storage location determining module 203, for the rank of the daily record data according to determined by rank determination module 202, really
The storage location for the daily record data that settled date will data obtaining module 201 obtains;
In practical applications, the storage location determining module 203 of the embodiment of the present invention may include: the first storage location
Determine that submodule and the second storage location determine submodule (not shown), wherein
First storage location determines submodule, and the rank of the daily record data for determining in rank determination module 202 is interior
In the other situation of nuclear leve, by the journal file in the external memory of the mobile terminal device, it is determined as log number obtained
According to storage location;
Second storage location determines submodule, and the rank of the daily record data for determining in rank determination module 202 is to be
Under service class of uniting or the other situation of application-level, the built-in storage of the mobile terminal device is determined as obtained
The storage location of daily record data.
The storage for allocating the daily record data of storage different stage in advance in the built-in storage of the mobile terminal device is empty
Between in the case where, the second storage location determines submodule, specifically can be used for:
It is that system service rank or application-level are other in the rank for the daily record data that the rank determination module determines
In the case of, by the built-in storage of the mobile terminal device, memory space corresponding with the rank of identified daily record data,
It is determined as the storage location of daily record data obtained.
First memory module 204, the daily record data for obtaining daily record data acquisition module 201 are stored in storage location
The storage location that determining module 203 determines.
Using embodiment illustrated in fig. 4 of the present invention, daily record data is stored by the rank thus according to daily record data, and
And it is stored in determining storage location, it is not the external memory that the daily record data of generation is stored in mobile terminal device every time
In, therefore, reduces the write-in number of the external memory of mobile terminal device, improve the service life of external memory.
Fig. 5 is that second of structure of the data storage device provided in an embodiment of the present invention applied to mobile terminal device is shown
It is intended to;Embodiment illustrated in fig. 5 of the present invention on the basis of the embodiment shown in fig. 4, increases by the second memory module 205,
Second memory module 205, the daily record data in built-in storage for the mobile terminal device will to be stored in by
According to pre-set period write time, the journal file being periodically written in the external memory of the mobile terminal device
In.
In practical applications, on the basis of the embodiment shown in fig. 4, can also increase: third memory module, the 4th storage
At least one of module and the 5th memory module (not shown);Wherein,
Third memory module, for that will be stored in the mobile terminal and set when pre-set write time point reaches
Daily record data in standby built-in storage is written in the journal file in the external memory of the mobile terminal device;
4th memory module, for being deposited described in judgement in the case where presetting the memory capacity of the memory space
Whether storage space has expired, if so, the daily record data being stored in the memory space is written to the mobile terminal device
External memory in journal file in;The daily record data being stored in the memory space is deleted;
5th memory module refers to for judging whether to receive for the instruction of restarting of the mobile terminal device or shutdown
It enables;It is set if so, the daily record data in the built-in storage for being stored in the mobile terminal device is written to the mobile terminal
In journal file in standby external memory.
Using embodiment illustrated in fig. 5 of the present invention, daily record data is stored by the rank thus according to daily record data, and
And it is stored in determining storage location, it is not the external memory that the daily record data of generation is stored in mobile terminal device every time
In, therefore, reduces the write-in number of the external memory of mobile terminal device, improve the service life of external memory.
Fig. 6 is that the third structure of the data storage device provided in an embodiment of the present invention applied to mobile terminal device is shown
It is intended to;Mobile terminal device and log server communicate to connect;The base of embodiment illustrated in fig. 6 embodiment shown in Fig. 5 of the present invention
On plinth, increase following two module: networking mode obtains module 206 and journal file uploading module 207, wherein
Networking mode obtains module 206, for obtaining the networking mode of the mobile terminal device;
Journal file uploading module 207, for obtaining the networking for the mobile terminal device that module 206 obtains in networking mode
Mode is that in the case where being networked by Wireless LAN, the journal file is uploaded to the log server.
Using embodiment illustrated in fig. 6 of the present invention, journal file is uploaded to log server, it is therefore prevented that daily record data is lost
It loses, while in the case where the networking mode of mobile terminal device is to be networked by Wireless LAN, by journal file
It is uploaded to log server, saves the data traffic of mobile terminal device.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.
Those of ordinary skill in the art will appreciate that all or part of the steps in realization above method embodiment is can
It is completed with instructing relevant hardware by program, the program can store in computer-readable storage medium,
The storage medium designated herein obtained, such as: ROM/RAM, magnetic disk, CD.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.