CN110201393A - Configuration data storage method and device and electronic equipment - Google Patents
Configuration data storage method and device and electronic equipment Download PDFInfo
- Publication number
- CN110201393A CN110201393A CN201910457135.3A CN201910457135A CN110201393A CN 110201393 A CN110201393 A CN 110201393A CN 201910457135 A CN201910457135 A CN 201910457135A CN 110201393 A CN110201393 A CN 110201393A
- Authority
- CN
- China
- Prior art keywords
- array object
- index
- configuration
- memory
- configuration data
- 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
- 238000000034 method Methods 0.000 title claims abstract description 65
- 238000013500 data storage Methods 0.000 title description 3
- 238000004891 communication Methods 0.000 claims description 34
- 238000004590 computer program Methods 0.000 claims description 22
- 239000000284 extract Substances 0.000 claims description 12
- 238000012545 processing Methods 0.000 claims description 6
- 238000000605 extraction Methods 0.000 claims description 3
- 239000008280 blood Substances 0.000 description 21
- 210000004369 blood Anatomy 0.000 description 21
- 241001269238 Data Species 0.000 description 6
- 238000010586 diagram Methods 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 241000406668 Loxodonta cyclotis Species 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000010252 digital analysis Methods 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Classifications
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/55—Controlling game characters or game objects based on the game progress
- A63F13/56—Computing the motion of game characters with respect to other game characters, game objects or elements of the game scene, e.g. for simulating the behaviour of a group of virtual soldiers or for path finding
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/60—Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention provides a method and a device for storing configuration data and electronic equipment, wherein the method comprises the following steps: the method comprises the steps of obtaining a configuration file, recording configuration data of a configuration object in the configuration file, loading the configuration file into a memory, generating an array object based on the configuration data of the configuration object, distributing an index identifier for the array object, and performing associated storage on the array object and the index identifier in the memory.
Description
Technical field
The present invention relates to technical field of data storage, more particularly to a kind of storage method of configuration data, device and electricity
Sub- equipment.
Background technique
Indispensable data when configuration data is normal program operation, for example, for games, configuration data
It may include game role data such as corresponding original blood volume and original aggressor power in different brackets in game.
Program during use, if necessary to obtain configuration data, needs first to load configuration data into memory,
It goes to obtain the configuration data being stored in memory again.It in the prior art, is all with array pair after configuration data is loaded into memory
As the form of set is stored, wherein the form of array object set is character string forms, such as: game ratings
The information recorded in configuration file are as follows: the initial blood volume of grade 1 is 1, armor 1;The initial blood volume of grade 2 is 2, and armor is
2, then the storage form of array object set are as follows: { (1,1), (2,2) }.
Inventor has found that at least there are the following problems for the prior art in the implementation of the present invention:
In the prior art, configuration data is stored in the form of array object set, so that inquiring a configuration data
When, it needs just inquire the configuration data after the configuration data before traversing the configuration data, so that the time of inquiry is multiple
Miscellaneous degree is higher, for example, in order to inquire the configuration data of grade 2, needed after the configuration data of inquiry grade 1 in above-mentioned example,
The configuration data of inquiry grade 2 is gone again.
Summary of the invention
The storage method for being designed to provide a kind of configuration data of the embodiment of the present invention, when reducing configuration data inquiry
Inquiry time complexity.Specific technical solution is as follows:
The embodiment of the present invention provides a kind of storage method of configuration data, comprising:
Configuration file is obtained, record has the configuration data of configuration object in the configuration file;
The configuration file is loaded into memory, and the configuration data based on the configuration object, generates array object;
For array object distribution index mark;
The array object and the index are identified, are associated storage in memory.
It is further, described to be identified for the array object distribution index, comprising:
According to the corresponding relationship of the configuration data that pre-establishes and preset index character, obtain in the array object with
The corresponding configuration data of the index character;
Configuration data corresponding with the index character in the index character and the array object is combined, is obtained
Index to the array object identifies.
Further, described to identify the array object and the index, it is associated storage in memory, comprising:
By the key-value pair that the array object and the index identifier combination are in Map data structure, and according to Map data
Structure stores the key-value pair, wherein the index mark is as the key in Map data structure, and the array object is as Map
Value in data structure.
Further, it by the key-value pair that the array object and the index identifier combination are in Map data structure, and presses
The key-value pair is stored according to Map data structure, comprising:
The index is identified and carries out Hash operation, obtains storage address corresponding with the array object;
The array object and index mark are combined, key-value pair is generated;
According to the storage address, store the key-value pair.
It further, is in Map data structure by the array object and index mark object composition described
Key-value pair, and after storing the key-value pair according to Map data structure, further includes:
According to preset ordering requirements, determine corresponding with the ordering requirements in the array object of each key-value pair of storage
Configuration data size;
According to the size of determining configuration data, each key-value pair of storage is ranked up.
The embodiment of the present invention also provides a kind of querying method of configuration data, and associated storage has array object and is somebody's turn to do in memory
The index of array object identifies, wherein array object is to be generated based on the configuration data for configuring object in configuration file, described
Method includes:
Inquiry operation is received, includes the index mark of array object to be checked in the inquiry operation;
It is identified according to the index of array object to be checked, in memory, extracts and be associated storage with index mark
Array object.
The embodiment of the present invention also provides a kind of storage device of configuration data, and described device includes:
Configuration file obtains module, and for obtaining configuration file, record has the configuration of configuration object in the configuration file
Data;
Array object generation module, for loading the configuration file into memory, and matching based on the configuration object
Data are set, array object is generated;
Index tab distribution module, for being identified for the array object distribution index;
Associated storage module is associated storage for identifying the array object and the index in memory.
Further, the index tab distribution module, specifically for according to the configuration data pre-established with it is preset
The corresponding relationship of index character obtains configuration data corresponding with the index character in the array object, and will be described
Configuration data corresponding with the index character is combined in index character and the array object, obtains the array object
Index mark.
Further, the array object and the index identifier combination are specifically Map number by the associated storage module
The key-value pair is stored according to the key-value pair in structure, and according to Map data structure, wherein the index mark is used as Map data
Key in structure, the array object is as the value in Map data structure.
Further, the associated storage module is specifically used for obtaining and institute index mark progress Hash operation
The corresponding storage address of array object is stated, and the array object and index mark are combined, generates key-value pair,
And according to the storage address, store the key-value pair.
Further, described device further include:
Key-value pair sorting module, for determining the array object of each key-value pair of storage according to preset ordering requirements
In configuration data corresponding with the ordering requirements size, and according to the size of determining configuration data, to the every of storage
A key-value pair is ranked up.
The embodiment of the present invention also provides a kind of inquiry unit of configuration data, and associated storage has array object and is somebody's turn to do in memory
The index of array object identifies, wherein array object is to be generated based on the configuration data for configuring object in configuration file, described
Device includes:
Inquiry operation receiving module includes array pair to be checked in the inquiry operation for receiving inquiry operation
The index of elephant identifies;
Array object extraction module in memory, is extracted and is somebody's turn to do for the index mark according to array object to be checked
Index mark is associated the array object of storage.
The embodiment of the present invention also provides a kind of electronic equipment, including processor, communication interface, memory and communication bus,
Wherein, processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes the storage method of any of the above-described configuration data
The step of.
The embodiment of the present invention also provides a kind of electronic equipment, including processor, communication interface, memory and communication bus,
Wherein, processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes the querying method of any of the above-described configuration data
The step of.
Present invention implementation additionally provides a kind of computer readable storage medium, storage in the computer readable storage medium
There is computer program, the computer program realizes the step of the storage method of any of the above-described configuration data when being executed by processor
Suddenly.
Present invention implementation additionally provides a kind of computer readable storage medium, storage in the computer readable storage medium
There is computer program, the computer program realizes the step of the querying method of any of the above-described configuration data when being executed by processor
Suddenly.
The embodiment of the invention also provides a kind of computer program products comprising instruction, when it runs on computers
When, so that computer executes the storage method of any of the above-described configuration data.
The embodiment of the invention also provides a kind of computer program products comprising instruction, when it runs on computers
When, so that computer executes the querying method of any of the above-described configuration data.
Storage method, device and the electronic equipment of a kind of configuration data provided in an embodiment of the present invention, in scheme, acquisition is matched
File is set, record has the configuration data of configuration object in configuration file, and configuration file is loaded into memory, and based on configuration
The configuration data of object generates array object, and identifies for array object distribution index, and array object and index are marked
Know, be associated storage in memory, due in memory, array object and index mark being associated storage, work as needs
It when inquiring array object, can be identified according to index, directly extract the array object for being associated storage with index mark, thus
Traversing operation is avoided, time complexity when inquiry is reduced.
Certainly, implement any of the products of the present invention or method it is not absolutely required at the same reach all the above excellent
Point.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described.
Fig. 1 is the flow chart of the storage method of configuration data provided by one embodiment of the present invention;
Fig. 2 is the flow chart of the storage method for the configuration data that another embodiment of the present invention provides;
Fig. 3 is the flow chart of the querying method of configuration data provided by one embodiment of the present invention;
Fig. 4 is the structural schematic diagram of the storage device of configuration data provided by one embodiment of the present invention;
Fig. 5 is the structural schematic diagram of the inquiry unit of configuration data provided by one embodiment of the present invention;
Fig. 6 is the structural schematic diagram of the electronic equipment of the storage method provided in an embodiment of the present invention for realizing configuration data;
Fig. 7 is the structural schematic diagram of the electronic equipment of the querying method provided in an embodiment of the present invention for realizing configuration data.
Specific embodiment
In order to provide the implementation of time complexity when reduction query configuration data, the embodiment of the invention provides one
Storage method, device and the electronic equipment of kind configuration data, say the embodiment of the present invention below in conjunction with Figure of description
It is bright.And in the absence of conflict, the features in the embodiments and the embodiments of the present application can be combined with each other.
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.
In one embodiment of the invention, a kind of storage method of configuration data is provided, as shown in Figure 1, this method packet
Include following steps:
S101: configuration file is obtained, record has the configuration data of configuration object in configuration file.
In this step, configuration file is the document form for logging program parameter, and the type of common configuration file has
" .ini ", " .properties " and " .xml " etc., wherein in Windows operating system be configuration file mostly with .ini format
Form exist, and configuration file can be .properties format in linux system or in some Java engineerings,
Wherein, indispensable data when configuration data is normal program operation, for example, configuration data can for games
To include game role data such as corresponding original blood volume and original aggressor power in different brackets in game.
In one embodiment, the configuration data that a configuration object can be only recorded in configuration file, for example, in game
In program, the configuration object in configuration file can be 1 grade of game role grade, when configuration data is 1 grade of game role grade
Corresponding configuration data can be the attributes such as blood volume, armor or the attack of game role, in the program of friend-making class, configuration
File can only record the configuration data of the good friend of determining ID, and corresponding configuration data can be the close of the good friend of determination ID
Title, name, age, gender etc..
In one embodiment, it can recorde the configuration data of multiple configuration objects in configuration file, wherein configuration pair
As can be the corresponding business object of configuration data, for example, in games, configuration object can be game role etc.
Grade, corresponding configuration data can be the attributes such as blood volume, armor or the attack of game role, in the program of friend-making class, match
Set object it is available be user good friend ID, corresponding configuration data can be the pet name, name, age, gender of the good friend etc..
In one embodiment, in each configuration file, each configuration object can correspond to one group of configuration data, and every
It may include a kind of configuration data in group configuration data, also may include various configurations data.
Illustratively, in the configuration file in a games for the raw information of recording game role, configuration
Object or business object are the grade of game role, wherein the first row corresponds to when game role grade is 1 grade in configuration file
Raw information, the second row correspond to raw information when game role grade is 2 grades, and it is 3 grades that the third line, which corresponds to game role grade,
When raw information, and so on, determine n row, raw information when corresponding game role grade is n grades, wherein raw information can
It also may include the various configurations data such as blood volume, method force value, armor and attack to only include a kind of this configuration data of blood volume.
S102: configuration file is loaded into memory, and the configuration data based on configuration object, generates array object.
In this step, array object can be generated according to the configuration object that records in the configuration file that step S101 is obtained,
Wherein, array object can be the configuration data of configuration object.
Illustratively, such as aforementioned exemplary, in the file of the configuration of the raw information of recording game role, raw information includes
Three kinds of blood volume, armor and attack configuration datas, wherein when grade is 1 grade, the corresponding blood volume of game role is 10, armor is
5, attack 2, when grade is 2 grades, the corresponding blood volume of game role is 20, armor 10, attack 4, and grade is 3 grades
When, the corresponding blood volume of game role is 30, armor 15, attack 6, then the array object of the corresponding grade 1 generated is
(10,5,2), the array object of corresponding grade 2 are (20,10,4), and the array object of corresponding grade 3 is (30,15,6).
In one embodiment, configuration file can be loaded into memory, obtains array object set, wherein array pair
As the configuration data of the corresponding configuration object of each array object in set.
Illustratively, on the basis of above-mentioned example, configuration file is loaded into memory, obtaining array object set can be with
Are as follows: { (10,5,2), (20,10,4), (30,15,6) }, array object combine in there are three array objects, be corresponding angles respectively
(10,5,2) of colour gradation 1, (30,15,6) of (20,10,4) of corresponding role hierarchy 2 and corresponding role hierarchy 3.
S103: for array object distribution index mark.
In this step, the index mark of each array object can be it is pre-set be arranged according to demand, for example, be
The index of the first array object distribution obtained is identified as 001, for the index mark of second array object distribution of acquisition
It is 002, the index for the third array object distribution of acquisition is identified as 003.
In one embodiment, it can also will configure object as the index of array object to identify, for example, in above-mentioned game
In example of the angle grade as configuration object, the identification information of array object can be the corresponding configuration object of array object,
For example, the index of first array object distribution is identified as grade Level-1, the index of first array object distribution is identified as
The index of grade Level-2, the distribution of first array object are identified as grade Level-3.
S104: array object and index are identified, are associated storage in memory.
In this step, it will be appreciated by those skilled in the art that, associated storage can be a kind of with incidence relation
Storage form, be also possible to by associated container to array object and index mark store.In one embodiment, needle
To each array object, the index of the array object and the array object can be identified, be associated storage in memory.
Illustratively, array object (10,5,2), (20,10,4) and (30,15,6) are retrieved as in step S103, are above-mentioned
The index mark of three array object distribution is respectively 001,002 and 003, can be by array object (10,5,2) in this step
With index mark 001 is associated stores into associated container, array object (20,10,4) and index are identified into 002 associated storage
Into associated container, by array object (30,15,6) and index mark 003 is associated stores into associated container.To when needs
It searches when needing to inquire array object, can be identified according to index, directly extract the number for being associated storage with index mark
Group objects ensure that, when searching array object each time, it is only necessary to which the array of needs can be extracted by carrying out single stepping
Object, time complexity are Q (1).
In the storage method of above-mentioned configuration data provided in an embodiment of the present invention, configuration file is obtained, is remembered in configuration file
Record has the configuration data of configuration object, and configuration file is loaded into memory, and the configuration data based on configuration object, generates
Array object, and identified for array object distribution index, and array object and index are identified, it is associated in memory
The index of array object and array object mark is associated storage due in memory by storage, when needing to inquire array
It when object, can be identified according to index, extract the array object for being associated storage with index mark, directly so as to avoid
Traversing operation reduces time complexity when inquiry.
In one embodiment of the invention, a kind of storage method of configuration data is also provided, as shown in Fig. 2, this method
The following steps are included:
S201: configuration file is obtained, record has the configuration data of configuration object in configuration file.
In this step, the method that can be specifically provided using above-mentioned steps S101, details are not described herein for this step.
S202: it according to the corresponding relationship of the configuration data and preset index character that pre-establish, obtains in array object
Configuration data corresponding with index character.
In this step, preset index character can be determination according to demand, be also possible to according to the field received
What index was determined, such as the field index of business personnel's input is Field (field) field.The corresponding relationship pre-established
It can be determination according to demand, be also possible to the field index determination inputted according to business personnel, for example, field index is
Field field, index character can be with Field, then corresponding relationship, which may is that, will belong to the configuration of Field field in object array
Data are as associated object corresponding with index character Field.
Illustratively, in the example of above-mentioned game role grade, the array object of corresponding grade 1 is (10,5,2), right
The array object for answering grade 2 is (20,10,4), and the array object of corresponding grade 3 is (30,15,6), and preset index character is
Blood (blood volume), the corresponding relationship pre-established are first data that array object is corresponded to for Blood, then each array pair
The configuration data corresponding with index character as in are as follows: the configuration data of the manipulative indexing character Blood of first array object is
The configuration data of 10, the manipulative indexing character Blood of second array object are 20, the manipulative indexing word of third array object
The configuration data for according with Blood is 30.
It will be appreciated by those skilled in the art that the configuration data of above-mentioned acquisition manipulative indexing character is can to pass through
What field locating for the configuration data of required acquisition determined, in simple terms, the burst of data in corresponding memory:
010110010101000100110110, totally 24 characters, wherein the first in 1-4 the first object datas of character representation is matched
Set data, second of configuration data in 5-8 the first object datas of character representation, 9-12 the second object datas of character representation
In the first configuration data, second of configuration data in 13-16 the second object datas of character representation, 17-20 characters
Indicate the first configuration data in third object data, second of configuration in 21-24 character representation third object datas
Data can be expressed as { (0101,1001), (0101,0001) (0011,0110) } using array object set, when needs take
Out when the first configuration data of each array object, can pre-establish for relationship are as follows: index character corresponds to array pair
The configuration data of preceding four bit field as in, be also possible to take out array object in 2-6 be used as the corresponding configuration number of index character
According to.
In one embodiment, unique when index mark, i.e., each index mark has unique corresponding array
Object, that is to say, that the same index mark can only carry out corresponding with an array object.
S203: configuration data corresponding with index character in index character and array object is combined, array is obtained
The index of object identifies.
It, can be corresponding with index character in the array object by index character for each array object in this step
Configuration data is combined, and obtains the index mark of the array object, the mode specifically combined can be according to different reference fields
Scape and demand are determined.
Illustratively, in the example of above-mentioned game role grade, the manipulative indexing character Blood of first array object
Configuration data be 10, the configuration data of the manipulative indexing character Blood of second array object is 20, third array object
Manipulative indexing character Blood configuration data be 30, then the index tab of first array object be Blood-10, first
The index tab of array object is Blood-20, and the index tab of first array object is Blood-30.
S204: being the key-value pair in Map data structure by array object and index identifier combination, and according to Map data knot
Structure stores key-value pair, wherein index mark is as the key in Map data structure, and array object is as in Map data structure
Value.
Known to those of skill in the art in this step, Map data structure is the general element that java is provided
Storage method.Map collection class is used for storage element pair or key-value pair (referred to as " key " and " value "), wherein each key is mapped to one
Value.
In one embodiment, for each array object, by the index mark group of the array object and the array object
The key-value pair being combined into Map data structure, in the example of above-mentioned game role grade, the array object of corresponding grade 1 is
(10,5,2), the array object of corresponding grade 2 are (20,10,4), and the array object of corresponding grade 3 is (30,15,6), right respectively
The index character answered be Blood-10, Blood-20 and Blood-30, then can be using Blood-10 as in Map data structure
Key, array object (10,5,2) are combined into key-value pair Blood-10_ (10,5,2), similarly have as the value in Map data structure
Key-value pair Blood-20_ (20,10,4) and key-value pair Blood-30_ (30,15,6).
It in one embodiment, can be by being directed to each array object, to the array object after determining key-value pair
Index mark carries out Hash operation, obtains the corresponding storage address of the array object, and by the array object and the array pair
The index mark of elephant is combined, and generates key-value pair, and according to storage address corresponding with the array object, store the key assignments
It is right.In one embodiment, hash algorithm may include folded using leaving remainder method, digital analysis method, middle square method, segmentation
The methods of addition radix transformation approach determine storage address, when storage address determine after, will determine key-value pair according to storage address into
Row storage can identify according to the index in this way after receiving the index for including in inquiry operation mark and determine storage address,
Array object before being obtained from the storage address in storage key-value pair.
In one embodiment, in one embodiment, can using all key-value pairs of above-mentioned acquisition as a class,
Then when there are ordering requirements, according to preset ordering requirements, each key-value pair of storage can be determined after step s 204
Array object in configuration data corresponding with ordering requirements size, further according to the size of determining configuration data, to storage
Each key-value pair be ranked up.Illustratively, in the example of above-mentioned game role grade, the array object of corresponding grade 1
For (10,5,2), the array object of corresponding grade 2 is (20,10,4), and the array object of corresponding grade 3 is (30,15,6), works as row
The corresponding configuration data of sequence demand is the second data of array object, then the size of the configuration data of the array object of grade 1
It is 5, the size of the configuration data of the array object of grade 2 is 10, and the size of the configuration data of the array object of grade 3 is 15,
It when sequence sorts, is then obtained after sorting, (30,15,6), (20,10,4), (10,5,2), when query demand is to obtain such
The maximum array object of second data in array object is in sequence first after can then directly acquiring sequence in sequence
Array object.
In the storage method of above-mentioned configuration data shown in Fig. 2 provided in an embodiment of the present invention, by obtaining configuration file,
Record has the configuration data of configuration object in configuration file, and according to the configuration data and preset index character pre-established
Corresponding relationship, obtain configuration data corresponding with index character in array object, and will be in index character and array object
Configuration data corresponding with index character is combined, and obtains the index mark of array object, and by array object and index
Identifier combination is the key-value pair in Map data structure, and stores key-value pair according to Map data structure, wherein index mark conduct
Key in Map data structure, array object is as the value in Map data structure, due in memory, by array object and the number
The index of group objects identifies conduct-value pair, and Map data structure is stored, and realizes the association of array object and index mark
Storage can be identified when needing to inquire array object according to index, directly extract the number that storage is associated with index mark
Group objects reduces time complexity when inquiry so as to avoid traversing operation
In another embodiment of the present invention, a kind of querying method of configuration data is also provided, association is deposited in memory
The index for containing array object and the array object identifies, wherein array object is based on configuring matching for object in configuration file
Data generation is set, as shown in figure 3, method includes the following steps:
S301: receiving inquiry operation, includes the index mark of array object to be checked in inquiry operation.
In this step, associated storage has the index of array object and the array object to identify in memory, can be basis
What previous embodiment generated, wherein inquiry operation operation can be what business personnel determined according to self-demand, implement at one
In example, the index mark of array object to be checked may include in inquiry operation, illustratively.
S302: identifying according to the index of array object to be checked, in memory, extracts and is associated with index mark
The array object of storage.
In this step, illustratively, in the example of above-mentioned game role grade, the array object of corresponding grade 1 is
(10,5,2) and index tab Blood-10 associated storage, array object are that (20,10,4) are associated with index tab Blood-20
Storage, array object is (30,15,6) and index tab Blood-30 associated storage, when inquiry operation includes in step S301
Index is identified as Blood-20, then can extract array object (20,10,4).
In the querying method of above-mentioned configuration data shown in Fig. 3 provided in an embodiment of the present invention, by receiving inquiry operation,
It include the index mark of array object to be checked in inquiry operation, and according to the index mark of array object to be checked
Know, in memory, extracts the array object for being associated storage with index mark.It can index mark to include in inquiry operation
Know, the array object for being associated storage with index mark is directly extracted, so as to avoid traversing operation, when reducing inquiry
Time complexity.
Based on the same inventive concept, the storage method of the configuration data provided according to embodiments of the present invention, the present invention are implemented
Example additionally provides a kind of storage device of configuration data, as shown in figure 4, the device includes:
Configuration file obtains module 401, and for obtaining configuration file, record has the configuration number of configuration object in configuration file
According to;
Array object generation module 402, for loading configuration file into memory, and the configuration number based on configuration object
According to generation array object;
Index tab distribution module 403, for being identified for array object distribution index;
Associated storage module 404 is associated storage for identifying array object and index in memory.
Further, index tab distribution module 403, specifically for according to the configuration data and preset rope pre-established
Draw the corresponding relationship of character, obtain configuration data corresponding with index character in array object, and by index character and array
Configuration data corresponding with index character is combined in object, obtains the index mark of array object.
Further, associated storage module 404 is specifically used for array object and index identifier combination being Map data knot
Key-value pair in structure, and key-value pair is stored according to Map data structure, wherein index is identified as the key in Map data structure,
Array object is as the value in Map data structure.
Further, associated storage module 404 is specifically used for identifying index progress Hash operation, obtain and array pair
It is combined as corresponding storage address, and by array object and index mark, generates key-value pair, and according to storage
Location stores key-value pair.
Further, device further include:
Key-value pair sorting module 405, for determining the array pair of each key-value pair of storage according to preset ordering requirements
The size of configuration data corresponding with ordering requirements as in, and according to the size of determining configuration data, to each of storage
Key-value pair is ranked up.
Based on the same inventive concept, the querying method of the configuration data provided according to embodiments of the present invention, the present invention are implemented
Example additionally provides a kind of inquiry unit of configuration data, and associated storage has the index mark of array object He the array object in memory
Know, wherein array object is to be generated based on the configuration data for configuring object in configuration file, as shown in figure 5, the device packet
It includes:
Inquiry operation receiving module 501 includes array object to be checked in inquiry operation for receiving inquiry operation
Index mark
Array object extraction module 502 extracts in memory for the index mark according to array object to be checked
The array object of storage is associated with index mark.
The embodiment of the invention also provides a kind of electronic equipment, as shown in fig. 6, include processor 601, communication interface 602,
Memory 603 and communication bus 604, wherein processor 601, communication interface 602, memory 603 are complete by communication bus 604
At mutual communication,
Memory 603, for storing computer program;
Processor 601 when for executing the program stored on memory 603, realizes following steps:
Configuration file is obtained, record has the configuration data of configuration object in the configuration file;
The configuration file is loaded into memory, and the configuration data based on the configuration object, generates array object;
For array object distribution index mark;
The array object and the index are identified, are associated storage in memory.
The embodiment of the invention also provides a kind of electronic equipment, as shown in fig. 7, comprises processor 701, communication interface 702,
Memory 703 and communication bus 704, wherein processor 701, communication interface 702, memory 703 are complete by communication bus 704
At mutual communication,
Memory 703, for storing computer program;
Processor 701 when for executing the program stored on memory 703, realizes following steps:
Inquiry operation is received, includes the index mark of array object to be checked in the inquiry operation;
It is identified according to the index of array object to be checked, in memory, extracts and be associated storage with index mark
Array object.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component
Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, control bus etc..For just
It is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), also may include non-easy
The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also
To be storage device that at least one is located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,
CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal
Processing, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing
It is field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete
Door or transistor logic, discrete hardware components.
In another embodiment provided by the invention, a kind of computer readable storage medium is additionally provided, which can
It reads to be stored with computer program in storage medium, the computer program realizes any of the above-described configuration data when being executed by processor
Storage method the step of.
In another embodiment provided by the invention, a kind of computer readable storage medium is additionally provided, which can
It reads to be stored with computer program in storage medium, the computer program realizes any of the above-described configuration data when being executed by processor
Querying method the step of.
In another embodiment provided by the invention, a kind of computer program product comprising instruction is additionally provided, when it
When running on computers, so that computer executes the storage method of any configuration data in above-described embodiment.
In another embodiment provided by the invention, a kind of computer program product comprising instruction is additionally provided, when it
When running on computers, so that computer executes the querying method of any configuration data in above-described embodiment.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or any combination thereof real
It is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.The computer program
Product includes one or more computer instructions.When loading on computers and executing the computer program instructions, all or
It partly generates according to process or function described in the embodiment of the present invention.The computer can be general purpose computer, dedicated meter
Calculation machine, computer network or other programmable devices.The computer instruction can store in computer readable storage medium
In, or from a computer readable storage medium to the transmission of another computer readable storage medium, for example, the computer
Instruction can pass through wired (such as coaxial cable, optical fiber, number from a web-site, computer, server or data center
User's line (DSL)) or wireless (such as infrared, wireless, microwave etc.) mode to another web-site, computer, server or
Data center is transmitted.The computer readable storage medium can be any usable medium that computer can access or
It is comprising data storage devices such as one or more usable mediums integrated server, data centers.The usable medium can be with
It is magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (for example, DVD) or semiconductor medium (such as solid state hard disk
Solid State Disk (SSD)) etc..
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,
For electronic equipment, computer readable storage medium, computer program product, since it is substantially similar to the method embodiment, institute
To be described relatively simple, the relevent part can refer to the partial explaination of embodiments of method.
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.
Claims (10)
1. a kind of storage method of configuration data characterized by comprising
Configuration file is obtained, record has the configuration data of configuration object in the configuration file;
The configuration file is loaded into memory, and the configuration data based on the configuration object, generates array object;
For array object distribution index mark;
The array object and the index are identified, are associated storage in memory.
2. the method according to claim 1, wherein described identify for the array object distribution index, comprising:
According to the corresponding relationship of the configuration data that pre-establishes and preset index character, obtain in the array object with it is described
The corresponding configuration data of index character;
Configuration data corresponding with the index character in the index character and the array object is combined, institute is obtained
State the index mark of array object.
3. method described in -2 any one according to claim 1, which is characterized in that described by the array object and the rope
Tendering is known, and is associated storage in memory, comprising:
By the key-value pair that the array object and the index identifier combination are in Map data structure, and according to Map data structure
Store the key-value pair, wherein the index mark is as the key in Map data structure, and the array object is as Map data
Value in structure.
4. according to the method described in claim 3, it is characterized in that, being by the array object and the index identifier combination
Key-value pair in Map data structure, and the key-value pair is stored according to Map data structure, comprising:
The index is identified and carries out Hash operation, obtains storage address corresponding with the array object;
The array object and index mark are combined, key-value pair is generated;
According to the storage address, store the key-value pair.
5. according to the method described in claim 3, it is characterized in that, described by the array object and index mark pair
As group is combined into the key-value pair in Map data structure, and after storing the key-value pair according to Map data structure, further includes:
According to preset ordering requirements, corresponding with the ordering requirements in the array object of each key-value pair of storage match is determined
Set the size of data;
According to the size of determining configuration data, each key-value pair of storage is ranked up.
6. a kind of querying method of configuration data, which is characterized in that associated storage has array object and the array object in memory
Index mark, wherein array object be based in configuration file configure object configuration data generate, the method packet
It includes:
Inquiry operation is received, includes the index mark of array object to be checked in the inquiry operation;
It is identified according to the index of array object to be checked, in memory, extracts the number for being associated storage with index mark
Group objects.
7. a kind of storage device of configuration data characterized by comprising
Configuration file obtains module, and for obtaining configuration file, record has the configuration data of configuration object in the configuration file;
Array object generation module, for loading the configuration file into memory, and the configuration number based on the configuration object
According to generation array object;
Index tab distribution module, for being identified for the array object distribution index;
Associated storage module is associated storage for identifying the array object and the index in memory.
8. a kind of inquiry unit of configuration data, which is characterized in that associated storage has array object and the array object in memory
Index mark, wherein array object be based in configuration file configure object configuration data generate, described device packet
It includes:
Inquiry operation receiving module includes array object to be checked in the inquiry operation for receiving inquiry operation
Index mark;
Array object extraction module extracts and the index in memory for the index mark according to array object to be checked
Mark is associated the array object of storage.
9. a kind of electronic equipment, which is characterized in that including processor, communication interface, memory and communication bus, wherein processing
Device, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any method and step of claim 1-5.
10. a kind of electronic equipment, which is characterized in that including processor, communication interface, memory and communication bus, wherein processing
Device, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes method of claim 6 step.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910457135.3A CN110201393A (en) | 2019-05-29 | 2019-05-29 | Configuration data storage method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910457135.3A CN110201393A (en) | 2019-05-29 | 2019-05-29 | Configuration data storage method and device and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110201393A true CN110201393A (en) | 2019-09-06 |
Family
ID=67789272
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910457135.3A Pending CN110201393A (en) | 2019-05-29 | 2019-05-29 | Configuration data storage method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110201393A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110941586A (en) * | 2019-10-25 | 2020-03-31 | 深圳市毕美科技有限公司 | Engineering design data management method and system |
CN111143349A (en) * | 2019-11-26 | 2020-05-12 | 广东三扬网络科技有限公司 | Method for quickly searching information from set, electronic equipment and storage medium |
CN111339093A (en) * | 2020-02-25 | 2020-06-26 | 京东方科技集团股份有限公司 | Method, device and equipment for acquiring user behavior data and storage medium |
CN112156476A (en) * | 2020-09-23 | 2021-01-01 | 成都完美天智游科技有限公司 | Game configuration file exporting method, device, equipment and storage medium |
CN112416932A (en) * | 2020-11-18 | 2021-02-26 | 青岛海尔科技有限公司 | Method and device for establishing field association relationship |
CN116521198A (en) * | 2023-04-13 | 2023-08-01 | 广州汽车集团股份有限公司 | Data processing method, device, equipment and computer readable storage medium |
CN116560741A (en) * | 2023-07-10 | 2023-08-08 | 荣耀终端有限公司 | Hardware initialization method, medium and electronic equipment |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003077005A (en) * | 2001-09-03 | 2003-03-14 | Namco Ltd | High speed matrix calculator |
CN103136104A (en) * | 2011-11-24 | 2013-06-05 | 深圳市快播科技有限公司 | Memory management method and system |
CN103714009A (en) * | 2013-12-20 | 2014-04-09 | 华中科技大学 | MapReduce realizing method based on unified management of internal memory on GPU |
CN103902701A (en) * | 2014-03-31 | 2014-07-02 | 北京车商汇软件有限公司 | Data storage system and data storage method |
CN105159664A (en) * | 2015-08-07 | 2015-12-16 | 苏州博优赞信息科技有限责任公司 | Mode for realizing key-value storage based on javascript |
CN105426408A (en) * | 2015-11-02 | 2016-03-23 | 北京锐安科技有限公司 | Multi-index data processing method and apparatus |
CN106203569A (en) * | 2016-07-07 | 2016-12-07 | 立德高科(昆山)数码科技有限责任公司 | Stamp album approaches to IM based on Quick Response Code |
CN106446169A (en) * | 2016-09-26 | 2017-02-22 | 上海斐讯数据通信技术有限公司 | Method and device for managing user information in terminal device |
CN106991102A (en) * | 2016-01-21 | 2017-07-28 | 腾讯科技(深圳)有限公司 | The processing method and processing system of key-value pair in inverted index |
CN107122170A (en) * | 2017-03-22 | 2017-09-01 | 武汉斗鱼网络科技有限公司 | A kind of massive store method and device of array of data |
CN108052290A (en) * | 2017-12-13 | 2018-05-18 | 北京百度网讯科技有限公司 | For storing the method and apparatus of data |
-
2019
- 2019-05-29 CN CN201910457135.3A patent/CN110201393A/en active Pending
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003077005A (en) * | 2001-09-03 | 2003-03-14 | Namco Ltd | High speed matrix calculator |
CN103136104A (en) * | 2011-11-24 | 2013-06-05 | 深圳市快播科技有限公司 | Memory management method and system |
CN103714009A (en) * | 2013-12-20 | 2014-04-09 | 华中科技大学 | MapReduce realizing method based on unified management of internal memory on GPU |
CN103902701A (en) * | 2014-03-31 | 2014-07-02 | 北京车商汇软件有限公司 | Data storage system and data storage method |
CN105159664A (en) * | 2015-08-07 | 2015-12-16 | 苏州博优赞信息科技有限责任公司 | Mode for realizing key-value storage based on javascript |
CN105426408A (en) * | 2015-11-02 | 2016-03-23 | 北京锐安科技有限公司 | Multi-index data processing method and apparatus |
CN106991102A (en) * | 2016-01-21 | 2017-07-28 | 腾讯科技(深圳)有限公司 | The processing method and processing system of key-value pair in inverted index |
CN106203569A (en) * | 2016-07-07 | 2016-12-07 | 立德高科(昆山)数码科技有限责任公司 | Stamp album approaches to IM based on Quick Response Code |
CN106446169A (en) * | 2016-09-26 | 2017-02-22 | 上海斐讯数据通信技术有限公司 | Method and device for managing user information in terminal device |
CN107122170A (en) * | 2017-03-22 | 2017-09-01 | 武汉斗鱼网络科技有限公司 | A kind of massive store method and device of array of data |
CN108052290A (en) * | 2017-12-13 | 2018-05-18 | 北京百度网讯科技有限公司 | For storing the method and apparatus of data |
Non-Patent Citations (2)
Title |
---|
STARK_JAVAC: "java学习之数组(一)【内存】", 《HTTPS://WWW.CNBLOGS.COM/SUNCHUANZHEN/P/3321743.HTML》 * |
WEIXIN_33883178: "c++ map:使用struct或者数组做value", 《HTTPS://BLOG.CSDN.NET/WEIXIN_33883178/ARTICLE/DETAILS/93170074》 * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110941586A (en) * | 2019-10-25 | 2020-03-31 | 深圳市毕美科技有限公司 | Engineering design data management method and system |
CN111143349A (en) * | 2019-11-26 | 2020-05-12 | 广东三扬网络科技有限公司 | Method for quickly searching information from set, electronic equipment and storage medium |
CN111339093A (en) * | 2020-02-25 | 2020-06-26 | 京东方科技集团股份有限公司 | Method, device and equipment for acquiring user behavior data and storage medium |
CN112156476A (en) * | 2020-09-23 | 2021-01-01 | 成都完美天智游科技有限公司 | Game configuration file exporting method, device, equipment and storage medium |
CN112416932A (en) * | 2020-11-18 | 2021-02-26 | 青岛海尔科技有限公司 | Method and device for establishing field association relationship |
CN116521198A (en) * | 2023-04-13 | 2023-08-01 | 广州汽车集团股份有限公司 | Data processing method, device, equipment and computer readable storage medium |
CN116560741A (en) * | 2023-07-10 | 2023-08-08 | 荣耀终端有限公司 | Hardware initialization method, medium and electronic equipment |
CN116560741B (en) * | 2023-07-10 | 2024-04-19 | 荣耀终端有限公司 | Hardware initialization method, medium and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110201393A (en) | Configuration data storage method and device and electronic equipment | |
US10237295B2 (en) | Automated event ID field analysis on heterogeneous logs | |
CN110569298B (en) | Data docking and visualization method and system | |
CN109241084B (en) | Data query method, terminal equipment and medium | |
CN109062936B (en) | Data query method, computer readable storage medium and terminal equipment | |
CN109740129B (en) | Report generation method, device and equipment based on blockchain and readable storage medium | |
CN110135590B (en) | Information processing method, information processing apparatus, information processing medium, and electronic device | |
CN106815226A (en) | Text matching technique and device | |
CN110198292A (en) | Domain name recognition methods and device, storage medium and electronic device | |
CN106462633A (en) | Efficient storage of related sparse data in a search index | |
CN108154024A (en) | A kind of data retrieval method, device and electronic equipment | |
CN104903865B (en) | Virtual machine VM images are applied to the method and system of computer system | |
CN107911397A (en) | A kind of intimidation estimating method and device | |
CN110334119A (en) | A kind of data correlation processing method, device, equipment and medium | |
CN112860811A (en) | Method and device for determining data blood relationship, electronic equipment and storage medium | |
CN115827436A (en) | Data processing method, device, equipment and storage medium | |
CN109062947A (en) | User's portrait tag queries method, equipment and computer readable storage medium | |
CN116015842A (en) | Network attack detection method based on user access behaviors | |
CN104424316A (en) | Data storage method, data searching method, related device and system | |
CN113641742A (en) | Data extraction method, device, equipment and storage medium | |
CN109101595A (en) | A kind of information query method, device, equipment and computer readable storage medium | |
CN113094415B (en) | Data extraction method, data extraction device, computer readable medium and electronic equipment | |
CN117609368A (en) | Genealogy analysis system, method, equipment and medium based on out-of-chain storage | |
CN106651183A (en) | Communication data security audit method and device for industrial control system | |
CN109710626B (en) | Data warehousing management method and device, electronic equipment and storage medium |
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 |
Application publication date: 20190906 |
|
RJ01 | Rejection of invention patent application after publication |