Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. The same or similar reference numbers are used in the drawings to refer to the same or similar modules. It is to be understood that the drawings are merely illustrative and that the scope of the application is not limited thereto.
In recent years, new generation information technologies represented by 5G, big data, artificial intelligence and the like accelerate innovative application, and promote the development of various fields of economy and society to digitization, intellectualization and networking. The 5G message is a new state which appears when the information technology is in great innovation, and provides a new development track for all parties of the information service industry chain.
The 5G message brings a brand new man-machine interaction mode, and the 5G industry message is in the form of a chat robot, so that a user can complete one-stop business experience such as service searching, discovery, interaction, payment and the like in a message window, and a brand new information service entrance is constructed. For example, through a short message portal native to the terminal, government and business services may be delivered directly to users, who may also search and select services through directory service functionality. These services are presented in the form of rich media (including text, pictures, audio and video) messages and interactive cards on the user's message interface, and the user can communicate with or use the service provider at any time, enjoying more convenient, intelligent, and humanized services. The industry clients can reach the users more effectively, obtain more user feedback and establish closer contact with the users.
Although the promotion of 5G messages and business are mature gradually, a large number of users still use 4G terminals at present, some terminal manufacturers do not support 5G messages, and governments, enterprises and the like cannot reach all users through 5G messages, so that the communication efficiency of 5G messages is low and management is difficult to unify. The original state of the 5G message can be 5G reading and 5G viewing.
The content length of a single sms is generally limited in the related art, and when a sms including a uniform resource locator (uniform resource locator, URL) is to be sent, too many useless words are occupied if the URL is too long. It is therefore necessary to convert long URLs into short URLs, i.e. short links or short addresses.
The 5G reading is a message sending mode for sending the rich media message in a short message mode, and the short chain is embedded in the short message, so that the mobile phone terminal can pull and display the rich media message data according to the short chain. The short message is essentially a short message with a special short chain, and after the short message is sent to the terminal equipment, the short chain of the short message can be identified, and the content behind the short chain can be automatically analyzed and rendered. The related steps include reporting the standby message reading card template, namely, the standby message reading card template needs to be reported to a terminal manufacturer in advance, acquiring a message reading short chain, namely, acquiring a short chain corresponding to the message reading card template from the terminal manufacturer, then sending a short message, namely, the short message content carries the message reading short chain, and sending a traditional short message to a short message gateway of an operator. The terminal equipment identifies short chains, analyzes the message reading template, and displays the traditional short message content without influencing the terminal to receive the short message.
Related art before sending 5G reading, it is necessary to generate a short chain according to the content of the message, and store the dynamic data in the message in MySQL database or Redis database. After receiving the 5G reading message, the user accesses the server to pull the corresponding data by analyzing the short chains in the short message. However, since the personalized short chain needs to be generated according to the user identifier, the data volume is very large, and the mass short chain and the personalized short chain are mixed together to form massive data. The related technology stores the short chain and dynamic data in the message in the database, and has the problems of low efficiency and resource waste in the aspects of searching the needed short chain and dynamic data information in the massive data.
Therefore, it is necessary to design a technical solution for retrieving short-chain and dynamic data in a message with high efficiency.
Based on the above, the embodiment of the application provides a method for generating short chains, which is applied to a server. The server may be a server where the short link service platform is located. The method for generating short chains according to the embodiment of the present application will be described in detail with reference to fig. 1. As shown in fig. 1, the method for generating short chains according to the embodiment of the present application mainly includes steps S110 to S130, and these steps are described in detail below.
It should be noted that, the sequence number of each step in the embodiment of the present application does not mean the sequence of execution sequence, and the execution sequence of each process should be determined by the function and the internal logic of each process, and should not limit the implementation process of the embodiment of the present application in any way.
In step S110, a first short code is generated based on the random factor, the first message template identifier, and the first data amount interval. The random factor is a random character string, the first data volume interval is any interval of a plurality of data volume intervals corresponding to the first message template, and the first message template identifier is an identifier corresponding to the first message template.
The reading may employ a plurality of message templates, and the first message template may be any one of the plurality of message templates. The plurality of message templates corresponds to a plurality of different message template identifiers. One message template may correspond to a plurality of short chains, and a plurality of short chains corresponding to the same message template may be divided into sections. The data volume interval refers to dividing data according to a certain range to form different intervals, and in the database term, an interval refers to any continuous block allocated to an object (such as a table).
In some embodiments, one message template may correspond to 99 000 short chains, and the total number of data volume intervals may be 99, where each data volume interval includes 1000 short chains, i.e., the data volume interval value of each 1000 short chains is incremented by 1. For example, the first 1000 short-chain data size interval is 1, the second 1000 short-chain data size interval is 2, the data size interval is up to 99, and metering is restarted from 1 after the data size interval is exceeded. The number of short chains in a single data size interval can be determined according to practical situations, or can be 2000, 3000, etc., and the comparison of the embodiment of the application is not limited.
The short code may be a text identification code that uniquely identifies the content of a message (e.g., a letter) during the expiration date. The first short code is one of a plurality of short codes.
The random factor may be a random number or a random node number. The embodiment of the present application is not limited as long as it has randomness with respect to specific data of the random factor. By adding the random factor, the generated short-chain sequence has higher randomness and no general regularity.
In step S120, a first short chain is generated based on the domain name and the first short code. The first short code is an identifier of a first short chain, the first short chain is a short chain corresponding to reading, and the first short chain is any short chain in a plurality of short chains in the first data volume interval.
The reading is a short message (message) with a short chain, and the short chain corresponds to a message template of the reading. The first short chain is one of a plurality of short chains corresponding to the first message template for reading.
Short chains are relatively long links. For the application scenario of N long links, the user side may request to generate each short link corresponding to one, that is, one short link corresponds to one long link.
The short link length can represent the number of bits of the short link, and the user configures the number of bits of the short link according to own requirements. A link, which may also be referred to as a URI, is a string used to identify a certain internet resource name. The short URI may consist of 66 characters, namely a 66-digit 66-ary string, of letters A-Z, a-z, 0-9, ' - ' (denoting minus sign), ' _' (denoting underline), ' (denoting period), and' to ' (denoting wave number).
It should be noted that the short URI may also be composed of 62 characters, i.e. 62-bit 62-system character strings, such as letters a-Z, a-z and 0-9, and in practical application, one (62 bits or 66 bits) may be selected. If other binaries are to be implemented, new characters are added or deleted, but the new characters added ensure that the characters used are legal characters allowed to be used by the URL, and generally 62 or 66 binaries are used. The embodiment of the application does not limit the constituent characters of the short links in particular.
In step S130, the first short chain and the dynamic data corresponding to the first short chain are stored in the target database based on the first short code.
The data of the message reading template can be dynamic data, and the dynamic data allows a user to flexibly change and screen the data according to the needs, so that specific requirements can be better met. For example, by creating dynamic reports, users can change data according to their own specifications, and such reports can be used for a variety of purposes, thereby saving organization and time resources. Creation of dynamic data involves writing SQL queries, connecting to databases, creating parameters, and adjusting code in the SQL queries to access the new parameters.
The target database can be arranged in the short link server or can be independent of a database outside the short link server corresponding to the short link service platform and is in communication connection with the short link service platform. The embodiment of the present application is not limited thereto.
The target database may be configured to store an index of the local short chain, and after obtaining the N short chains, store an index relationship between the N short chains and the long chain information in the database. For an application scenario in which the long-chain information includes one long-chain link, the index relationships between the N short-chains and the long-chain are stored in the database. For an application scenario in which the long chain information includes N long chains, storing index relationships of one-to-one correspondence between target short chains and long chains in a database. So that when the short chain is clicked or viewed, the page of the long chain corresponding to the short chain can be jumped to, namely, the short chain is clicked, and the jumped page is the business page of the long chain. The business page information includes one of a long chain, a long chain Identifier (ID), an applet ID, etc., which helps to improve convenience of business services.
In some implementations, the target database may be any of a remote dictionary service (remote dictionary server, redis) database, a MySQL database.
According to the embodiment of the application, the short code of the short chain for reading the message is generated according to the random factor, the first message template identifier for reading the message and the first data volume interval where the short chain is located. Short code information shows a short chain corresponding message template identifier and a data volume interval where the short chain is located, and the generated short chain sequence has higher randomness and no general regularity by increasing a random factor. The embodiment of the application is beneficial to ensuring the uniqueness of the short chains, improving the retrieval efficiency of the short chains and reducing the time required for searching the short chains of specific targets and the corresponding parameters thereof in mass data.
In some implementations, the method of generating the first short code in step S110 based on the random factor, the first message template identifier, and the first data volume interval may include generating the first short code based on the random factor, the short chain type of the first short chain, the first message template identifier, and the first data volume interval. The short chain types may include group-shot short chains and personalized short chains. The short code generation method combined with the short chain type is beneficial to reducing the search range and further improving the retrieval efficiency of the short chain.
In some implementations, generating the first short code based on the random factor, the short chain type of the first short chain, the first message template identifier, and the first data volume interval may include encoding the first message template identifier of the reading message to obtain an encoded first message template identifier, and generating the first short code based on the random factor, the short chain type of the first short chain, the encoded first message template identifier, and the first data volume interval. Encoding the first message template identifier to obtain an encoded message template identifier, which is helpful for protecting the message template identifier, preventing information of the message template identifier from being revealed and shortening the length. There are various ways to encode the message template identifier of the reading message, for example, the message template identifier of the reading message may be base64 encoded first and then converted to be shorter.
The embodiment of the application does not limit the sequence of the short chain type for generating the first short code, the coded first message template identifier, the first data volume interval where the short chain is located and the random factor. In some embodiments, the first short code may be generated in the order of the random factor + short chain type + encoded first message template identifier + first data volume interval. In other embodiments, the first short code may be generated in the order of short chain type + random factor + encoded first message template identifier + first data volume interval. The order of the short chain types is preceded by facilitating first identifying the type of short chain and then further searching.
In some implementations, the first short chain is any one of a plurality of short chains, the plurality of short chains corresponding to the plurality of short codes. The storing of the first short chain and the dynamic data corresponding to the first short chain in the target database based on the first short code in step S130 may include determining a plurality of slot values to be stored according to information of the plurality of short codes, determining a plurality of nodes of the target database corresponding to the plurality of slot values according to the plurality of slot values, and storing the dynamic data corresponding to the plurality of short chains and the plurality of short chains in a plurality of nodes of the target database in a scattered manner. The data are uniformly distributed on different nodes, so that the query speed and the load balance of the system are improved.
In some implementations, the method of embodiments of the present application may further include writing the first short chain to an access filter, the access filter to limit invalidation requests and/or repeated queries against the first short chain. The access filter can be a bloom filter, and the efficient weight judging function of the bloom filter is utilized, so that the query efficiency of the system is improved.
According to the embodiment of the application, short codes of short chains in reading are generated according to the random factor, the first message template identifier of the reading and the first data volume interval where the short chains are located. Short code information shows a short chain corresponding message template identifier and a data volume interval where the short chain is located, and the generated short chain sequence has higher randomness and no general regularity by increasing a random factor. The embodiment of the application is beneficial to ensuring the uniqueness of the short chains, improving the retrieval efficiency of the short chains and reducing the time required for searching the short chains of specific targets and the corresponding parameters thereof in mass data.
The embodiment of the application provides a wireless communication method, which is applied to a server. The server may be a short link service platform. A method of wireless communication according to an embodiment of the present application is described in detail below with reference to fig. 2. As shown in fig. 2, the method for generating short chains according to the embodiment of the present application mainly includes steps S210 to S240, and these steps are described in detail below.
In step S210, a first access request is received from a terminal device, the first access request being an access request for a first short chain.
The first short chain is a short chain corresponding to reading, the first short chain is generated based on the domain name and a first short code, and the first short code is an identifier of the first short chain. The first short code is generated based on the random factor, the first message template identifier, and the first data amount interval. The random factor is a random character string, the first data volume interval is any interval of a plurality of data volume intervals corresponding to the read first message template, the first message template identifier is an identifier corresponding to the first message template, and the first short chain is any short chain of a plurality of short chains of the first data volume interval. The first message template is any one of a plurality of message templates for reading messages.
In step S220, the first short chain is parsed, and parsing information of the first short chain is obtained.
The message template identifier forming the first short code and the data volume section where the short chain is located can be obtained through the analysis information of the first short chain.
In step S230, according to the analysis information of the first short chain, the target data corresponding to the first short chain is obtained.
The target data may be dynamic data corresponding to the first short chain. For example, dynamic data corresponding to the first short chain stored in the target database can be retrieved according to the first short code. The target data may also be dynamic data corresponding to the first short chain, and a mapping relationship between the first short chain and the long chain.
In step S240, the target data is transmitted to the terminal device.
And when the short chain is clicked or checked, the terminal equipment can jump to a service page of a long chain corresponding to the short chain. The service page information may include one of a long chain, a long chain ID, an applet ID, etc.
In some implementations, the first short code is generated based on a short chain type of the first short chain, the first message template identifier, and the first data volume interval. The step S230 of obtaining the target data corresponding to the first short chain according to the resolution information of the first short chain may include determining, according to the resolution information of the first short chain, a short chain type of the first short chain, where the short chain type is one of a personalized short chain and a group sending short chain, and obtaining the target data corresponding to the first short chain according to the short chain type and the resolution information of the first short chain.
In some implementations, the obtaining the target data corresponding to the first short chain according to the short chain type and the analysis information of the first short chain may include invoking an access filter adapted to the short chain type to filter the first short chain according to the short chain type of the first short chain, determining a query type of the first short chain according to a filtering result of the access filter, obtaining the target data corresponding to the first short chain from a target database according to the analysis information if the first short chain is a first query, where the target database is a database storing dynamic data corresponding to the first short chain and the first short chain, and obtaining the target data corresponding to the first short chain from a local cache if the first short chain is a repeated query. Invalid requests (e.g., expired short chains, non-existent short chains) may be filtered out by accessing the filter to reduce the load on the target database and promote the query rate per second (queries per second, QPS) of the interface. QPS is the number of requests a system can handle per second and is a measure of how much traffic a particular query server handles in a specified time. And the local caching mechanism is used for reducing repeated inquiry to the target database, improving the parameter inquiry efficiency and improving the overall performance of the system.
In some implementations, if the first short chain is the first query, the method of the embodiment of the application may further include storing target data corresponding to the first short chain obtained from the target database in the local cache region. Helping to reduce repeated queries to the target database.
In the embodiment of the application, the short code corresponding to the short chain in reading is generated based on the random factor, the first message template identifier and the first data volume interval where the short chain is located. Short code information shows a short chain corresponding message template identifier and a data volume interval where the short chain is located, and the generated short chain sequence has higher randomness and no general regularity by increasing a random factor. And acquiring target dynamic data corresponding to the short chain according to the information (namely the analysis information) of the short code. The embodiment of the application is beneficial to ensuring the uniqueness of the short chains, improving the retrieval efficiency of the short chains and reducing the time required for searching the short chains of specific targets and the corresponding parameters thereof in mass data.
The method according to the embodiment of the present application will be further described below with reference to possible implementation manners of the embodiment of the present application.
Fig. 3 is a flow diagram of one possible implementation of the method of fig. 1. The method of fig. 3 may be applied to a communication system that may include a client 310, a server 320, and a dis database 330.
The client 310 is a user device that sends an access request for a first short chain in a subscription.
A client in an embodiment of the present application may also be referred to as a terminal, a User Equipment (UE), a user terminal, an access terminal, a subscriber unit, a subscriber station, a Mobile Station (MS), a Mobile Terminal (MT), a remote terminal, a remote station, a mobile device, a wireless communication device, a user agent, or a user equipment. The client in the embodiment of the application can be a device for providing voice and/or data connectivity for a user, and can be used for connecting people, objects and machines, such as a handheld device with a wireless connection function, a vehicle-mounted device and the like. The terminal device in the embodiments of the present application may be a mobile phone (mobile phone), a tablet (Pad), a notebook, a palm, a Mobile Internet Device (MID), a wearable device, a Virtual Reality (VR) device, an augmented reality (augmented reality, AR) device, a wireless terminal in industrial control (industrial control), a wireless terminal in unmanned (SELF DRIVING), a wireless terminal in teleoperation (remote medical surgery), a wireless terminal in smart grid (SMART GRID), a wireless terminal in transportation security (transportation safety), a wireless terminal in smart city (SMART CITY), a wireless terminal in smart home (smart home), and the like.
Server 320 may be a device in communication with client 310, and server 320 may be, for example, a server on which a short link service platform resides. Server 320 may include a local cache 321 and a bloom filter 322.
Redis database 330 is a target database and may be provided in server 320. Redis database 330 may be a database independent of the server 320 corresponding to the short link service platform, and may be communicatively connected to server 320.
Specifically, the method of the embodiment of the present application is applied to the server 320. As shown in fig. 3, the method for generating short chains according to the embodiment of the present application mainly includes steps S310 to S330, and these steps are described in detail below.
In step S310, a short chain is generated.
The short chain consists of a domain name and a short code. The short code is a short chain unique identification, and the short code library can be a character string. The short code may comprise a short chain type, an encoded message template identifier (first message template identifier) and a first data volume interval in which the short chain is located. The specific format may be:
short code = random factor + short chain type + base64 encoded read message template ID + first data size interval.
When the short chain is generated, the base64 coding is firstly carried out on the read message template identifier, and then the read message template identifier after the base64 coding is combined with the random factor, the short chain type and the first data volume interval to form the short code. The method comprises the steps of generating a first short code according to a random factor, a short chain type and a first data volume interval of a read message template ID after base64 encoding, and generating a first short chain according to a domain name and the first short code. This helps to ensure uniqueness and traceability of the short chain.
Wherein the random factor is a random character string. The embodiment of the present application is not limited as long as it has randomness with respect to specific data of the random factor. By adding the random factor, the generated short-chain sequence has higher randomness and no general regularity.
Illustratively, the random factor may be a/v1Rk, short chain type 1, coded message template identifier NTAWMDAWMDA, and data interval 99. The final short code is a/v1Rk1NTAWMDAWMDA to 99. It will be appreciated that the number of bits of the components in the short code, such as the random factor, the encoded message template identifier, is typically fixed.
In some embodiments, one message template may correspond to 99 000 short chains, and the total number of data volume intervals may be 99, where each data volume interval includes 1000 short chains, i.e., the data volume interval value of each 1000 short chains is incremented by 1. For example, the first 1000 short-chain data size interval is 1, the second 1000 short-chain data size interval is 2, the data size interval is up to 99, and metering is restarted from 1 after the data size interval is exceeded. The number of short chains in a single data volume interval can be determined according to practical situations, and can also be 2000, 3000 and the like.
In step S320, the short chain and the corresponding dynamic data are stored.
When data is stored, the slot value to be stored in the Redis database 330 is determined by calculating according to the short chain type in the short code, the message template identifier after base64 encoding and the first data volume interval, and the corresponding node is determined according to the slot value, so that the data is uniformly distributed on different nodes of the target database.
The dynamic data may include rich media content, user personalized settings, and the like. Through the partition storage strategy, the waste of storage resources is reduced, the storage and query efficiency can be effectively optimized, and the query speed of the Redis database and the load balancing of the system can be improved.
In particular, the Redis database may divide all hash slots equally onto different nodes, each of which is responsible for processing data of a portion of the hash slots. For example, a Redis database has 3 nodes, 3 nodes are responsible for processing 16384 hash slots, and each node is responsible for processing hash slots ranging from 0-5460 for the first node, 5461-10922 for the second node, and 10923-16383 for the third node.
Illustratively, a short code may be hashed using a cyclic redundancy check (cyclic redundancy check, CRC) 16 algorithm, then UTF-8 encoded, and modulo 16384 to obtain the slot value. Where 16384 is the maximum number of Redis slots, UTF-8 (Unicode transformation format-8) is a variable length character encoding for Unicode.
When the client 310 needs to access a key-value pair, the Redis database calculates a hash value according to the key name, and maps the hash value to a hash slot (slot value). Then, the Redis database transmits the key value pair to the corresponding node for processing according to the distribution condition of the hash slots.
In step S330, the short chain is written to the bloom filter.
The generated short chains are written into the bloom filter, and the efficient weight judging function is utilized, so that invalid requests and repeated queries are avoided, and the query efficiency of the system is improved.
According to the embodiment of the application, the short codes corresponding to the short chains in reading are generated according to the random factor, the short chain type and the base64 coded message template identifier and the data volume interval, so that the uniqueness of the short chains is ensured. Short code information shows a short chain corresponding message template identifier and a data volume interval where the short chain is located, and the generated short chain sequence has higher randomness and no general regularity by increasing a random factor. According to the embodiment of the application, the short chains and dynamic data are uniformly distributed on different nodes, and the generated short chains are written into the bloom filter. The embodiment of the application is beneficial to reducing the waste of storage resources, optimizing the storage and improving the retrieval efficiency of the short chains, avoiding invalid requests and repeated queries, and reducing the time required for searching the specific target short chains and the corresponding parameters thereof in mass data.
Fig. 4 is a flow diagram of one possible implementation of the method of fig. 2. The process of the method of fig. 4 is also the process of the pull request processing. As shown in fig. 4, the method of wireless communication according to the embodiment of the present application may mainly include steps S410 to S450, and these steps are described in detail below.
First, the client 310 sends a short chain, i.e. an access request (a pull request) for a first short chain, to the server 320. After receiving the request for pulling the parameter, the server 320 performs processing of the request for pulling the parameter.
In step S410, the type of short chain is parsed.
After receiving the parameter pulling request, the short chain is firstly analyzed, the type of the short chain is identified, and whether the short chain is a group short chain or a personalized short chain is determined for subsequent processing.
In step S420, a bloom filter is invoked.
According to the short chain type, the corresponding bloom filter 322 is invoked. Bloom filter 322 may filter out invalid requests (e.g., expired short chains, non-existent short chains), returning the filtering results to server 320. Invoking bloom filters helps to reduce the load of the Redis database, enhancing the QPS of the interface.
In step S430, the local cache is checked.
It is checked whether the local buffer 321 has corresponding parameter information. If so, the cache data is directly obtained from the local cache area 321 and returned, which is helpful to reduce the inquiry time and the system resource consumption.
If there is no local buffer 321, then the next operation is performed.
In step S440, the short chain is parsed and the Redis database is retrieved.
The short chain type of the short chain inner short code, the read message template identifier after the base64 coding and the data volume interval are analyzed, and the corresponding data (including dynamic data) is searched by using the numerical values and the short chain information to the Redis database.
In step S450, the local buffer is updated.
Target data obtained from the Redis database is written into the local buffer 321 for subsequent quick queries. The local buffer 321 performs buffer data update after receiving the target data.
And returns the target data to the requestor client 310 to complete the parameter pulling process.
Fig. 5 is a flow diagram of another possible implementation of the method of fig. 2. As shown in fig. 5, the method of wireless communication according to the embodiment of the present application may mainly include steps S510 to S570, which are described in detail below.
In step S510, a request for a pull-up is received, i.e., a request for a pull-up for a short chain in the reading.
In step S520, the type of short chain is parsed.
The type of short chain is identified, and whether the short chain is a group-sending short chain or a personalized short chain is determined for subsequent retrieval.
In step S530, a bloom filter is invoked.
According to the short chain type, the corresponding bloom filter is invoked. For example, the short chain type is a personalized short chain, and the corresponding bloom filter of the personalized short chain is invoked. The load of the Redis database is reduced, and the QPS of the interface is improved.
In step S540, it is checked whether the local cache hits.
And checking whether the corresponding parameter information exists in the local buffer area. For example, it may be checked whether the local buffer has corresponding parameter information based on a short-chain identifier (i.e., a short code). If present, step S570 is entered, and if not present in the local cache, step S550 is entered.
In step S550, the short chain is parsed and the Redis database is retrieved.
The short chain type of the short chain inner short code, the message template identifier coded by the base64 and the data volume interval are analyzed, and the corresponding data (including dynamic data) is retrieved by using the values and the short chain information to the Redis database.
In step S560, the local cache is updated.
And writing the target data obtained from the Redis database into a local cache area so as to facilitate subsequent quick inquiry. And after receiving the target data, the local cache area updates the cache data.
In step S570, the cache target data is directly obtained from the local cache area. And the inquiry time and the system resource consumption are reduced.
In step S580, the target data is returned to the requester, completing the parameter pulling process.
According to the embodiment of the application, the short codes corresponding to the short chains in reading are generated according to the random factor, the short chain type and the base64 coded message template identifier and the data volume interval, so that the uniqueness of the short chains is ensured. And the short code information displays a message template identifier corresponding to the short chain and a data volume interval where the short chain is positioned. The embodiment of the application evenly distributes the short chain and dynamic data on different nodes, writes the generated short chain into the bloom filter, is beneficial to reducing the waste of storage resources, optimizing the storage, improving the retrieval efficiency of the short chain and avoiding invalid requests and repeated queries. The embodiment of the application utilizes the local caching mechanism to cache the short chain parameters which are queried for the first time, is beneficial to reducing repeated query on the target database, improves the parameter query efficiency and reduces the time required for searching the specific target short chain and the corresponding parameters thereof in mass data.
Method embodiments of the present application are described above in detail in connection with fig. 1-5, and apparatus embodiments of the present application are described below in detail in connection with fig. 6-8. It is to be understood that the description of the device embodiments and the description of the method embodiments correspond to each other, and that parts not described in detail can therefore be seen in the preceding method embodiments.
The embodiment of the application provides a device for generating short chains. Fig. 6 is a schematic diagram of the apparatus for generating short chains according to an embodiment of the present application. As shown in fig. 6, the apparatus 600 for generating short chains may include a first generation module 610, a second generation module 620, and a storage module 630.
The first generation module 610 is configured to generate a first short code based on the random factor, the first message template identifier, and the first data volume interval. The random factor is a random character string, the first data volume interval is any interval of a plurality of data volume intervals corresponding to the first message template for reading, and the first message template identifier is an identifier corresponding to the first message template. The first message template is any one of a plurality of message templates for reading messages.
The second generation module 620 is configured to generate a first short chain based on the domain name and the first short code. The first short code is an identifier of a first short chain, and the first short chain is a short chain corresponding to reading.
The storage module 630 is configured to store the first short chain and dynamic data corresponding to the first short chain in the target database based on the first short code.
Optionally, the first generating module 610 is configured to generate the first short code based on the random factor, the short chain type, the first message template identifier, and the first data volume interval.
Optionally, the first generating module 610 is configured to encode the first message template identifier to obtain an encoded first message template identifier, and generate the first short code based on the random factor, the short chain type of the first short chain, the encoded first message template identifier, and the first data volume interval.
Optionally, the first short chain is any one of a plurality of short chains, and the plurality of short chains corresponds to the plurality of short codes. The storage module 630 is configured to determine a plurality of slot values to be stored according to information of the plurality of short codes, determine a plurality of nodes of the corresponding target database according to the plurality of slot values, and store dynamic data corresponding to the plurality of short chains and the plurality of short chains to the plurality of nodes of the target database in a scattered manner.
Optionally, the means 600 for generating short chains may further comprise an access filter. The access filter is written with a first short chain, and the access filter is used for limiting invalid requests and/or repeated queries aiming at the first short chain.
Optionally, the target database is any one of a remote dictionary service database and a MySQL database.
Fig. 7 is a schematic diagram of a wireless communication device according to an embodiment of the present application. The apparatus of wireless communication of fig. 7 is applied to a server. As shown in fig. 7, the apparatus 700 for wireless communication may include a receiving module 710, a parsing module 720, an acquiring module 730, and a transmitting module 740.
The receiving module 710 is configured to receive a first access request from a terminal device, where the first access request is an access request for a first short chain.
The parsing module 720 is configured to parse the first short chain to obtain parsing information of the first short chain.
The obtaining module 730 is configured to obtain target data corresponding to the first short chain according to the analysis information of the first short chain.
The sending module 740 is configured to send the target data to the terminal device.
The first short chain is a short chain corresponding to reading, and the first short chain is generated based on the domain name and the first short code. The first short code is an identifier of a first short chain, the first short code being generated based on the random factor, the first message template identifier, and the first data volume interval. The random factor is a random character string, the first data volume interval is any one interval of a plurality of data volume intervals corresponding to the first message template, the first message template identifier is an identifier corresponding to the first message template, and the first short chain is any one short chain of a plurality of short chains of the first data volume interval.
Optionally, the first short code is generated based on the random factor, the short chain type, the first message template identifier, and the first data volume interval. The obtaining module 730 is configured to determine a short chain type of the first short chain according to the parsing information of the first short chain, where the short chain type is one of a personalized short chain and a group sending short chain, and obtain target data corresponding to the first short chain according to the short chain type and the parsing information of the first short chain.
Optionally, the apparatus 700 for wireless communication further comprises a filtering module. The filtering module is used for calling an access filter corresponding to the short chain type according to the short chain type of the first short chain so as to filter the first short chain. The obtaining module 730 is configured to determine a query type of the first short chain according to a filtering result of the access filter, obtain, if the first short chain is a first query, target data corresponding to the first short chain from a target database according to analysis information of the first short chain, where the target database is a database storing dynamic data corresponding to the first short chain and the first short chain, and obtain, if the first short chain is a repeated query, target data corresponding to the first short chain from the local cache region.
Optionally, the apparatus 700 for wireless communication further comprises a storage module. The storage module is used for responding to the first short chain as the first inquiry and storing the target data corresponding to the first short chain obtained from the target database into the local cache region.
Fig. 8 is a schematic diagram of constituent units/portions of another apparatus for wireless communication according to an embodiment of the present application. The wireless communication apparatus of fig. 8 is applied to a server, and may be a server. As shown in fig. 8, an apparatus 800 for wireless communication may include a memory 810, at least one processor 820.
Memory 810 is used to store code or computer programs.
Processor 820 is coupled to memory 810 for executing code or computer programs stored in memory 810 to control apparatus 800 for wireless communication to perform a method as described in any of the foregoing.
By way of example, a computer program may be partitioned into one or more modules/units that are stored in memory 810 and executed by processor 820 to perform the present application.
Those skilled in the art will appreciate that fig. 8 is merely an example of a device 800 for wireless communication and is not intended to limit the charging cartridge. More or fewer components than shown may be included or certain components may be combined or different components. The wireless communication apparatus 800 provided in this embodiment may perform the above method embodiments, and its implementation principle and technical effects are similar, and will not be described herein.
Processor 820 may be a central processing unit (central processing unit, CPU), but may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSPs), application Specific Integrated Circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor, or the processor may be any conventional processor or the like.
Embodiments of the present application also provide a non-transitory computer readable storage medium storing a computer program which, when executed by a processor, performs the steps of the respective method embodiments described above.
Embodiments of the present application provide a computer program product which, when run on an electronic device, causes the electronic device to perform steps that may be carried out in the various method embodiments described above.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the above-described method embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and where the computer program, when executed by a processor, may implement the steps of the above-described method embodiments. Wherein the computer program comprises computer program code which may be in the form of source code, object code, executable files or in some intermediate form, etc. The computer readable medium can include at least any entity or device capable of carrying computer program code to a camera device/electronic apparatus, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (random access memory, RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and so forth. The computer readable storage medium mentioned in the present application may be a non-volatile storage medium, in other words, a non-transitory storage medium.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/device and method may be implemented in other manners. For example, the apparatus/device embodiments described above are merely illustrative, e.g., the division of modules or elements is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple elements or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "upon" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Furthermore, in the description of the present specification and the appended claims, the terms "first," "second," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance.
It should be noted that the above embodiments are merely for illustrating the technical solution of the present application and not for limiting the same, and although the present application has been described in detail with reference to the above embodiments, it should be understood by those skilled in the art that the technical solution described in the above embodiments may be modified or some or all of the technical features may be equivalently replaced, and these modifications or substitutions do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiments of the present application.