TWI709041B - Data storage method and device of mobile terminal - Google Patents

Data storage method and device of mobile terminal Download PDF

Info

Publication number
TWI709041B
TWI709041B TW106101932A TW106101932A TWI709041B TW I709041 B TWI709041 B TW I709041B TW 106101932 A TW106101932 A TW 106101932A TW 106101932 A TW106101932 A TW 106101932A TW I709041 B TWI709041 B TW I709041B
Authority
TW
Taiwan
Prior art keywords
data
metadata
stored
cache
key value
Prior art date
Application number
TW106101932A
Other languages
Chinese (zh)
Other versions
TW201828064A (en
Inventor
廉潔
Original Assignee
開曼群島商創新先進技術有限公司
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 開曼群島商創新先進技術有限公司 filed Critical 開曼群島商創新先進技術有限公司
Priority to TW106101932A priority Critical patent/TWI709041B/en
Publication of TW201828064A publication Critical patent/TW201828064A/en
Application granted granted Critical
Publication of TWI709041B publication Critical patent/TWI709041B/en

Links

Images

Abstract

本發明提供一種移動終端的資料儲存方法和裝置。所述方法包括:對原始資料進行格式轉換,以得到預設格式的第一資料;創建所述第一資料的第一中繼資料;根據快取中保存的鍵值與中繼資料的對應關係判斷資料庫中是否儲存有所述第一資料;如果資料庫中沒有儲存所述第一資料,則將所述第一資料、所述第一資料的第一中繼資料以及所述第一資料的鍵值保存到快取中;在滿足預設的觸發條件時,將快取中尚未儲存到資料庫中的第一資料、第一資料的第一中繼資料以及第一資料的鍵值保存到資料庫中。本發明可以將原始資料轉換為預設格式的資料後儲存到資料庫中,能夠消除資料的結構差異,提高資料的相容性以及資料讀寫的效率。 The invention provides a data storage method and device for a mobile terminal. The method includes: format conversion of the original data to obtain first data in a preset format; creating a first metadata of the first data; according to the correspondence between the key value and the metadata stored in the cache Determine whether the first data is stored in the database; if the first data is not stored in the database, combine the first data, the first metadata of the first data, and the first data The key value of is saved in the cache; when the preset trigger condition is met, the first data in the cache, the first metadata of the first data, and the key value of the first data that have not been stored in the database are saved To the database. The invention can convert original data into data in a preset format and then store it in a database, can eliminate the structural difference of data, and improve the compatibility of data and the efficiency of data reading and writing.

Description

移動終端的資料儲存方法和裝置 Data storage method and device of mobile terminal

本發明涉及儲存技術領域,尤其涉及一種移動終端的資料儲存方法和裝置。 The present invention relates to the field of storage technology, in particular to a data storage method and device of a mobile terminal.

隨著科技的發展,越來越多的移動終端走進了人們的生活,比如:智慧手機、平板電腦等。使用者可以在移動終端中裝載各種各樣的應用程式,隨之而來,需要儲存在移動終端本地的資料也就越來越多。這些資料的格式多樣化、結構變更頻繁,嚴重影響移動終端的讀寫性能,同時也降低了應用程式開發和運行維護的效率。 With the development of technology, more and more mobile terminals have entered people's lives, such as smart phones, tablet computers, etc. Users can load various applications in the mobile terminal, and subsequently, more and more data need to be stored locally in the mobile terminal. The diversified formats and frequent structural changes of these data seriously affect the read and write performance of mobile terminals and reduce the efficiency of application development and operation and maintenance.

有鑑於此,本發明提供一種資料儲存方法和裝置。 In view of this, the present invention provides a data storage method and device.

具體地,本發明是透過如下技術方案實現的:一種移動終端的資料儲存方法,所述方法包括:對將原始資料進行格式轉換,以得到預設格式的第一資料:創建所述第一資料的第一中繼資料; 根據快取中保存的鍵值與中繼資料的對應關係判斷資料庫中是否儲存有所述第一資料;如果資料庫中沒有儲存所述第一資料,則將所述第一資料、所述第一資料的第一中繼資料以及所述第一資料的鍵值保存到快取中;在滿足預設的觸發條件時,將快取中尚未儲存到資料庫中的第一資料、第一資料的第一中繼資料以及第一資料的鍵值保存到資料庫中。 Specifically, the present invention is achieved through the following technical solutions: a data storage method for a mobile terminal, the method comprising: format conversion of original data to obtain first data in a preset format: creating the first data的 first metadata; Determine whether the first data is stored in the database according to the corresponding relationship between the key value stored in the cache and the metadata; If the first data is not stored in the database, then all The first data, the first metadata of the first data, and the key value of the first data are stored in the cache; when the preset trigger condition is met, the cache is not yet stored in the database The first data, the first metadata of the first data, and the key value of the first data are stored in the database.

可選的,所述根據快取中保存的鍵值與中繼資料的對應關係判斷資料庫中是否儲存有所述第一資料,包括:根據所述第一資料的鍵值判斷快取中是否保存有所述鍵值對應的第二中繼資料;如果快取中沒有保存所述鍵值對應的第二中繼資料,則確定資料庫中沒有儲存所述第一資料。 Optionally, the judging whether the first data is stored in the database according to the corresponding relationship between the key value stored in the cache and the metadata includes: judging whether the first data is in the cache according to the key value of the first data The second metadata corresponding to the key value is saved; if the second metadata corresponding to the key value is not saved in the cache, it is determined that the first data is not stored in the database.

可選的,還包括:如果快取中保存有所述鍵值對應的第二中繼資料,則判斷所述第二中繼資料與所述第一中繼資料是否相同;如果所述第二中繼資料與所述第一中繼資料不相同,則確定資料庫中沒有儲存所述第一資料;所述將所述第一資料、所述第一資料的第一中繼資料以及所述第一資料的鍵值保存到快取中,包括:將快取中保存所述第一資料的鍵值對應的第二中繼資料更新為所述第一中繼資料,並保存所述第一資料。 Optionally, the method further includes: if the second metadata corresponding to the key value is stored in the cache, determining whether the second metadata is the same as the first metadata; if the second metadata is If the metadata is different from the first metadata, it is determined that the first data is not stored in the database; the first metadata, the first metadata of the first data, and the Saving the key value of the first data to the cache includes: updating the second metadata corresponding to the key value of the first data stored in the cache to the first metadata, and saving the first data.

可選的,所述判斷所述第二中繼資料與所述第一中繼 資料是否相同,包括:判斷所述第二中繼資料的雜湊值與所述第一中繼資料的雜湊值是否相同,如果相同,則確認所述第二中繼資料與所述第一中繼資料相同;如果不相同,則確認所述第二中繼資料與所述第一中繼資料不相同。 Optionally, the determining whether the second metadata is the same as the first metadata includes: determining whether the hash value of the second metadata is the same as the hash value of the first metadata If they are the same, confirm that the second metadata is the same as the first metadata; if they are not the same, then confirm that the second metadata is different from the first metadata.

可選的,所述預設的觸發條件包括:到達預設的時間週期以及快取的資料量達到預設的閾值。 Optionally, the preset trigger condition includes: reaching a preset time period and the amount of cached data reaching a preset threshold.

可選的,還包括:在讀取資料時,根據鍵值在快取中查找是否保存有對應的第一資料;當快取中沒有保存所述鍵值對應的第一資料時,根據快取中保存的所述鍵值對應的中繼資料從資料庫中獲取所述鍵值對應的第一資料;將所述第一資料轉換為原始資料後回傳讀取結果。 Optionally, it also includes: when reading data, searching the cache according to the key value to find whether the corresponding first data is saved; when the first data corresponding to the key value is not saved in the cache, according to the cache The metadata corresponding to the key value stored in the database obtains the first data corresponding to the key value from a database; the first data is converted into original data and the read result is returned.

一種移動終端的資料儲存裝置,所述裝置包括:第一轉換單元,對原始資料進行格式轉換,以得到預設格式的第一資料;中繼資料創建單元,創建所述第一資料的第一中繼資料;儲存判斷單元,根據快取中保存的鍵值與中繼資料的對應關係判斷資料庫中是否儲存有所述第一資料;資料暫存單元,在資料庫中沒有儲存所述第一資料時,將所述第一資料、所述第一資料的第一中繼資料以及所述第一資料的鍵值保存到快取中; 資料儲存單元,在滿足預設的觸發條件時,將快取中尚未儲存到資料庫中的第一資料、第一資料的第一中繼資料以及第一資料的鍵值保存到資料庫中。 A data storage device for a mobile terminal, the device comprising: a first conversion unit that performs format conversion on original data to obtain first data in a preset format; and a metadata creation unit that creates a first data of the first data Metadata; a storage judging unit that judges whether the first data is stored in the database according to the correspondence between the key value stored in the cache and the metadata; the data temporary storage unit does not store the first data in the database In the case of a data, the first data, the first metadata of the first data, and the key value of the first data are stored in the cache; the data storage unit, when the preset trigger condition is met, The first data in the cache, the first metadata of the first data and the key value of the first data that have not been stored in the database are saved in the database.

可選的,所述儲存判斷單元,具體根據所述第一資料的鍵值判斷快取中是否保存有所述鍵值對應的第二中繼資料,如果快取中沒有保存所述鍵值對應的第二中繼資料,則確定資料庫中沒有儲存所述第一資料。 Optionally, the storage judgment unit specifically judges whether the second metadata corresponding to the key value is stored in the cache according to the key value of the first data, and if the key value correspondence is not stored in the cache If the second metadata is determined, the first data is not stored in the database.

可選的,所述儲存判斷單元,具體在快取中保存有所述鍵值對應的第二中繼資料時,判斷所述第二中繼資料與所述第一中繼資料是否相同,如果所述第二中繼資料與所述第一中繼資料不相同,則確定資料庫中沒有儲存所述第一資料;所述資料暫存單元,具體將快取中保存所述第一資料的鍵值對應的第二中繼資料更新為所述第一中繼資料,並保存所述第一資料。 Optionally, the storage determining unit specifically determines whether the second metadata is the same as the first metadata when the second metadata corresponding to the key value is saved in the cache, if If the second metadata is not the same as the first metadata, it is determined that the first data is not stored in the database; the data temporary storage unit specifically stores the first data in the cache The second metadata corresponding to the key value is updated to the first metadata, and the first data is saved.

可選的,所述儲存判斷單元,具體判斷所述第二中繼資料的雜湊值與所述第一中繼資料的雜湊值是否相同,如果相同,則確認所述第二中繼資料與所述第一中繼資料相同;如果不相同,則確認所述第二中繼資料與所述第一中繼資料不相同。 Optionally, the storage determining unit specifically determines whether the hash value of the second metadata is the same as the hash value of the first metadata, and if they are the same, confirms that the second metadata is the same as the hash value of the first metadata. The first metadata is the same; if they are not the same, it is confirmed that the second metadata is different from the first metadata.

可選的,所述預設的觸發條件包括:到達預設的時間週期以及快取的資料量達到預設的閾值。 Optionally, the preset trigger condition includes: reaching a preset time period and the amount of cached data reaching a preset threshold.

可選的,所述裝置還包括:第一讀取單元,在讀取資料時,根據鍵值在快取中查 找是否保存有對應的第一資料;第二讀取單元,當快取中沒有保存所述鍵值對應的第一資料時,根據快取中保存的所述鍵值對應的中繼資料從資料庫中獲取所述鍵值對應的第一資料;第二轉換單元,將所述第一資料轉換為原始資料後回傳讀取結果。 Optionally, the device further includes: a first reading unit, when reading the data, according to the key value in the cache to find whether the corresponding first data is stored; the second reading unit, when there is no When saving the first data corresponding to the key value, obtain the first data corresponding to the key value from the database according to the metadata corresponding to the key value stored in the cache; the second conversion unit converts the After the first data is converted into the original data, the read result is returned.

由以上描述可以看出,本發明可以將原始資料轉換為預設格式的資料後儲存到基於Key-Value的非關係型資料庫中,能夠消除資料的結構差異,提高資料的相容性以及資料讀寫的效率。 It can be seen from the above description that the present invention can convert original data into data in a preset format and then store it in a non-relational database based on Key-Value, which can eliminate data structure differences, improve data compatibility and data The efficiency of reading and writing.

300‧‧‧移動終端的資料儲存裝置 300‧‧‧Data storage device for mobile terminal

301‧‧‧第一轉換單元 301‧‧‧The first conversion unit

302‧‧‧中繼資料創建單元 302‧‧‧Metadata Creation Unit

303‧‧‧儲存判斷單元 303‧‧‧Storage Judgment Unit

304‧‧‧資料暫存單元 304‧‧‧Data Temporary Storage Unit

305‧‧‧資料儲存單元 305‧‧‧Data storage unit

306‧‧‧第一讀取單元 306‧‧‧First reading unit

307‧‧‧第二讀取單元 307‧‧‧Second reading unit

308‧‧‧第二轉換單元 308‧‧‧Second conversion unit

圖1是本發明一示例性實施例示出的一種移動終端的資料儲存方法的流程示意圖。 Fig. 1 is a schematic flowchart of a data storage method for a mobile terminal according to an exemplary embodiment of the present invention.

圖2是本發明一示例性實施例示出的一種確定資料庫中是否儲存有第一資料的流程示意圖。 Fig. 2 is a schematic diagram of a process for determining whether the first data is stored in a database according to an exemplary embodiment of the present invention.

圖3是根據一示例性實施例示出的一種移動終端的一結構示意圖。 Fig. 3 is a schematic diagram showing a structure of a mobile terminal according to an exemplary embodiment.

圖4是本發明一示例性實施例示出的一種移動終端的資料儲存裝置的結構示意圖。 FIG. 4 is a schematic structural diagram of a data storage device of a mobile terminal according to an exemplary embodiment of the present invention.

這裡將詳細地對示例性實施例進行說明,其示例表示在圖式中。下面的描述涉及圖式時,除非另有表示,不同 圖式中的相同數字表示相同或相似的要素。以下示例性實施例中所描述的實施方式並不代表與本發明相一致的所有實施方式。相反,它們僅是與如所附申請專利範圍中所詳述的、本發明的一些方面相一致的裝置和方法的例子。 The exemplary embodiments will be described in detail here, and examples thereof are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present invention. On the contrary, they are only examples of devices and methods consistent with some aspects of the present invention as detailed in the scope of the appended application.

在本發明使用的術語是僅僅出於描述特定實施例的目的,而非旨在限制本發明。在本發明和所附申請專利範圍中所使用的單數形式的“一種”、“所述”和“該”也旨在包括多數形式,除非上下文清楚地表示其他含義。還應當理解,本文中使用的術語“和/或”是指並包含一個或多個相關聯的列出項目的任何或所有可能組合。 The terms used in the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms of "a", "said" and "the" used in the scope of the present invention and the appended applications are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and/or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

應當理解,儘管在本發明可能採用術語第一、第二、第三等來描述各種資訊,但這些資訊不應限於這些術語。這些術語僅用來將同一類型的資訊彼此區分開。例如,在不脫離本發明範圍的情況下,第一資訊也可以被稱為第二資訊,類似地,第二資訊也可以被稱為第一資訊。取決於語境,如在此所使用的詞語“如果”可以被解釋成為“在......時”或“當......時”或“回應於確定”。 It should be understood that although the terms first, second, third, etc. may be used in the present invention to describe various information, the information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present invention, the first information can also be referred to as second information, and similarly, the second information can also be referred to as first information. Depending on the context, the word "if" as used herein can be interpreted as "when" or "when" or "in response to certainty".

圖1是本發明一示例性實施例示出的一種移動終端的資料儲存方法的流程示意圖。 Fig. 1 is a schematic flowchart of a data storage method for a mobile terminal according to an exemplary embodiment of the present invention.

請參考圖1,所述資料儲存方法可以應用在移動終端上,所述終端可以包括智慧手機、平板電腦、PDA(Personal Digital Assistant,掌上型電腦)等智慧設備。所述資料儲存方法可以包括以下步驟:步驟101,對原始資料進行格式轉換,以得到預設格 式的第一資料。 Please refer to FIG. 1, the data storage method can be applied to a mobile terminal, and the terminal can include smart devices such as a smart phone, a tablet computer, and a PDA (Personal Digital Assistant, palmtop computer). The data storage method may include the following steps: Step 101: Perform format conversion on the original data to obtain the first data in a preset format.

在本實施例中,所述原始資料為需要儲存在移動終端本地資料庫中的資料,所述原始資料包括各個應用程式需要的快取在本地的新聞、列表、資訊等資料。所述原始資料的格式可能為文本格式、XML格式等。 In this embodiment, the original data is data that needs to be stored in the local database of the mobile terminal, and the original data includes local news, lists, information and other data that each application needs to cache locally. The format of the original data may be text format, XML format, etc.

在本步驟中,移動終端在接收到需要儲存的原始資料後,對所述原始資料進行格式轉換,將其轉換為預設格式的資料,所述預設格式可以由管理人員進行設置,比如:二進位、十進位等。在本發明中,為便於描述,將對原始資料進行格式轉換後得到的資料稱為第一資料。 In this step, after receiving the original data that needs to be stored, the mobile terminal performs format conversion on the original data and converts it into data in a preset format. The preset format can be set by the manager, such as: Binary, decimal, etc. In the present invention, for ease of description, the data obtained after format conversion of the original data is called the first data.

步驟102,創建所述第一資料的第一中繼資料。 Step 102: Create a first metadata of the first data.

基於前述步驟101,移動終端在將所述原始資料轉換為第一資料後,創建所述第一資料的中繼資料,在本發明中,將創建的所述第一資料的中繼資料稱為第一中繼資料。 Based on the foregoing step 101, the mobile terminal creates the metadata of the first material after converting the original material into the first material. In the present invention, the created metadata of the first material is called The first metadata.

步驟103,根據快取中保存的鍵值與中繼資料的對應關係判斷資料庫中是否儲存有所述第一資料,如果資料庫中沒有儲存所述第一資料,則執行步驟104。 Step 103: Determine whether the first data is stored in the database according to the corresponding relationship between the key value stored in the cache and the metadata. If the first data is not stored in the database, perform step 104.

在本實施例中,為提高讀寫效率,可以採用基於Key-Value進行儲存的非關係型資料庫作為移動終端的底層儲存媒體,所述非關係型資料庫中包括有每條原始資料格式轉換後的第一資料、第一中繼資料以及鍵值(Key)。移動終端的快取中保存有所述非關係型資料庫中每條第一中繼資料及其鍵值的對應關係。在本實施例 中,為便於區分,將快取中保存的所述第一中繼資料稱為第二中繼資料。具體地,移動終端可以在重新開機後,將所述非關係型資料庫(以下簡稱:資料庫)中每條第一中繼資料及其鍵值的對應關係保存到快取,比如:記憶體。移動終端也可以在接收到需要儲存在資料庫中的原始資料後,如果確定資料庫中沒有儲存有進行格式轉換後的所述原始資料,即資料庫中沒有儲存所述原始資料的第一資料時,將所述原始資料對應的第一中繼資料及其鍵值保存到快取,其具體的實現流程可以詳見後續的描述。 In this embodiment, in order to improve the efficiency of reading and writing, a non-relational database based on Key-Value storage can be used as the underlying storage medium of the mobile terminal. The non-relational database includes the format conversion of each original data. After the first data, the first metadata and the key value (Key). The cache of the mobile terminal stores the corresponding relationship between each piece of first metadata and its key value in the non-relational database. In this embodiment, to facilitate distinction, the first metadata stored in the cache is called the second metadata. Specifically, the mobile terminal may save the corresponding relationship between each piece of first metadata and its key value in the non-relational database (hereinafter referred to as the database) to the cache after restarting, such as: memory . The mobile terminal can also, after receiving the original data that needs to be stored in the database, if it is determined that the original data after format conversion is not stored in the database, that is, the first data of the original data is not stored in the database. At the time, the first metadata and its key value corresponding to the original data are saved to the cache, and the specific implementation process can be detailed in the subsequent description.

在本步驟中,移動終端可以根據所述第一資料的鍵值以及快取中保存的所述鍵值與中繼資料的對應關係判斷資料庫中是否已經儲存有所述第一資料。其中,所述第一資料的鍵值也就是所述原始資料的鍵值。 In this step, the mobile terminal can determine whether the first data is already stored in the database according to the key value of the first data and the corresponding relationship between the key value and the metadata stored in the cache. Wherein, the key value of the first data is also the key value of the original data.

請參考圖2,在本發明一可選的實施方式中,確定資料中是否儲存有第一資料可以包括以下步驟:步驟1031,根據第一資料的鍵值判斷快取中是否保存有所述鍵值對應的第二中繼資料。如果快取中保存有所述鍵值對應的第二中繼資料,則執行步驟1032,如果快取中沒有保存所述鍵值對應的第二中繼資料,則執行步驟1033。 Please refer to FIG. 2, in an alternative embodiment of the present invention, determining whether the first data is stored in the data may include the following steps: Step 1031, determining whether the key is stored in the cache according to the key value of the first data The second metadata corresponding to the value. If the second metadata corresponding to the key value is saved in the cache, step 1032 is executed, and if the second metadata corresponding to the key value is not saved in the cache, step 1033 is executed.

步驟1032,判斷所述第二中繼資料與所述第一中繼資料是否相同。如果所述第二中繼資料與所述第一中繼資料不相同,則執行步驟1033,如果所述第二中繼資料與所述第一中繼資料相同,則執行步驟1034。 Step 1032: Determine whether the second metadata is the same as the first metadata. If the second metadata is different from the first metadata, step 1033 is executed, and if the second metadata is the same as the first metadata, step 1034 is executed.

基於前述步驟1031的判斷結果,如果快取中保存有所述鍵值對應的第二中繼資料,則說明底層的資料庫中保存有所述鍵值對應的第一資料,但是無法得知該第一資料是否為最新版本的第一資料,所以在本步驟中,可以判斷所述第二中繼資料與創建的第一中繼資料是否相同。 Based on the judgment result of the aforementioned step 1031, if the second metadata corresponding to the key value is stored in the cache, it means that the first data corresponding to the key value is stored in the underlying database, but it cannot be known. Whether the first data is the latest version of the first data, so in this step, it can be determined whether the second metadata is the same as the created first metadata.

在本實施例中,可以透過比對所述第二中繼資料與所述第一中繼資料的每個位元組以判斷所述第二中繼資料與所述第一中繼資料是否相同。可選的,還可以透過判斷所述第二中繼資料的雜湊值與所述第一中繼資料的雜湊值是否相同以判斷所述第二中繼資料與所述第一中繼資料是否相同。具體地,所述第二中繼資料中包括有資料庫中儲存的對應第一資料的雜湊值,在本步驟中,可以根據前述步驟101中轉換後的第一資料計算所述第一資料的雜湊值,以將該雜湊值作為所述第一中繼資料的雜湊值,然後比較計算得到的該雜湊值與所述第二中繼資料中包含的雜湊值是否相同,如果不相同,則確定所述第二中繼資料與所述第一中繼資料不相同,執行步驟1033;如果相同,則確定所述第二中繼資料與所述第一中繼資料相同,執行步驟1034。 In this embodiment, it is possible to determine whether the second metadata is the same as the first metadata by comparing each byte of the second metadata with the first metadata . Optionally, it is also possible to determine whether the second metadata is the same as the first metadata by determining whether the hash value of the second metadata is the same as the hash value of the first metadata . Specifically, the second metadata includes the hash value corresponding to the first data stored in the database. In this step, the first data converted in step 101 can be used to calculate the hash value of the first data. The hash value is used as the hash value of the first metadata, and then the calculated hash value is compared with the hash value contained in the second metadata. If they are not the same, it is determined If the second metadata is different from the first metadata, step 1033 is executed; if they are the same, it is determined that the second metadata is the same as the first metadata, and step 1034 is executed.

步驟1033,確定資料庫中沒有儲存所述第一資料。 Step 1033: Determine that the first data is not stored in the database.

在本實施例中,基於前述步驟1031的判斷結果,如果快取中沒有保存所述鍵值對應的第二中繼資料,則可以確定資料庫中沒有儲存所述第一資料。 In this embodiment, based on the judgment result of the foregoing step 1031, if the second metadata corresponding to the key value is not stored in the cache, it can be determined that the first data is not stored in the database.

基於前述步驟1032的判斷結果,如果所述第二中繼 資料與所述第一中繼資料不相同,則說明資料庫中儲存有相同鍵值的第一資料,但是該第一資料與前述步驟101中轉換得到的第一資料不相同,所以導致二者的中繼資料不相同,這可能是因為資料中儲存的所述第一資料不是最新的資料,需要進行更新,所以此時也可以確定資料庫中沒有儲存前述步驟101中轉換得到的所述第一資料。 Based on the judgment result of the foregoing step 1032, if the second metadata is not the same as the first metadata, it means that the first data with the same key value is stored in the database, but the first data is the same as the previous step The first data converted in 101 is not the same, so the metadata of the two are different. This may be because the first data stored in the data is not the latest data and needs to be updated, so it can also be determined at this time The first data converted in step 101 is not stored in the database.

步驟1034,確定資料庫中已經儲存所述第一資料。 Step 1034: Determine that the first data has been stored in the database.

基於前述步驟1032的判斷結果,如果所述第二中繼資料與所述第一中繼資料相同,則說明資料庫中儲存有相同鍵值的第一資料,並且該第一資料與前述步驟101中轉換得到的第一資料相同,此時不需要進行更新。移動終端可以刪除前述步驟101中接收到的所述原始資料、轉換後的第一資料以及前述步驟102中創建的所述第一中繼資料。 Based on the judgment result of the aforementioned step 1032, if the second metadata is the same as the first metadata, it means that the first data with the same key value is stored in the database, and the first data is the same as the aforementioned step 101 The first data obtained by the conversion is the same, and no update is required at this time. The mobile terminal may delete the original data received in the foregoing step 101, the converted first data, and the first metadata created in the foregoing step 102.

在本實施例中,可以根據快取中保存的鍵值與中繼資料的對應關係確認資料庫中是否已儲存有接收到的原始資料,大大減少訪問資料庫所帶來的系統消耗。 In this embodiment, it is possible to confirm whether the received original data has been stored in the database according to the correspondence between the key value stored in the cache and the metadata, which greatly reduces the system consumption caused by accessing the database.

步驟104,將所述第一資料、所述第一資料的第一中繼資料以及所述第一資料的鍵值保存到快取中。 Step 104: Save the first data, the first metadata of the first data, and the key value of the first data in the cache.

基於前述步驟103的判斷結果,如果資料庫中沒有儲存所述第一資料,則需要將所述第一資料儲存到資料庫中。在本實施例中,可以先將所述第一資料、所述第一資料的第一中繼資料以及所述第一資料的鍵值保存到快取中。 Based on the judgment result of the foregoing step 103, if the first data is not stored in the database, the first data needs to be stored in the database. In this embodiment, the first data, the first metadata of the first data, and the key value of the first data may be stored in the cache first.

針對前述步驟103中資料庫中沒有儲存所述第一資料的兩種情況,在本步驟中可以採用以下兩種實現方式:方式一,快取中沒有保存第一資料的鍵值對應的第二中繼資料。在這種情況下,說明資料庫中沒有儲存有步驟101中接收到的原始資料的第一資料,則移動終端可以先將所述第一資料、所述第一資料的第一中繼資料以及所述第一資料的鍵值保存到快取中,並將其標注為未儲存。其中,移動終端可以為所述第一資料、所述第一資料的第一中繼資料以及所述第一資料的鍵值這一整條資料設置用於標注儲存狀態的標識位元,比如:標識位元為0表示未儲存,標識位元為1表示已儲存。移動終端也可以設置一個鍵值列表,將未儲存到資料中的第一資料的鍵值儲存到該鍵值列表中,當然,本領域技術人員也可以採用其他方式標注快取中保存的資料是否已儲存到資料庫中,本發明對此不作特殊限制。 In view of the two cases where the first data is not stored in the database in step 103, the following two implementation methods can be used in this step: Method one, the second data corresponding to the key value of the first data is not stored in the cache. Metadata. In this case, it is stated that the first data of the original data received in step 101 is not stored in the database, then the mobile terminal can firstly store the first data, the first metadata of the first data, and The key value of the first data is saved in the cache and marked as unsaved. Wherein, the mobile terminal may set an identification bit for marking the storage state for the entire data of the first data, the first metadata of the first data, and the key value of the first data, such as: If the flag bit is 0, it means it is not stored, and the flag bit is 1 it means it has been stored. The mobile terminal can also set a key value list, and store the key value of the first data that is not stored in the data in the key value list. Of course, those skilled in the art can also use other methods to mark whether the data stored in the cache is It has been stored in the database, and the present invention does not impose special restrictions on this.

方式二,快取中保存有第一資料的鍵值對應的第二中繼資料,但是所述第二中繼資料與所述第一資料的第一中繼資料不相同。在這種情況下,說明資料庫中儲存有相同鍵值的第一資料,但是該第一資料不是最新的第一資料,需要進行更新。移動終端可以將快取中保存第一資料的鍵值對應的第二中繼資料更新為所述第一中繼資料,並保存所述第一資料,以使得針對一個鍵值,快取中保存有一個最新的中繼資料。此外,與方式一相同,在這種方式中,也會將更新後的這條資料標注為未儲存。 Manner 2: The second metadata corresponding to the key value of the first data is stored in the cache, but the second metadata is different from the first metadata of the first data. In this case, it means that the first data with the same key value is stored in the database, but the first data is not the latest first data and needs to be updated. The mobile terminal may update the second metadata corresponding to the key value of the first data stored in the cache to the first metadata, and save the first data, so that for a key value, save in the cache There is an up-to-date metadata. In addition, as with method 1, in this method, the updated data will also be marked as unsaved.

步驟105,在滿足預設的觸發條件時,將快取中尚未儲存到資料庫中的第一資料、第一資料的第一中繼資料以及第一資料的鍵值保存到資料庫中。 Step 105: When a preset trigger condition is met, save the first data in the cache, the first metadata of the first data, and the key value of the first data that have not been stored in the database in the database.

在本實施例中,移動終端可以在滿足預設的觸發條件時,將快取中尚未儲存到資料庫中的第一資料、第一資料的第一中繼資料以及第一資料的鍵值保存到資料庫中,也就是將快取中標注為未儲存的資料儲存到資料庫中。 In this embodiment, the mobile terminal can save the first data in the cache, the first metadata of the first data, and the key value of the first data that have not been stored in the database when the preset trigger condition is satisfied. To the database, that is, to save the data marked as unsaved in the cache to the database.

在本實施例中,所述觸發條件可以由管理人員進行設置,比如:所述觸發條件可以是到達預設的時間週期,所述觸發條件也可以是快取的資料量達到預設的閾值,本發明對此不作特殊限制。 In this embodiment, the trigger condition can be set by an administrator. For example, the trigger condition can be a preset time period, and the trigger condition can also be that the amount of cached data reaches a preset threshold. The present invention does not impose special restrictions on this.

由以上描述可以看出,本發明可以將原始資料轉換為預設格式的資料後儲存到基於Key-Value的非關係型資料庫中,能夠消除資料的結構差異,提高資料的相容性以及資料讀寫的效率。 It can be seen from the above description that the present invention can convert original data into data in a preset format and then store it in a non-relational database based on Key-Value, which can eliminate data structure differences, improve data compatibility and data The efficiency of reading and writing.

在本發明另一實施例中,移動終端還可以將讀頻率較高的第一資料儲存到快取中,以提高讀效率。因此,移動終端在接收到資料讀取指令時,可以根據讀取命令中攜帶的鍵值先在快取中查找是否保存有對應的第一資料,當快取中保存有對應的第一資料時,可以將快取中的第一資料進行相反的格式轉換,轉換為原始資料後回傳讀取結果。當快取中沒有保存所述鍵值對應的第一資料時,可以先查找快取中保存的所述鍵值對應的中繼資料(第二中繼資料),然後根據該中繼資料從資料庫中獲取所述鍵值對應 的第一資料,然後將獲取到的第一資料進行相反的格式轉換,轉換為原始資料後回傳讀取結果。 In another embodiment of the present invention, the mobile terminal can also store the first data with a higher reading frequency in the cache to improve reading efficiency. Therefore, when the mobile terminal receives the data read instruction, it can first search the cache according to the key value carried in the read command to find out whether the corresponding first data is stored, and when the corresponding first data is stored in the cache , The first data in the cache can be converted to the opposite format, converted to the original data, and the read result will be returned. When the first data corresponding to the key value is not saved in the cache, the metadata corresponding to the key value stored in the cache (second metadata) can be searched first, and then the data can be retrieved from the data according to the metadata. The first data corresponding to the key value is acquired from the library, and then the acquired first data is converted in the opposite format, converted into original data, and the read result is returned.

在本發明另一實施例中,移動終端在滿足預設的條件時刪除快取中保存的第一資料,比如:可以定期刪除快取中保存的第一資料,也可以在第一資料的讀頻率小於閾值時刪除快取中保存的所述第一資料,本發明對此不作特殊限制。 In another embodiment of the present invention, the mobile terminal deletes the first data stored in the cache when a preset condition is met. For example, the first data stored in the cache can be deleted periodically, or the first data can be read in the cache. When the frequency is less than the threshold, the first data stored in the cache is deleted, and the present invention does not impose special restrictions on this.

此外,依據相關技術,本發明提供的資料儲存方案還可以支援加密儲存,比如:移動終端在將原始資料轉換為預設格式的第一資料後,可以對所述第一資料進行加密處理後儲存。相應的,移動終端在讀取到第一資料後,對所述第一資料進行解密處理,然後再轉換為原始資料回傳讀取結果。 In addition, according to related technologies, the data storage solution provided by the present invention can also support encrypted storage. For example, after the mobile terminal converts the original data into the first data in the preset format, the first data can be encrypted and stored. . Correspondingly, after the mobile terminal reads the first data, it decrypts the first data, and then converts it to the original data to return the reading result.

與前述移動終端的資料儲存方法的實施例相對應,本發明還提供了移動終端的資料儲存裝置的實施例。 Corresponding to the foregoing embodiment of the data storage method of the mobile terminal, the present invention also provides an embodiment of the data storage device of the mobile terminal.

本發明移動終端的資料儲存裝置的實施例可以應用在移動終端上。裝置實施例可以透過軟體實現,也可以透過硬體或者軟硬體結合的方式實現。以軟體實現為例,作為一個邏輯意義上的裝置,是透過其所在移動終端的處理器將非易失性記憶體中對應的電腦程式指令讀取到記憶體中運行形成的。從硬體層面而言,如圖3所示,為本發明資料儲存裝置所在移動終端的一種硬體結構圖,除了圖3所示的處理器、記憶體、網路介面、以及非易失性記憶體之外,實施例中裝置所在的移動終端通常根據該移動終端的 實際功能,還可以包括其他硬體,對此不再贅述。 The embodiment of the data storage device of the mobile terminal of the present invention can be applied to the mobile terminal. The device embodiments can be implemented through software, or through hardware or a combination of software and hardware. Taking software implementation as an example, as a logical device, it is formed by reading the corresponding computer program instructions in the non-volatile memory into the memory through the processor of the mobile terminal where it is located. From the perspective of hardware, as shown in FIG. 3, it is a hardware structure diagram of the mobile terminal where the data storage device of the present invention is located, except for the processor, memory, network interface, and non-volatile memory shown in FIG. 3 In addition to the memory, the mobile terminal where the device is located in the embodiment may also include other hardware according to the actual functions of the mobile terminal, which will not be repeated here.

請參考圖4是本發明一示例性實施例示出的一種移動終端的資料儲存裝置的結構示意圖。 Please refer to FIG. 4 for a schematic structural diagram of a data storage device of a mobile terminal according to an exemplary embodiment of the present invention.

請參考圖4,所述移動終端的資料儲存裝置300可以包括:第一轉換單元301、中繼資料創建單元302、儲存判斷單元303、資料暫存單元304、資料儲存單元305、第一讀取單元306、第二讀取單元307以及第二轉換單元308。 4, the data storage device 300 of the mobile terminal may include: a first conversion unit 301, a metadata creation unit 302, a storage judgment unit 303, a data temporary storage unit 304, a data storage unit 305, and a first read The unit 306, the second reading unit 307, and the second conversion unit 308.

其中,所述第一轉換單元301,對原始資料進行格式轉換,以得到預設格式的第一資料;所述中繼資料創建單元302,創建所述第一資料的第一中繼資料;所述儲存判斷單元303,根據快取中保存的鍵值與中繼資料的對應關係判斷資料庫中是否儲存有所述第一資料;所述資料暫存單元304,在資料庫中沒有儲存所述第一資料時,將所述第一資料、所述第一資料的第一中繼資料以及所述第一資料的鍵值保存到快取中;所述資料儲存單元305,在滿足預設的觸發條件時,將快取中尚未儲存到資料庫中的第一資料、第一資料的第一中繼資料以及第一資料的鍵值保存到資料庫中。 Wherein, the first conversion unit 301 performs format conversion on the original data to obtain first data in a preset format; the metadata creation unit 302 creates the first metadata of the first data; The storage judging unit 303 judges whether the first data is stored in the database according to the correspondence between the key value stored in the cache and the metadata; the data temporary storage unit 304 does not store the first data in the database In the case of the first data, the first data, the first metadata of the first data, and the key value of the first data are stored in the cache; the data storage unit 305 meets the preset requirements When the condition is triggered, the first data in the cache, the first metadata of the first data, and the key value of the first data that have not been stored in the database are saved in the database.

可選的,所述儲存判斷單元303,具體根據所述第一資料的鍵值判斷快取中是否保存有所述鍵值對應的第二中繼資料,如果快取中沒有保存所述鍵值對應的第二中繼資 料,則確定資料庫中沒有儲存所述第一資料。 Optionally, the storage judging unit 303 specifically judges whether the second metadata corresponding to the key value is stored in the cache according to the key value of the first data, and if the key value is not stored in the cache Corresponding to the second metadata, it is determined that the first data is not stored in the database.

可選的,所述儲存判斷單元303,具體在快取中保存有所述鍵值對應的第二中繼資料時,判斷所述第二中繼資料與所述第一中繼資料是否相同,如果所述第二中繼資料與所述第一中繼資料不相同,則確定資料庫中沒有儲存所述第一資料;所述資料暫存單元304,具體將快取中保存所述第一資料的鍵值對應的第二中繼資料更新為所述第一中繼資料,並保存所述第一資料。 Optionally, the storage determining unit 303, specifically, when the second metadata corresponding to the key value is stored in the cache, determines whether the second metadata is the same as the first metadata, If the second metadata is different from the first metadata, it is determined that the first data is not stored in the database; the data temporary storage unit 304 specifically stores the first data in the cache. The second metadata corresponding to the key value of the data is updated to the first metadata, and the first data is saved.

可選的,所述儲存判斷單元303,具體判斷所述第二中繼資料的雜湊值與所述第一中繼資料的雜湊值是否相同,如果相同,則確認所述第二中繼資料與所述第一中繼資料相同;如果不相同,則確認所述第二中繼資料與所述第一中繼資料不相同。 Optionally, the storage determining unit 303 specifically determines whether the hash value of the second metadata is the same as the hash value of the first metadata, and if they are the same, confirms that the second metadata and The first metadata is the same; if they are not the same, it is confirmed that the second metadata is different from the first metadata.

可選的,所述預設的觸發條件包括:到達預設的時間週期以及快取的資料量達到預設的閾值。 Optionally, the preset trigger condition includes: reaching a preset time period and the amount of cached data reaching a preset threshold.

所述第一讀取單元306,在讀取資料時,根據鍵值在快取中查找是否保存有對應的第一資料;所述第二讀取單元307,當快取中沒有保存所述鍵值對應的第一資料時,根據快取中保存的所述鍵值對應的中繼資料從資料庫中獲取所述鍵值對應的第一資料;所述第二轉換單元308,將所述第一資料轉換為原始資料後回傳讀取結果。 The first reading unit 306 searches for the corresponding first data in the cache according to the key value when reading the data; the second reading unit 307, when the key is not saved in the cache Value corresponding to the first data, the first data corresponding to the key value is obtained from the database according to the metadata corresponding to the key value stored in the cache; the second conversion unit 308 converts the first data One data is converted into original data and the read result is returned.

上述裝置中各個單元的功能和作用的實現過程具體詳 見上述方法中對應步驟的實現過程,在此不再贅述。 For the implementation process of the functions and roles of each unit in the above-mentioned device, please refer to the implementation process of the corresponding steps in the above-mentioned method for details, which will not be repeated here.

對於裝置實施例而言,由於其基本對應於方法實施例,所以相關之處參見方法實施例的部分說明即可。以上所描述的裝置實施例僅僅是示意性的,其中所述作為分離部件說明的單元可以是或者也可以不是物理上分開的,作為單元顯示的部件可以是或者也可以不是物理單元,即可以位於一個地方,或者也可以分佈到多個網路單元上。可以根據實際的需要選擇其中的部分或者全部模組來實現本發明方案的目的。本領域普通技術人員在不付出創造性勞動的情況下,即可以理解並實施。 For the device embodiment, since it basically corresponds to the method embodiment, the relevant part can refer to the part of the description of the method embodiment. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solution of the present invention. Those of ordinary skill in the art can understand and implement it without creative work.

以上所述僅為本發明的較佳實施例而已,並不用以限制本發明,凡在本發明的精神和原則之內,所做的任何修改、等同替換、改進等,均應包含在本發明保護的範圍之內。 The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the present invention Within the scope of protection.

Claims (10)

一種移動終端的資料儲存方法,其中,該方法包括:對原始資料進行格式轉換,以得到預設格式的第一資料;創建該第一資料的第一中繼資料;根據快取中保存的鍵值與中繼資料的對應關係判斷資料庫中是否儲存有該第一資料;如果資料庫中沒有儲存該第一資料,則將該第一資料、該第一資料的第一中繼資料以及該第一資料的鍵值保存到快取中;在滿足預設的觸發條件時,將快取中尚未儲存到資料庫中的第一資料、第一資料的第一中繼資料以及第一資料的鍵值保存到資料庫中;該根據快取中保存的鍵值與中繼資料的對應關係判斷資料庫中是否儲存有該第一資料,包括:根據該第一資料的鍵值判斷快取中是否保存有該鍵值對應的第二中繼資料;如果快取中保存有該鍵值對應的第二中繼資料,則判斷該第二中繼資料與該第一中繼資料是否相同;如果該第二中繼資料與該第一中繼資料不相同,則確定資料庫中沒有儲存該第一資料;該將該第一資料、該第一資料的第一中繼資料以及該第一資料的鍵值保存到快取中,包括: 將快取中保存該第一資料的鍵值對應的第二中繼資料更新為該第一中繼資料,並保存該第一資料。 A data storage method for a mobile terminal, wherein the method includes: format conversion of original data to obtain first data in a preset format; creating a first metadata of the first data; according to the key saved in the cache The corresponding relationship between the value and the metadata determines whether the first data is stored in the database; if the first data is not stored in the database, then the first data, the first metadata of the first data, and the The key value of the first data is saved in the cache; when the preset trigger condition is met, the first data in the cache, the first metadata of the first data, and the first data that have not been stored in the database The key value is saved in the database; the judgment of whether the first data is stored in the database according to the corresponding relationship between the key value saved in the cache and the metadata includes: judging whether the first data is in the cache according to the key value of the first data Whether the second metadata corresponding to the key value is saved; if the second metadata corresponding to the key value is saved in the cache, determine whether the second metadata is the same as the first metadata; if If the second metadata is different from the first metadata, it is determined that the first data is not stored in the database; the first data, the first metadata of the first data, and the first data The key value of is saved to the cache, including: The second metadata corresponding to the key value storing the first data in the cache is updated to the first metadata, and the first data is saved. 根據申請專利範圍第1項所述的方法,其中,還包括:如果快取中沒有保存該鍵值對應的第二中繼資料,則確定資料庫中沒有儲存該第一資料。 The method according to item 1 of the scope of patent application, further comprising: if the second metadata corresponding to the key value is not stored in the cache, determining that the first data is not stored in the database. 根據申請專利範圍第1項所述的方法,其中,該判斷該第二中繼資料與該第一中繼資料是否相同,包括:判斷該第二中繼資料的雜湊值與該第一中繼資料的雜湊值是否相同,如果相同,則確認該第二中繼資料與該第一中繼資料相同;如果不相同,則確認該第二中繼資料與該第一中繼資料不相同。 The method according to item 1 of the scope of patent application, wherein the determining whether the second metadata is the same as the first metadata includes: determining whether the hash value of the second metadata is the same as that of the first metadata Whether the hash values of the data are the same, if they are the same, confirm that the second metadata is the same as the first metadata; if they are not the same, then confirm that the second metadata is different from the first metadata. 根據申請專利範圍第1項所述的方法,其中,該預設的觸發條件包括:到達預設的時間週期以及快取的資料量達到預設的閾值。 The method according to item 1 of the scope of patent application, wherein the preset trigger condition includes: reaching a preset time period and the amount of cached data reaching a preset threshold. 根據申請專利範圍第1項所述的方法,其中,該方法還包括:在讀取資料時,根據鍵值在快取中查找是否保存有對應的第一資料;當快取中沒有保存該鍵值對應的第一資料時,根據快取中保存的該鍵值對應的中繼資料從資料庫中獲取該鍵值對應的第一資料;將該第一資料轉換為原始資料後回傳讀取結果。 The method according to item 1 of the scope of patent application, wherein the method further includes: when reading the data, according to the key value in the cache to find whether the corresponding first data is saved; when the key is not saved in the cache When the value corresponds to the first data, the first data corresponding to the key value is obtained from the database according to the metadata corresponding to the key value stored in the cache; the first data is converted into original data and then sent back to read result. 一種移動終端的資料儲存裝置,其中,該裝置包 括:第一轉換單元,對原始資料進行格式轉換,以得到預設格式的第一資料;中繼資料創建單元,創建該第一資料的第一中繼資料;儲存判斷單元,根據快取中保存的鍵值與中繼資料的對應關係判斷資料庫中是否儲存有該第一資料;資料暫存單元,在資料庫中沒有儲存該第一資料時,將該第一資料、該第一資料的第一中繼資料以及該第一資料的鍵值保存到快取中;資料儲存單元,在滿足預設的觸發條件時,將快取中尚未儲存到資料庫中的第一資料、第一資料的第一中繼資料以及第一資料的鍵值保存到資料庫中;該儲存判斷單元,具體根據該第一資料的鍵值判斷快取中是否保存有該鍵值對應的第二中繼資料,在快取中保存有該鍵值對應的第二中繼資料時,判斷該第二中繼資料與該第一中繼資料是否相同,如果該第二中繼資料與該第一中繼資料不相同,則確定資料庫中沒有儲存該第一資料;該資料暫存單元,具體將快取中保存該第一資料的鍵值對應的第二中繼資料更新為該第一中繼資料,並保存該第一資料。 A data storage device for a mobile terminal, wherein the device package Including: the first conversion unit, which converts the format of the original data to obtain the first data in the preset format; the metadata creation unit, which creates the first metadata of the first data; the storage judgment unit, according to the cache The corresponding relationship between the saved key value and the metadata determines whether the first data is stored in the database; the data temporary storage unit, when the first data is not stored in the database, the first data and the first data The first metadata and the key value of the first data are stored in the cache; the data storage unit, when the preset trigger condition is met, will retrieve the first data and the first data that have not been stored in the database. The first metadata of the data and the key value of the first data are stored in the database; the storage judgment unit specifically judges whether the second relay corresponding to the key value is stored in the cache according to the key value of the first data Data, when the second metadata corresponding to the key value is stored in the cache, it is determined whether the second metadata is the same as the first metadata, and if the second metadata is the same as the first metadata If the data is not the same, it is determined that the first data is not stored in the database; the data temporary storage unit specifically updates the second metadata corresponding to the key value of the first data stored in the cache to the first metadata , And save the first information. 根據申請專利範圍第6項所述的裝置,其中,該儲存判斷單元,在快取中沒有保存該鍵值對應的第 二中繼資料,則確定資料庫中沒有儲存該第一資料。 The device according to item 6 of the scope of patent application, wherein the storage judgment unit does not store the key corresponding to the key in the cache. Second, it is determined that the first data is not stored in the database. 根據申請專利範圍第6項所述的裝置,其中,該儲存判斷單元,具體判斷該第二中繼資料的雜湊值與該第一中繼資料的雜湊值是否相同,如果相同,則確認該第二中繼資料與該第一中繼資料相同;如果不相同,則確認該第二中繼資料與該第一中繼資料不相同。 The device according to item 6 of the scope of patent application, wherein the storage determination unit specifically determines whether the hash value of the second metadata is the same as the hash value of the first metadata, and if they are the same, confirms the first metadata. The second metadata is the same as the first metadata; if they are not the same, it is confirmed that the second metadata is different from the first metadata. 根據申請專利範圍第6項所述的裝置,其中,該預設的觸發條件包括:到達預設的時間週期以及快取的資料量達到預設的閾值。 The device according to item 6 of the scope of patent application, wherein the preset trigger condition includes: reaching a preset time period and the amount of cached data reaching a preset threshold. 根據申請專利範圍第6項所述的裝置,其中,該裝置還包括:第一讀取單元,在讀取資料時,根據鍵值在快取中查找是否保存有對應的第一資料;第二讀取單元,當快取中沒有保存該鍵值對應的第一資料時,根據快取中保存的該鍵值對應的中繼資料從資料庫中獲取該鍵值對應的第一資料;第二轉換單元,將該第一資料轉換為原始資料後回傳讀取結果。 The device according to item 6 of the scope of patent application, wherein the device further includes: a first reading unit, when reading data, searches the cache according to the key value to find whether the corresponding first data is stored; second The reading unit, when the first data corresponding to the key value is not stored in the cache, obtain the first data corresponding to the key value from the database according to the metadata corresponding to the key value stored in the cache; The conversion unit converts the first data into original data and then returns the read result.
TW106101932A 2017-01-19 2017-01-19 Data storage method and device of mobile terminal TWI709041B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW106101932A TWI709041B (en) 2017-01-19 2017-01-19 Data storage method and device of mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW106101932A TWI709041B (en) 2017-01-19 2017-01-19 Data storage method and device of mobile terminal

Publications (2)

Publication Number Publication Date
TW201828064A TW201828064A (en) 2018-08-01
TWI709041B true TWI709041B (en) 2020-11-01

Family

ID=63960492

Family Applications (1)

Application Number Title Priority Date Filing Date
TW106101932A TWI709041B (en) 2017-01-19 2017-01-19 Data storage method and device of mobile terminal

Country Status (1)

Country Link
TW (1) TWI709041B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102999522A (en) * 2011-09-15 2013-03-27 阿里巴巴集团控股有限公司 Data storage method and device
US20130179423A1 (en) * 2012-01-05 2013-07-11 Sri International Computer-generated sentiment-based knowledge base
US20140040286A1 (en) * 2012-06-18 2014-02-06 Maldivica Inc. Method and system for the normalization, filtering and securing of associated metadata information on file objects deposited into an object store
CN104462127A (en) * 2013-09-22 2015-03-25 阿里巴巴集团控股有限公司 Recorded data updating method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102999522A (en) * 2011-09-15 2013-03-27 阿里巴巴集团控股有限公司 Data storage method and device
US20130179423A1 (en) * 2012-01-05 2013-07-11 Sri International Computer-generated sentiment-based knowledge base
US20140040286A1 (en) * 2012-06-18 2014-02-06 Maldivica Inc. Method and system for the normalization, filtering and securing of associated metadata information on file objects deposited into an object store
CN104462127A (en) * 2013-09-22 2015-03-25 阿里巴巴集团控股有限公司 Recorded data updating method and device

Also Published As

Publication number Publication date
TW201828064A (en) 2018-08-01

Similar Documents

Publication Publication Date Title
CN108319654B (en) Computing system, cold and hot data separation method and device, and computer readable storage medium
US8886598B1 (en) Tag-based synchronization
US9166866B2 (en) Hydration and dehydration with placeholders
US20160188749A1 (en) Feed Data Storage and Query
US6976038B2 (en) Method and apparatus for real time creation and modification of a change log for multi-server synchronization
US10824612B2 (en) Key ticketing system with lock-free concurrency and versioning
US20100223240A1 (en) System and method for composite record keys ordered in a flat key space for a distributed database
WO2017166815A1 (en) Data updating method and device for a distributed database system
WO2019062572A1 (en) Data processing method, device and system
CN110989937B (en) Data storage method, device and equipment and computer readable storage medium
WO2014088973A2 (en) Database scale-out
WO2017032240A1 (en) Data storage method and apparatus for mobile terminal
CN103226592A (en) Database-based file system and file storage method
WO2017177752A1 (en) File storage method and device
CN112559913A (en) Data processing method and device, computing equipment and readable storage medium
TWI709041B (en) Data storage method and device of mobile terminal
CN116303267A (en) Data access method, device, equipment and storage medium
KR102280443B1 (en) Cloud database system with multi-cash for reducing network cost in processing select query
US20130332698A1 (en) Data preservation method
US10037155B2 (en) Preventing write amplification during frequent data updates
CN117076413B (en) Object multi-version storage system supporting multi-protocol intercommunication
JP2007156844A (en) Data registration/retrieval system and data registration/retrieval method
KR20070097660A (en) Method for managing multimedia files though using the structured query language in a mobile communication terminal
CN111444179A (en) Data processing method, data processing device, storage medium and server
CN114647630A (en) File synchronization method, information generation method, file synchronization device, information generation device, computer equipment and storage medium