Method for storing list data and related device
By setting a preset number of bitmap bits in the storage area and determining the target bits of the list data, the problem of large data storage space consumption of list data in large systems is solved, and storage resources are optimized and efficiency is improved.
Patent Information
- Application Number
- CN202111469578.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-03
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2041-12-03
AI Technical Summary
The storage of list data in large systems consumes a large amount of storage space, especially as the amount of list data grows exponentially under different matching conditions, resulting in huge consumption of storage resources.
Set the number of bitmap bits in the storage area to a preset number, obtain the numerical ID of the list data, determine the corresponding target bit in the bitmap, set its value to a preset value to indicate the storage of the list data, and optimize storage space usage through bitmap bit settings and management.
This effectively reduces the storage space requirements for list data, saves storage resources, and improves storage efficiency.
Smart Images

Figure CN114138794B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data storage, and in particular to a list data storage method and related device. BACKGROUND
[0002] List data in a blacklist or a whitelist can be used to solve permission verification, business blacklist and whitelist mechanism, etc. Storage of list data is a common requirement in system development.
[0003] In a large system, due to the huge amount of list data, and in the case of different matching conditions of blacklist and whitelist data, more list data will be generated. For example, the system needs to form list data for the combination of pictures, identifiers, types, and scopes. When the combination of identifiers, types, and scopes is very large, the list data obtained by the combination of identifiers, types, and scopes is exponential in quantity, which makes the system need to consume a large amount of storage resources to store list data, i.e., the storage of list data occupies a large storage space. SUMMARY
[0004] The present application provides a list data storage method and related device to solve the problem of large storage space occupied by the storage of list data.
[0005] In one aspect, the present application provides a list data storage method, comprising:
[0006] setting the bit number of the bitmap in each storage area to a preset number, wherein the preset number is less than the maximum number of bit positions that the storage area can accommodate;
[0007] obtaining first list data to be stored, and determining a first digital number corresponding to the first list data;
[0008] determining a first target storage area corresponding to the first list data in each storage area;
[0009] when the first digital number is less than or equal to the preset number, determining a first target bit position corresponding to the first digital number on a first bitmap, wherein the first bitmap is a bitmap in the first target storage area, and the first target bit position has the same number as the first digital number in the first bitmap;
[0010] setting a value on the first target bit position to a preset value, wherein the preset value is used to indicate that the first list data corresponding to the first digital number is stored.
[0011] In an embodiment, the step of determining the first digital number corresponding to the first list data comprises:
[0012] determining a second digital number corresponding to each unit in the first list data, wherein the first list data is composed of characters, and the unit is a single word or a single character in the first list data;
[0013] combining the second digital number corresponding to each unit to obtain a first digital number corresponding to the first list data.
[0014] In an embodiment, the step of combining the second digital number corresponding to each unit to obtain a first digital number corresponding to the first list data comprises:
[0015] obtaining a position of each unit in the first list data;
[0016] combining the second digital number corresponding to each unit to obtain a first digital number corresponding to the first list data.
[0017] In an embodiment, the step of determining a target storage area corresponding to the first list data in each storage area comprises:
[0018] determining a number of units of the first list data;
[0019] determining a storage area corresponding to the number of units as the first target storage area corresponding to the first list data, wherein each storage area is used to store list data of a preset number of units.
[0020] In an embodiment, after the step of determining a target storage area corresponding to the first list data in each storage area, the method further comprises:
[0021] when the first digital number is greater than a preset number, increasing the number of bit positions of the first bitmap to a target number to obtain a second bitmap, the target number being the same as a value corresponding to the first digital number;
[0022] setting a value corresponding to a bit position at the end of the second bitmap as the preset value.
[0023] In an embodiment, the first list data is whitelist data or blacklist data, and after the step of setting the value on the target bit position as the preset value, the method further comprises:
[0024] obtaining second list data to be queried, and determining a third digital number corresponding to the second list data;
[0025] determine a second target storage area corresponding to the second list data in each of the storage areas, and determine a second target bit position corresponding to the third digital number in a third bitmap, wherein the third bitmap is a bitmap in the second target storage area;
[0026] when a value at the second target bit position is the preset value, determine that the second list data is white list data or black list data;
[0027] when the value at the second target bit position is not the preset value, determine that the second list data is not white list data or black list data.
[0028] In another aspect, the present application provides a list data storage device, comprising:
[0029] a setting module, configured to set a bit position number of a bitmap in each storage area as a preset number, wherein the preset number is less than a maximum number of bit positions accommodated by the storage area;
[0030] a obtaining module, configured to obtain first list data to be stored, and determine a first digital number corresponding to the first list data;
[0031] a determining module, configured to determine a first target storage area corresponding to the first list data in each of the storage areas;
[0032] the determining module is further configured to, when the first digital number is less than or equal to a preset number, determine a first target bit position corresponding to the first digital number in a first bitmap, wherein the first bitmap is a bitmap in the first target storage area, and the first target bit position has the same number as the first digital number in the first bitmap;
[0033] the setting module is further configured to set a value at the first target bit position as a preset value, wherein the preset value is used to indicate that the first list data corresponding to the first digital number is stored.
[0034] In another aspect, the present application provides a list data storage device, comprising a memory and a processor;
[0035] the memory is provided with a plurality of storage areas, and the memory stores computer execution instructions;
[0036] the storage areas are used to store list data;
[0037] the processor executes the computer execution instructions stored in the memory, so that the processor executes the list data storage method as described above.
[0038] In another aspect, the present application provides a computer readable storage medium, wherein the computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by a processor to implement the list data storage method.
[0039] In another aspect, the present application provides a computer program product, comprising a computer program, and the computer program is executed by a processor to implement the list data storage method.
[0040] The list data storage method and the related device provided by the present application set the bit data of the bitmap in each storage area to a preset number, obtain the list data to be stored, determine the digital number corresponding to the list data, determine the target storage area corresponding to the list data in each storage area, set the target bit corresponding to the digital number on the bitmap of the target storage area when the digital number is less than or equal to the preset number, and finally set the value corresponding to the target bit to a preset value to represent that the list data corresponding to the digital number is stored. In the present application, the digital number corresponding to the list data has a corresponding bit in the bitmap, and the value of the bit is set to the preset value to represent that the list data is stored. The bit is one-eighth byte, and the storage space occupied by the list data is small. The number of bits of the bitmap in the storage area is set to the preset number, and the preset number is less than the maximum number of bits that can be accommodated in the storage area, which further reduces the storage resources occupied by the list data. BRIEF DESCRIPTION OF DRAWINGS
[0041] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0042] Figure 1 A scene schematic diagram for implementing the list data storage method of the present application;
[0043] Figure 2 A flowchart of the first embodiment of the list data storage method of the present application;
[0044] Figure 3 A detailed flowchart of step S20 in the second embodiment of the list data storage method of the present application;
[0045] Figure 4 A detailed flowchart of step S30 in the third embodiment of the list data storage method of the present application;
[0046] Figure 5 A flowchart of the fourth embodiment of the list data storage method of the present application;
[0047] Figure 6A schematic diagram of a module of a storage device for list data of the present invention;
[0048] Figure 7 Schematic diagram of the hardware structure of the storage device for list data of the present invention.
[0049] The above drawings illustrate specific embodiments of the present disclosure, which will be described in more detail below. These drawings and textual descriptions are not intended to limit the scope of the present disclosure in any way, but rather to illustrate the concepts of the present disclosure to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0050] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
[0051] The present invention provides a method for storing list data. Figure 1 As shown, the list data to be stored is composed of text, with each text character corresponding to a number, and the numbers together constitute the numerical number of the list data. For example, if the list data is "Products are hot selling on the street," the number corresponding to "production" is 1, the number corresponding to "product" is 2, the number corresponding to "at" is 12, the number corresponding to "street" is 3, the number corresponding to "road" is 101, the number corresponding to "hot" is 8, and the number corresponding to "sell" is 88, then the numerical number of "Products are hot selling on the street" is 12123101888. The storage device for the list data is provided with multiple storage areas, each of which is provided with a bitmap comprising multiple consecutive bits. If the numerical number is 12123101888, then the value of the 12123101888th bit in the bitmap is set to a preset value. The value of a bit can be 0 or 1. If 1 is set as the preset value, that is, the value of the bit is 1, and the numerical number of the list data corresponding to the sequence number representing that bit is stored. If the value of the bit is 0, it can be determined that no list data is stored in the bit. The above is just an example. The numerical number of the list data can also be composed of the numbers corresponding to each phrase in the list data. The list data is not limited to text and can be letters or numbers.
[0052] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific examples. The following specific examples can be combined with each other, and the same or similar concepts or processes can not be described again in some examples. The embodiments of the present application will be described below with reference to the drawings.
[0053] With reference to Figure 2 , Figure 2 The first embodiment of the list data storage method of the present application includes the following steps:
[0054] In step S10, the number of bit positions of the bitmap in each storage area is set to a preset number, wherein the preset number is less than the maximum number of bit positions that the storage area can accommodate.
[0055] In this embodiment, the execution subject is a list data storage device. For ease of description, the device will be used to refer to the list data storage device hereinafter. The list data can be white list data or black list data. The device can be any device with a storage function.
[0056] The number of list data is large, and therefore the device can be provided with multiple storage areas, and each storage area is provided with a bitmap. The bitmap is composed of multiple bit positions, and each bit position is adjacent. Specifically, refer to Figure 1 The bitmap is a grid composed of multiple bit positions, each cell represents a bit position, and the value in each cell is the value of the bit position. The value of the bit position can be 0 or 1. The device stores a preset value, and if the value of the bit position is the preset value, it indicates that the bit position stores the corresponding list data. The preset value can be 1 or 0.
[0057] After setting up each storage area, the device sets up a bitmap in each storage area, and sets the number of bit positions of the bitmap to a preset number, which is less than the maximum number of bit positions that the storage area can accommodate. For example, if the maximum data is N, the number of bit positions of the bitmap can be set to 1 / N.
[0058] In step S20, the first list data to be stored is obtained, and the first digital number corresponding to the first list data is determined.
[0059] The external device can send the list data to be stored to the device, and the data to be stored is defined as the first list data. The list data can be composed of characters, letters, or numbers. The list data can be numbered into a string, and each string corresponds to a unique digital number. That is, the device can determine the digital number corresponding to the first list data, which is defined as the first digital number.
[0060] Step S30, determining a first target storage area corresponding to the first list data in each storage area.
[0061] The list data has attributes such as channel identifier, type, scope name, etc. The channel identifier is, for example, a phone number, an email address, a wallet address, a customer number, a merchant, an institution, and a teller. The type is, for example, a blacklist and a whitelist. The scope name is, for example, a channel, a product, and a service, etc. These attributes are combined to obtain an identifier, and the device can set a corresponding storage area for each identifier. After obtaining the first list data, the device determines the attributes of the list data, determines the identifier based on the attributes, and determines the storage area corresponding to the identifier as the target storage area of the first list data, which is defined as the first target storage area.
[0062] Step S40, determining a first target bit in the first bitmap corresponding to the first digital number, where the first bitmap is a bitmap in the first target storage area, and the first target bit has the same number as the first digital number in the first bitmap.
[0063] Since the data of the bit in the bitmap is a preset number, the preset number can be understood as the maximum ordering number of the bit in the bitmap being the preset number. That is, the first target storage area can store the list data corresponding to the first digital number less than or equal to the preset number.
[0064] In this regard, after determining the first digital number and the first target storage area, the device determines whether the first digital number is less than the preset number. If the first digital number is less than or equal to the preset number, the first bitmap in the first target storage area can store the first list data corresponding to the first digital number. The device determines the target bit corresponding to the first digital number in the first bitmap, which is defined as the first target bit. The first target bit has the same number as the first digital number in the first bitmap, and the number of the first target bit is the sequence number. For example, the preset number is 500, and the first digital number is 455. The number of the first target bit is 455, that is, the 455th bit in the first bitmap is the first target bit.
[0065] Step S50, setting the value of the first target bit to a preset value, where the preset value is used to indicate that the first list data corresponding to the first digital number is stored.
[0066] After determining the first target bit, the device sets the value of the first target bit to a preset value, which is used to indicate that the first list data corresponding to the first digital number is stored. The preset value can be 0 or 1.
[0067] In the technical scheme provided in the embodiment, bit data of the bitmap in each storage region is set to a preset quantity, list data to be stored is acquired, and a digital number corresponding to the list data is determined, and a target storage region corresponding to the list data in each storage region is determined, and when the digital number is less than or equal to the preset quantity, a target bit corresponding to the digital number on the bitmap of the target storage region is determined, and finally a value corresponding to the target bit is set to a preset value, to represent that the list data corresponding to the digital number is stored. In the application, the digital number corresponding to the list data has a corresponding bit in the bitmap, the value of the bit is set to the preset value to represent that the list data is stored, and the bit is one-eighth byte, so the storage space occupied by the list data for storage is small; and the number of bits of the bitmap in the storage region is set to the preset quantity, and the preset quantity is less than the maximum number of bits that can be accommodated in the storage region, further reducing the storage resources occupied by the list data for storage.
[0068] Reference Figure 3 , Figure 3 The second embodiment of the list data storage method of the application is based on the first embodiment, and step S20 comprises:
[0069] In step S21, a second digital number corresponding to each unit in the first list data is determined, wherein the first list data is data composed of characters, and the unit is a single word group or a single character in the first list data.
[0070] In the embodiment, the list data can be data composed of characters, letters or numbers. The device stores a first mapping relationship between characters and numbers and a second mapping relationship between letters and numbers. The device parses the list data into multiple units, each unit can be a single character, a single word group or a single letter. The device can determine the digital number corresponding to each unit in the first list data based on the first mapping relationship and the second mapping relationship, and the digital number corresponding to the unit is defined as the second digital number.
[0071] In step S22, the second digital number corresponding to each unit is combined to obtain a first digital number corresponding to the first list data.
[0072] The device can combine each second digital number to obtain the first digital number corresponding to the first list data. The device can combine each second digital number according to a set combination mode to obtain the first digital number. For example, each second digital number is arranged in descending order to obtain the first digital number.
[0073] Further, the apparatus can combine the second digital numbers corresponding to the units to obtain the first digital number based on the positions of the units in the first list data. The positions of the second digital numbers corresponding to the units in the first digital number are the same as the positions of the units in the first list data. Details can be referred to Figure 1 Details are not described herein.
[0074] In the technical solution provided in the embodiment, the apparatus determines the second digital numbers corresponding to the units of the first list data, and combines the second digital numbers corresponding to the units to obtain the first digital number corresponding to the first list data, that is, the list data is divided into multiple units to quickly obtain the digital number of the list data.
[0075] Details can be referred to Figure 4 , Figure 4 The third embodiment of the list data storage method of the present application is based on the second real time, and step S30 includes:
[0076] In step S31, the number of units of the first list data is determined.
[0077] In the embodiment, each storage area set by the apparatus is used to store list data of a preset number of units. List data with 1 unit is stored in the A storage area, list data with 2 units is stored in the B storage area, list data with 3 units is stored in the C storage area, and so on. The apparatus sets multiple storage areas for storing list data of different numbers of units.
[0078] In this regard, after obtaining the first digital number, the apparatus determines the number of units of the first list data.
[0079] In step S32, the storage area corresponding to the number of units is determined as the first target storage area corresponding to the first list data, wherein each storage area is used to store list data of a preset number of units.
[0080] The apparatus determines the storage area corresponding to the number of units as the first target storage area corresponding to the first list data. For example, the unit is a single character, and the list data has 4 characters. The target storage area corresponding to the list data is the storage area for storing list data of 4 units.
[0081] In the embodiment, the storage area is used to store list data of a preset number of units, so that list data with the same digital number is not stored in the same storage area, that is, list data not stored in the storage area is not queried as a storage state.
[0082] In an embodiment, after step S30, the method further includes:
[0083] When the first digital number is greater than the preset number, the number of bits of the first bitmap is increased to a target number to obtain a second bitmap, and the target number is the same as the value corresponding to the first digital number.
[0084] The value corresponding to the bit located at the end of the second bitmap is set as a preset value.
[0085] In the embodiment, after obtaining the first digital number corresponding to the first list data, the device judges whether the first digital number is less than or equal to a preset number. If the first digital number is greater than the preset number, the bitmap cannot store the list data. In this case, the device increases the number of bits of the first bitmap to a target number to obtain a second bitmap. For example, the preset number is 500, and the first bitmap has 500 bits in total. If the first digital number is 1000, the number of bits of the first bitmap is increased to 1000. It can be understood that the target number is the same as the value corresponding to the first digital number.
[0086] The device sets the value of the bit located at the end of the second bitmap as a preset value, so as to store the first list data corresponding to the first digital number.
[0087] In the embodiment, when the first digital number is greater than the preset number, the bitmap needs to be expanded to store the list data corresponding to the first digital number, that is, the device increases the number of bits of the bitmap when expansion is needed, so as to ensure that the device does not set a too large storage space to store the list data.
[0088] Reference Figure 5 , Figure 5 The fourth embodiment of the list data storage method of the application is based on any one of the first to third embodiments, and after step S50, the method further includes:
[0089] In step S60, the second list data to be queried is obtained, and a third digital number corresponding to the second list data is determined.
[0090] In the embodiment, the first list data is blacklist data or whitelist data. Therefore, the device has the function of querying whether the list data is blacklist data or whitelist data.
[0091] In this case, when the device receives the query request, the device parses the query request to obtain the list data to be queried. The list data to be queried is defined as the second list data. The device determines the digital number corresponding to the second list data, and the digital number is defined as the third digital number. The determination process of the third digital number is the same as that of the first digital number, and will not be described here.
[0092] Step S70, determining a second target storage region corresponding to the second list data in each storage region, and determining a second target bit corresponding to the third digital number in the third bitmap, wherein the third bitmap is a bitmap in the second target storage region.
[0093] After determining the third digital number, the device determines a second target storage region corresponding to the second list data in each storage region, and determines a second target bit corresponding to the third digital number in the third bitmap. The third bitmap is a bitmap in the second target storage region. The determination process of the second target storage region is the same as that of the first target storage region, and the determination process of the second target bit is the same as that of the first target bit, which will not be described here.
[0094] Step S80, when the value on the second target bit is a preset value, determining that the second list data is white list data or black list data.
[0095] Step S90, when the value on the second target bit is not a preset value, determining that the second list data is not white list data or black list data.
[0096] When the value on the second target bit is a preset value, it can be determined that the second list data is white list data or black list data, and the device can output prompt information that the second list data is white list data or black list data. That is, when the query request is a white list query, prompt information that the second list data is white list data is output; when the query request is a black list query, prompt information that the second list data is black list data is output.
[0097] When the value on the second target bit is not a preset value, it can be determined that the second list data is not white list data or black list data, and the device can output prompt information that the second list data is not white list data or black list data. That is, when the query request is a white list query, prompt information that the second list data is not white list data is output; when the query request is a black list query, prompt information that the second list data is not black list data is output.
[0098] In the technical solution provided in the embodiment, after storing the first list data, if it is necessary to query whether the list data is white list data or black list data, the device determines a third digital number corresponding to the list data to be queried, determines a target bit corresponding to the third digital number, and thus accurately determines whether the list data to be queried is black list data or white list data according to whether the target bit is a preset value.
[0099] The application also provides a list data storage device, which refers to Figure 6 The list data storage device 600 comprises:
[0100] The setting module 610 is configured to set the number of bit positions of the bitmap in each storage region to a preset number, where the preset number is less than the maximum number of bit positions accommodated by the storage region.
[0101] The obtaining module 620 is configured to obtain first list data to be stored, and determine a first digital number corresponding to the first list data.
[0102] The determining module 630 is configured to determine a first target storage region corresponding to the first list data in each storage region.
[0103] The determining module 630 is configured to determine a first target bit position corresponding to the first digital number on the first bitmap when the first digital number is less than or equal to the preset number, where the first bitmap is a bitmap in the first target storage region, and the first target bit position has the same number as the first digital number in the first bitmap.
[0104] The setting module 610 is configured to set a value on the first target bit position to a preset value, where the preset value is used to indicate that the first list data corresponding to the first digital number is stored.
[0105] In an embodiment, the storage device 600 for list data includes:
[0106] The determining module 630 is configured to determine a second digital number corresponding to each unit in the first list data, where the first list data is data composed of characters, and the unit is a single word group or a single character in the first list data.
[0107] The combining module is configured to combine the second digital number corresponding to each unit to obtain the first digital number corresponding to the first list data.
[0108] In an embodiment, the storage device 600 for list data includes:
[0109] The obtaining module 620 is configured to obtain a position of each unit in the first list data.
[0110] The combining module is configured to combine the second digital number corresponding to each unit to obtain the first digital number according to the position, where the position of the second digital number corresponding to each unit in the first digital number is the same as the position of each unit in the first list data.
[0111] In an embodiment, the storage device 600 for list data includes:
[0112] The determining module 630 is configured to determine the number of units of the first list data.
[0113] The determining module 630 is configured to determine a storage area corresponding to the number of units as a first target storage area corresponding to the first list data, wherein each storage area is configured to store list data of a preset number of units.
[0114] In an embodiment, the storage device 600 of the list data comprises:
[0115] The processing module is configured to increase the number of bit positions of the first bitmap to a target number to obtain a second bitmap when the first digital number is greater than the preset number, and the target number is the same as the value corresponding to the first digital number.
[0116] The setting module 610 is configured to set a value corresponding to a bit position at the end of the second bitmap as a preset value.
[0117] In an embodiment, the storage device 600 of the list data comprises:
[0118] The obtaining module 620 is configured to obtain second list data to be queried, and determine a third digital number corresponding to the second list data.
[0119] The determining module 630 is configured to determine a second target storage area corresponding to the second list data in each storage area, and determine a second target bit position corresponding to the third digital number in a third bitmap, wherein the third bitmap is a bitmap in the second target storage area.
[0120] When the value on the second target bit position is the preset value, it is determined that the second list data is white list data or black list data.
[0121] The determining module 630 is configured to determine that the second list data is not white list data or black list data when the value on the second target bit position is not the preset value.
[0122] Figure 7 FIG. 7 is a hardware structure diagram of a storage device of list data according to an exemplary embodiment.
[0123] The storage device 700 of the list data can comprise a processor 701, such as a CPU, a memory 702 and a transceiver 703. Those skilled in the art can understand that, Figure 7The structure shown in the figure does not constitute a limitation on the storage device of the list data, and can include more or fewer components than those shown, or combine certain components, or different arrangement of components. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0124] The processor 701 can invoke the computer program stored in the memory 702 to complete all or part of the steps of the list data storage method described above.
[0125] The transceiver 703 is used to receive information sent by an external device and send information to the external device.
[0126] A non-transitory computer readable storage medium, when the instructions in the storage medium are executed by the processor of the list data storage device, enable the list data storage device to perform the list data storage method described above.
[0127] A computer program product, comprising a computer program, when the computer program is executed by the processor of the list data storage device, enables the list data storage device to perform the list data storage method described above.
[0128] Other embodiments of the present disclosure will be readily apparent to those skilled in the art upon considering the specification and practice of the disclosed application. The present application is intended to cover any variations, uses or adaptive changes of the present disclosure following the general principles thereof and including those expressly disclosed in the specification and those known to those skilled in the art or custom in the art. The specification and examples are regarded only as illustrative, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0129] It should be understood that the present disclosure is not limited to the precise structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A list data storage method characterized by comprising: The method comprises the following steps: setting the bit number of the bitmap in each storage area to a preset number, wherein the preset number is less than the maximum number of bit positions that the storage area can accommodate; obtaining first list data to be stored, and determining a second digital number corresponding to each unit in the first list data, wherein the first list data is composed of characters, and the unit is a single word group or a single character in the first list data; combining the second digital numbers corresponding to each unit to obtain a first digital number corresponding to the first list data; wherein the second digital numbers corresponding to each unit are combined to obtain the first digital number based on the position of the unit in the first list data; determining a first target storage area corresponding to the first list data in each storage area; wherein the first target storage area is a storage area corresponding to an identifier determined based on each attribute of the first list data; the attributes include channel identifier, type, and scope name; when the first digital number is less than or equal to the preset number, determining a first target bit position corresponding to the first digital number on a first bitmap, wherein the first bitmap is a bitmap in the first target storage area, and the first target bit position has the same number as the first digital number in the first bitmap; setting the value of the first target bit position to a preset value, wherein the preset value is used to indicate that the first list data corresponding to the first digital number is stored; when the first digital number is greater than the preset number, increasing the number of bit positions of the first bitmap to a target number to obtain a second bitmap, wherein the target number is the same as the value corresponding to the first digital number; setting the value corresponding to the bit position at the end of the second bitmap to the preset value.
2. The list data storage method according to claim 1, wherein The step of combining the second digital numbers corresponding to each unit to obtain the first digital number corresponding to the first list data comprises: obtaining the position of each unit in the first list data; combining the second digital numbers corresponding to each unit to obtain the first digital number according to the position, wherein the position of each unit in the first digital number is the same as the position of each unit in the first list data.
3. The list data storage method of claim 1, wherein The step of determining the target storage area corresponding to the first list data in each storage area comprises: determining the number of units of the first list data; determining the storage area corresponding to the number of units as the first target storage area corresponding to the first list data, wherein each storage area is used to store list data of a preset number of units.
4. The list data storage method according to any one of claims 1 to 3, characterized by, The first list data is white list data or black list data, and after the step of setting the value of the target bit position to a preset value, the method further comprises: obtaining second list data to be queried, and determining a third digital number corresponding to the second list data; determine a second target storage region corresponding to the second list data in each of the storage regions, and determine a second target bit position corresponding to the third digital number in a third bitmap, wherein the third bitmap is a bitmap in the second target storage region; when a value at the second target bit position is the preset value, determine that the second list data is white list data or black list data; when the value at the second target bit position is not the preset value, determine that the second list data is not white list data or black list data.
5. A storage device for list data, characterized by Comprising: a setting module, configured to set a bit position number of a bitmap in each storage region as a preset number, wherein the preset number is less than a maximum number of bit positions accommodated by the storage region; an obtaining module, configured to obtain first list data to be stored, and determine a first digital number corresponding to the first list data; a determining module, configured to determine a first target storage region corresponding to the first list data in each of the storage regions; wherein the first target storage region is a storage region corresponding to an identifier determined based on each attribute of the first list data; the attributes include: a channel identifier, a type, a scope name; the determining module is further configured to, when the first digital number is less than or equal to the preset number, determine a first target bit position corresponding to the first digital number in a first bitmap, wherein the first bitmap is a bitmap in the first target storage region, and the first target bit position has the same number as the first digital number in the first bitmap; the setting module is further configured to set a value at the first target bit position as a preset value, wherein the preset value is used to indicate that the first list data corresponding to the first digital number is stored; the determining module is further configured to determine a second digital number corresponding to each unit in the first list data, wherein the first list data is data composed of characters, and the unit is a single word group or a single character in the first list data; a combining module, configured to combine the second digital number corresponding to each unit to obtain the first digital number corresponding to the first list data; wherein the second digital number corresponding to each unit is combined to obtain the first digital number based on a position of the unit in the first list data; a processing module, further configured to, when the first digital number is greater than the preset number, increase a bit position number of the first bitmap to a target number to obtain a second bitmap, wherein the target number is the same as a value corresponding to the first digital number; a setting module, configured to set a value corresponding to a bit position at the end of the second bitmap as the preset value.
6. A storage device for list data, characterized by Comprising: a memory and a processor; the memory is provided with a plurality of storage regions, and the memory stores computer execution instructions; the storage regions are used to store list data; the processor executes the computer execution instructions stored by the memory, so that the processor executes the list data storage method in any one of claims 1 to 4.
7. A computer readable storage medium characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are used for realizing the list data storage method in any one of claims 1 to 4 when executed by the processor.
8. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to realize the list data storage method in any one of claims 1 to 4.
Citation Information
Patent Citations
Data storage method and device, data reading method and device and computer equipment
CN109597571A
Data processing method and device, computer equipment and storage medium
CN112732717A