Short chain generation method, wireless communication method and device
By generating short codes based on random factors and message template identifiers, forming short chains and storing them in the database, the problem of low short chain search efficiency in massive data is solved, and efficient short chain search and resource optimization are achieved.
Patent Information
- Application Number
- CN202411376943.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-03
AI Technical Summary
The prior art is less efficient in retrieving 5G short-link and dynamic data information in massive data, and is seriously wasted resources.
By generating short codes based on random factors, message template identifiers and data volume intervals, short chains are formed and stored in the target database, and short chains are generated using domain names and short codes to ensure the uniqueness and efficient retrieval of short chains.
It improves the search efficiency of short chains, reduces the time required to find specific target short chains and their corresponding parameters in massive data, and reduces resource waste.
Smart Images

Figure CN119255202A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of wireless communication technology, and in particular to a method for generating a short link, a method and a device for wireless communication. Background Art
[0002] 5G reading is a message sending method that sends rich media messages in the form of text messages. By embedding short links in text messages, mobile terminals can pull rich media message data from the server based on the short links and display them. Before sending 5G reading, the relevant technical solution needs to generate short links based on the message content and store the dynamic data in the message in a MySQL database or a Redis database. After the user receives 5G reading, the short links in the text messages are parsed and the server is accessed to pull the corresponding data. The relevant technology has the problems of low efficiency and waste of resources in retrieving the required short links and text message dynamic data information from massive data. Summary of the invention
[0003] The present application provides a method for generating a short link, a method and device for wireless communication, and various aspects involved in the present application are introduced below.
[0004] In a first aspect, the present application provides a method for generating a short link, which is applied to a server, and the method includes: generating a first short code based on a random factor, a first message template identifier, and a first data volume interval, wherein the random factor is a random string, the first data volume interval is any one of multiple data volume intervals corresponding to a first message template of the letter reader, and the first message template identifier is an identifier corresponding to the first message template; generating a first short chain based on a domain name and the first short code, wherein the first short chain is any one of multiple short chains in the first data volume interval, and the first short code is an identifier of the first short chain; based on the first short code, storing the first short chain and the dynamic data corresponding to the first short chain in a target database.
[0005] In a second aspect, the present application provides a method for wireless communication, applied to a server, the method comprising: receiving a first access request from a terminal device, the first access request being an access request for a first short link; parsing the first short link to obtain parsing information of the first short link; acquiring target data corresponding to the first short link according to the parsing information of the first short link; sending the target data to the terminal device; wherein the first short link is generated based on a domain name and a first short code, the first short code is an identifier of the first short chain, the first short code is generated based on a random factor, a first message template identifier, and a first data volume interval, the random factor is a random character string, the first data volume interval is any one of multiple data volume intervals corresponding to a first message template of the message reader, the first message template identifier is an identifier corresponding to the first message template, and the first short chain is any one of multiple short chains in the first data volume interval.
[0006] In a third aspect, the present application provides a device for generating a short link, comprising: a first generation module, for generating a first short code based on a random factor, a first message template identifier, and a first data volume interval, wherein the random factor is a random string of characters, the first data volume interval is any one of a plurality of data volume intervals corresponding to a first message template of the message reader, and the first message template identifier is an identifier corresponding to the first message template; a second generation module, for generating a first short chain based on a domain name and the first short code, the first short chain is any one of a plurality of short chains in the first data volume interval, and the first short code is an identifier of the first short chain; a storage module, for storing the first short chain and the dynamic data corresponding to the first short chain into a target database based on the first short code.
[0007] In a fourth aspect, the present application provides a wireless communication device, which is applied to a server, and the device includes: a receiving module, which is used to receive a first access request from a terminal device, and the first access request is an access request for a first short link; a parsing module, which is used to parse the first short link and obtain the parsing information of the first short link; an acquisition module, which is used to acquire the target data corresponding to the first short link according to the parsing information of the first short link; a sending module, which is used to send the target data to the terminal device; wherein the first short link is generated based on a domain name and a first short code, the first short code is an identifier of the first short chain, the first short code is generated based on a random factor, a first message template identifier, and a first data volume interval, the random factor is a random string, the first data volume interval is any interval of multiple 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 short chain of multiple short chains in the first data volume interval.
[0008] In a fifth aspect, the present application provides a wireless communication device, which is applied to a server, and the device includes: a memory for storing code; a processor, connected to the memory, and used to execute the code stored in the memory, so that the device executes the method described in the first aspect or the second aspect.
[0009] In a sixth aspect, the present application provides a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it can implement the method described in the first aspect or the second aspect.
[0010] In a seventh aspect, the present application provides a computer program product, which, when executed on an electronic device, enables the electronic device to implement the method described in the first aspect or the second aspect.
[0011] This application generates a short code for a short chain in Yuexin based on a random factor, the first message template identifier of Yuexin, and the first data volume interval where the short chain is located. The short code information displays the message template identifier corresponding to the short chain and the data volume interval where the short chain is located. This application helps to ensure the uniqueness of the short chain, improve the retrieval efficiency of the short chain, and reduce the time required to find a specific target short chain and its corresponding parameters in massive data. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.
[0013] Figure 1 It is a flow chart of the method for generating short chains provided in an embodiment of the present application.
[0014] Figure 2 It is a flowchart of the wireless communication method provided in an embodiment of the present application.
[0015] Figure 3 yes Figure 1 A flowchart of a possible implementation of the method.
[0016] Figure 4 yes Figure 2 A flowchart of a possible implementation of the method.
[0017] Figure 5 yes Figure 2 A flowchart of another possible implementation of the method.
[0018] Figure 6 It is a schematic diagram of the composition of the device for generating short chains provided in an embodiment of the present application.
[0019] Figure 7 It is a schematic diagram of the composition of a wireless communication device provided in an embodiment of the present application.
[0020] Figure 8 It is a schematic diagram of component units / partial component units of another wireless communication device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0021] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The same or similar reference numerals are used in the drawings to represent the same or similar modules. It should be understood that the drawings are only schematic, and the protection scope of the present application is not limited thereto.
[0022] In recent years, the new generation of information technology represented by 5G, big data, and artificial intelligence has accelerated the innovation and application, and promoted the digitalization, intelligence, and networking of various fields of the economy and society. 5G messaging is a new form of business that emerged when information technology was undergoing major changes, providing a new development track for all parties in the information service industry chain.
[0023] 5G messages bring a new human-computer interaction mode. 5G industry messages, in the form of chatbots, enable users to complete one-stop business experiences such as service search, discovery, interaction, and payment within the message window, building a new information service portal. For example, through the terminal's native SMS message portal, governments and enterprises can deliver public and commercial services directly to users, and users can also search and select services through the directory service function. These services are presented on the user's message interface in the form of rich media (including text, pictures, audio and video) messages and interactive cards. Users can communicate with service providers or use services at any time and enjoy more convenient, intelligent, and humanized services. Industry customers can reach users more effectively, obtain more user feedback, and establish closer ties with users.
[0024] Although the promotion and commercial use of 5G messages are gradually maturing, a large number of users still use 4G terminals, and some terminal manufacturers do not support 5G messages. Governments and enterprises cannot reach all users through 5G messages, resulting in low communication efficiency and difficulty in unified management of 5G messages. The fallback state of the original 5G message can be 5G reading and 5G video messaging.
[0025] In the related art, the length of the content of a single SMS message is usually limited. When a SMS message containing a uniform resource locator (URL) is to be sent, if the URL is too long, it will occupy too many useless characters. Therefore, it is necessary to convert the long URL into a short URL, i.e., a short link or a short address.
[0026] 5G Yuexin is a message sending method that sends rich media messages in the form of SMS. By embedding a short link in the SMS, the mobile terminal can pull the rich media message data from the server according to the short link and display it. Yuexin is essentially a text message with a special short link. After the SMS is sent to the terminal device, it can identify the Yuexin short link, automatically parse and render the content behind the short link. The relevant steps include: reporting the Yuexin card template, that is, it is necessary to report the Yuexin card template to the terminal manufacturer in advance; obtaining the Yuexin short link, that is, obtaining the short link corresponding to the Yuexin card template from the terminal manufacturer, and then sending the SMS, that is, carrying the Yuexin short link in the SMS content, and sending a traditional SMS to the operator's SMS gateway. The terminal device identifies the short link and parses the Yuexin template. Terminals that do not support it display the traditional SMS content, which does not affect the terminal's reception of SMS.
[0027] Before sending 5G reading letters, the related technology needs to generate a short link based on the message content and store the dynamic data in the message in a MySQL database or a Redis database. After the user receives the 5G reading letter, the server is accessed to pull the corresponding data by parsing the short link in the text message. However, since personalized short links need to be generated based on user identification, the amount of data is very large, and group short links + personalized short links are mixed together to form massive data. The related technology stores short links and dynamic data in messages in the database, and there are problems of low efficiency and waste of resources in retrieving the required short links and dynamic data information in massive data.
[0028] Therefore, it is necessary to design a technical solution for retrieving dynamic data in short links and messages with higher efficiency.
[0029] Based on this, the embodiment of the present application proposes a method for generating a short link, which is applied to a server. The server may be a server where a short link service platform is located. Figure 1 The method for generating short chains in the embodiment of the present application is described in detail. Figure 1 As shown, the method for generating a short chain in the embodiment of the present application may mainly include steps S110 to S130, and these steps are described in detail below.
[0030] It should be pointed out that the size of the serial numbers of the steps in the embodiments of the present application does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0031] In step S110, a first short code is generated based on a random factor, a first message template identifier, and a first data volume interval. The random factor is a random string, the first data volume interval is any interval among multiple data volume intervals corresponding to the first message template, and the first message template identifier is an identifier corresponding to the first message template.
[0032] The message reader can use multiple message templates, and the first message template can be any one of the multiple message templates. Multiple message templates correspond to multiple different message template identifiers. A message template can correspond to multiple short links, and multiple short links corresponding to the same message template can be divided into intervals. Data volume intervals refer to dividing data according to a certain range to form different intervals. In database terminology, intervals refer to any continuous blocks assigned to an object (such as a table).
[0033] In some embodiments, a message template may correspond to 99,000 short links, and the total number of multiple data volume intervals may be 99, wherein each data volume interval includes 1,000 short links, i.e., the data volume interval value of every 1,000 short links increases by 1. For example, the data volume interval of the first 1,000 short links is 1, and the data volume interval of the second 1,000 short links is 2. The data volume interval is up to 99, and the measurement starts from 1 after exceeding. The number of short links in a single data volume interval can be determined according to actual conditions, and may also be 2,000, 3,000, etc., and is not limited in comparison with the embodiments of the present application.
[0034] The short code may be a text identification code, which can uniquely identify the content of a message (such as a letter reading) within the validity period. The first short code is one of the multiple short codes.
[0035] The random factor may be a random number or a random node number. The specific data of the random factor is not limited in the present embodiment, as long as it is random. By increasing the random factor, the generated short chain sequence is more random and does not have general regularity.
[0036] In step S120, a first short link is generated based on the domain name and the first short code. The first short code is an identifier of the first short link, the first short link is a short link corresponding to the reading letter, and the first short link is any short link among multiple short links in the first data volume interval.
[0037] The reading letter is a short message (message) with a short link, and the short link corresponds to the message template of the reading letter. The first short link is one of the multiple short links corresponding to the first message template of the reading letter.
[0038] A short link is relative to a long link. For an application scenario with N long links, the user end can request to generate short links that correspond to each other one by one, that is, one short link corresponds to one long link.
[0039] The short link length can represent the number of digits in the short link. Users can configure the number of digits in the short link according to their needs. A link can also be called a URI, which is a string used to identify the name of an Internet resource. A short URI can be composed of 66 characters, namely, letters AZ, az, 0-9, '-' (minus sign), '_' (underscore), '.' (period), and '~' (tilde), i.e., a 66-bit hexadecimal string.
[0040] It should be noted that the short URI can also be composed of 62 characters of letters AZ, az, 0-9, that is, a 62-bit string of 62-bit system. In practical applications, any one (62-bit or 66-bit) can be selected. If other systems are to be implemented, new characters can be added or deleted. However, the new characters added must ensure that the characters used are legal characters allowed by the URL. Generally, 62-bit or 66-bit system is used. The embodiments of the present application do not specifically limit the constituent characters of the short link.
[0041] In step S130, based on the first short code, the first short chain and the dynamic data corresponding to the first short chain are stored in the target database.
[0042] The data in the message template can be dynamic data, which allows users to flexibly change and filter data as needed to better meet specific needs. For example, by creating a dynamic report, users can change the data according to their own specifications. Such reports can be used for multiple purposes, saving organizational and time resources. The creation of dynamic data involves writing SQL queries, connecting to the database, creating parameters, and adjusting the code in the SQL query to access the new parameters.
[0043] The target database may be set in the short link server, or may be a database independent of the short link server corresponding to the short link service platform, and communicates with the short link service platform. This embodiment of the application does not limit this.
[0044] The target database can be used to store the index of local short links. After obtaining N short links, the index relationship between the N short links and the long chain information is stored in the database. For application scenarios where the long chain information includes a long link, the index relationship between the N short chains and the long chain is stored in the database. For application scenarios where the long chain information includes N long chains, a one-to-one index relationship between the target short chain and the long chain is stored in the database. So that when the short link is clicked or viewed, it can jump to the page of the long chain corresponding to the short link, that is, click the short link, and the page jumped to is the business page of the long chain. The business page information includes one of the long chain, long chain identifier (ID), mini program ID, etc., which helps to improve the convenience of business services.
[0045] In some implementations, the target database may be any one of the following databases: a remote dictionary server (Redis) database, a MySQL database.
[0046] In the embodiment of the present application, a short code of the short chain of the reading letter is generated according to a random factor, the first message template identifier of the reading letter, and the first data volume interval where the short chain is located. The short code information displays the message template identifier corresponding to the short chain and the data volume interval where the short chain is located. By increasing the random factor, the generated short chain sequence is more random and does not have a general regularity. The embodiment of the present application helps to ensure the uniqueness of the short chain, improve the retrieval efficiency of the short chain, and reduce the time required to find a specific target short chain and its corresponding parameters in massive data.
[0047] In some implementations, the method of generating the first short code based on the random factor, the first message template identifier, and the first data volume interval in step S110 may include: generating the first short code based on the random factor, the short link type of the first short link, the first message template identifier, and the first data volume interval. The short link type may include a group short link and a personalized short link. The method of generating the short code in combination with the short link type helps to reduce the search range and further improve the retrieval efficiency of the short link.
[0048] In some implementations, the above-mentioned generation of 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 letter to obtain the encoded first message template identifier; 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 the encoded message template identifier helps to protect the message template identifier, prevent the leakage of information of the message template identifier, and shorten the length. There are many ways to encode the message template identifier of the reading letter. For example, the message template identifier of the reading letter can be first base64 encoded, and it becomes shorter after conversion.
[0049] The embodiments of the present application do not limit the order of the short chain type, the encoded first message template identifier, the first data volume interval where the short chain is located, and the random factor for generating the first short code. In some embodiments, the first short code can be generated in the order of random factor + short chain type + encoded first message template identifier + first data volume interval. In other embodiments, the first short code can 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 type first helps to first identify the type of the short chain before further retrieval.
[0050] In some implementations, the first short chain is any short chain among a plurality of short chains, and the plurality of short chains correspond to a plurality of short codes. Based on the first short code, storing the first short chain and the dynamic data corresponding to the first short chain in the target database 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 distributing the plurality of short chains and the dynamic data corresponding to the plurality of short chains to a plurality of nodes of the target database. Evenly distributing data in different nodes helps to improve query speed and load balancing of the system.
[0051] In some implementations, the method of the embodiment of the present application may further include: writing the first short chain to an access filter, the access filter being used to limit invalid requests and / or repeated queries for the first short chain. The access filter may be, for example, a Bloom filter, which utilizes the efficient duplicate detection function of the Bloom filter to help improve the query efficiency of the system.
[0052] In the embodiment of the present application, a short code of a short chain in Yuexin is generated according to a random factor, the first message template identifier of Yuexin, and the first data volume interval where the short chain is located. The short code information displays the message template identifier corresponding to the short chain and the data volume interval where the short chain is located. By increasing the random factor, the generated short chain sequence is more random and does not have a general regularity. The embodiment of the present application helps to ensure the uniqueness of the short chain, improve the retrieval efficiency of the short chain, and reduce the time required to find a specific target short chain and its corresponding parameters in massive data.
[0053] The present application embodiment provides a wireless communication method, which is applied to a server. The server may be a short link service platform. Figure 2 The wireless communication method of the embodiment of the present application is described in detail. Figure 2 As shown, the method for generating a short chain in the embodiment of the present application may mainly include steps S210 to S240, and these steps are described in detail below.
[0054] In step S210, a first access request is received from a terminal device, where the first access request is an access request for a first short link.
[0055] Among them, the first short link is the short link corresponding to Yuexin, the first short link is generated based on the domain name and the first short code, and the first short code is the identifier of the first short link. The first short code is generated based on the random factor, the first message template identifier, and the first data volume interval. The random factor is a random string, the first data volume interval is any interval of multiple data volume intervals corresponding to the first message template of Yuexin, the first message template identifier is the identifier corresponding to the first message template, and the first short link is any short link of multiple short links in the first data volume interval. The first message template is any template of multiple message templates of Yuexin.
[0056] In step S220, the first short link is parsed to obtain parsed information of the first short link.
[0057] Through the parsing information of the first short chain, the message template identifier constituting the first short code and the data volume interval where the short chain is located can be obtained.
[0058] In step S230, target data corresponding to the first short link is acquired according to the parsed information of the first short link.
[0059] The target data may be the dynamic data corresponding to the first short chain. For example, the dynamic data corresponding to the first short chain stored in the target database may be retrieved according to the first short code. The target data may also be the dynamic data corresponding to the first short chain and the mapping relationship between the first short chain and the long chain.
[0060] In step S240, the target data is sent to the terminal device.
[0061] On the terminal device, when the short link is clicked or viewed, it can jump to the business page of the long link corresponding to the short link. The business page information may include one of the long link, the long link ID, the mini program ID, etc.
[0062] In some implementations, the first short code is generated based on the short link type of the first short link, the first message template identifier, and the first data volume interval. Acquiring the target data corresponding to the first short link according to the parsed information of the first short link in step S230 may include: determining the short link type of the first short link according to the parsed information of the first short link, the short link type being one of a personalized short link and a group short link; acquiring the target data corresponding to the first short link according to the short link type and the parsed information of the first short link.
[0063] In some implementations, the above-mentioned acquisition of the target data corresponding to the first short link according to the short link type and parsing information of the first short link may include: according to the short link type of the first short link, calling the access filter adapted to the short link type to filter the first short link; according to the filtering result of the access filter, determining the query type of the first short link; if the first short link is the first query, then according to the parsing information, the target data corresponding to the first short link is acquired from the target database, and the target database is a database storing the first short link and the dynamic data corresponding to the first short link; if the first short link is a repeated query, then the target data corresponding to the first short link is acquired from the local cache area. Invalid requests (such as expired short links and non-existent short links) can be filtered out through the access filter to reduce the load of the target database and improve the query rate per second (QPS) of the interface. QPS is the number of requests that the system can process per second, which is a measure of the amount of traffic processed by a specific query server within a specified time. Using the local cache mechanism helps to reduce repeated queries to the target database, improve the efficiency of parameter queries, and improve the overall performance of the system.
[0064] In some implementations, if the first short link is queried for the first time, the method of the embodiment of the present application may further include: storing the target data corresponding to the first short link obtained from the target database into a local cache area, which helps to reduce repeated queries to the target database.
[0065] In an embodiment of the present application, the short code corresponding to the short chain in the reading letter is generated based on a random factor, a first message template identifier, and a first data volume interval where the short chain is located. The short code information displays the message template identifier corresponding to the short chain and the data volume interval where the short chain is located. By increasing the random factor, the generated short chain sequence is more random and does not have a general regularity. The target dynamic data corresponding to the short chain is obtained according to the information of the short code (i.e., the parsing information). The embodiment of the present application helps to ensure the uniqueness of the short chain, improve the retrieval efficiency of the short chain, and reduce the time required to find a specific target short chain and its corresponding parameters in massive data.
[0066] The method of the embodiment of the present application is further explained below in combination with some possible implementation methods of the embodiment of the present application.
[0067] Figure 3 yes Figure 1 A flowchart of a possible implementation of the method. Figure 3 The method can be applied to a communication system, which may include: a client 310, a server 320, and a Redis database 330.
[0068] The client 310 is a user device that sends an access request for the first short link in the reading message.
[0069] The client in the embodiment of the present application may also be referred to as a terminal, user equipment (UE), user terminal, access terminal, user unit, user station, mobile station, mobile station (MS), mobile terminal (MT), remote terminal, remote station, mobile device, wireless communication device, user agent or user device. The client in the embodiment of the present application may refer to a device that provides voice and / or data connectivity to a user, and may be used to connect people, objects and machines, such as a handheld device with wireless connection function, a vehicle-mounted device, etc. The terminal device in the embodiments of the present application can be a mobile phone, a tablet computer (Pad), a laptop computer, a PDA, a mobile Internet device (MID), a wearable device, a virtual reality (VR) device, an augmented reality (AR) device, a wireless terminal in industrial control, a wireless terminal in self driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, etc.
[0070] The server 320 may be a device that communicates with the client 310 . For example, the server 320 may be a server where the short link service platform is located. The server 320 may include: a local cache 321 and a Bloom filter 322 .
[0071] The Redis database 330 is a target database and can be set in the server 320. The Redis database 330 can also be a database independent of the server 320 corresponding to the short link service platform, and is connected to the server 320 for communication.
[0072] Specifically, the method of the embodiment of the present application is applied to the server 320. Figure 3 As shown, the method for generating a short chain in the embodiment of the present application may mainly include steps S310 to S330, and these steps are described in detail below.
[0073] In step S310, a short chain is generated.
[0074] The short link consists of a domain name and a short code. The short code is the unique identifier of the short link, and the short code library can be a string. The short code can include the short link type, the encoded message template identifier (the first message template identifier), and the first data volume interval where the short link is located. The specific format can be:
[0075] Short code = random factor + short link type + base64-encoded reading message template ID + first data volume interval.
[0076] When generating a short link, first perform base64 encoding on the Yuexin message template identifier, and then combine the base64-encoded Yuexin message template identifier with the random factor, the short link type, and the first data volume interval to form a short code. That is, the first short code is generated based on the random factor + short link type + base64-encoded Yuexin message template ID + the first data volume interval; and the first short link is generated based on the domain name and the first short code. This helps to ensure the uniqueness and traceability of the short link.
[0077] The random factor is a random string. The specific data of the random factor is not limited in the present embodiment, as long as it is random. By adding the random factor, the generated short chain sequence is more random and does not have general regularity.
[0078] For example, the random factor may be a / v1Rk, the short chain type may be 1, the encoded message template identifier may be NTAwMDAwMDA, and the data interval may be 99. Then the short code finally formed may be a / v1Rk1NTAwMDAwMDA99. It is understandable that the number of bits of each component in the short code, such as the random factor and the encoded message template identifier, is usually fixed.
[0079] In some embodiments, a message template may correspond to 99,000 short links, and the total number of multiple data volume intervals may be 99, wherein each data volume interval includes 1,000 short links, that is, the data volume interval value of every 1,000 short links increases by 1. For example, the data volume interval of the first 1,000 short links is 1, and the data volume interval of the second 1,000 short links is 2. The data volume interval is up to 99, and after exceeding, the measurement starts again from 1. The number of short links in a single data volume interval can be determined according to actual conditions, and may also be 2,000, 3,000, etc.
[0080] In step S320, the short link and the corresponding dynamic data are stored.
[0081] When storing data, calculations are performed based on the short chain type in the short code, the base64-encoded message template identifier and the first data volume interval to determine the slot value to be stored in the Redis database 330, and the corresponding node is determined based on the slot value so that the data can be evenly distributed in different nodes of the target database.
[0082] Dynamic data can include rich media content, user personalized settings, etc. This partition storage strategy can reduce the waste of storage resources, effectively optimize storage and query efficiency, and help improve the query speed of the Redis database and the load balancing of the system.
[0083] Specifically, the Redis database can divide all hash slots evenly to different nodes, and each node is responsible for processing a portion of the hash slot data. For example, a Redis database has 3 nodes, and the 3 nodes are responsible for processing a total of 16384 hash slots. Then the hash slot range that each node is responsible for processing is: the first node: 0-5460; the second node: 5461-10922; the third node: 10923-16383.
[0084] For example, a cyclic redundancy check (CRC) 16 algorithm may be used to perform a hash operation on the short code, and then the operation result may be encoded in UTF-8, and then the result may be modulo 16384 to obtain the slot value, where 16384 is the maximum number of Redis slots, and UTF-8 (unicode transformation format-8) is a variable-length character encoding for Unicode.
[0085] When the client 310 needs to access a key-value pair, the Redis database calculates a hash value based on the key name and maps the hash value to a hash slot (slot value). Then, the Redis database transfers the key-value pair to the corresponding node for processing based on the distribution of the hash slots.
[0086] In step S330 , the short chain is written into the Bloom filter.
[0087] Writing the generated short chain into the Bloom filter and utilizing its efficient duplicate detection function can help avoid invalid requests and repeated queries and improve the query efficiency of the system.
[0088] In the embodiment of the present application, a short code corresponding to a short chain in the message is generated according to a random factor, a short chain type, a base64-encoded message template identifier, and a data volume interval, which helps to ensure the uniqueness of the short chain. The short code information displays the message template identifier corresponding to the short chain and the data volume interval where the short chain is located. By increasing the random factor, the generated short chain sequence is more random and does not have a general regularity. In the embodiment of the present application, the short chains and dynamic data are evenly distributed in different nodes, and the generated short chains are written into a Bloom filter. In the embodiment of the present application, it helps to reduce the waste of storage resources, optimize storage and improve the retrieval efficiency of short chains, avoid invalid requests and repeated queries, and reduce the time required to find specific target short chains and their corresponding parameters in massive data.
[0089] Figure 4 yes Figure 2 A flowchart of a possible implementation of the method. Figure 4 The process of the method is also the process of pulling parameters for request processing. Figure 4 As shown, the wireless communication method of the embodiment of the present application may mainly include steps S410 to S450, and these steps are described in detail below.
[0090] First, the client 310 sends a short link to the server 320, that is, sends an access request (parameter pull request) for the first short link. After receiving the parameter pull request, the server 320 performs parameter pull request processing.
[0091] In step S410, the type of the short link is parsed.
[0092] After receiving the request to pull parameters, the short link is first parsed to identify its type and determine whether it is a mass short link or a personalized short link for subsequent processing.
[0093] In step S420, the Bloom filter is called.
[0094] According to the short link type, the corresponding Bloom filter 322 is called. The Bloom filter 322 can filter out invalid requests (such as expired short links, non-existent short links) and return the filtering results to the server 320. Calling the Bloom filter helps reduce the load of the Redis database and improve the QPS of the interface.
[0095] In step S430, the local cache is checked.
[0096] Check whether the corresponding parameter information exists in the local cache area 321. If it exists, directly obtain and return the cache data from the local cache area 321, which helps to reduce the query time and system resource consumption.
[0097] If it does not exist in the local cache area 321, proceed to the next step.
[0098] In step S440, the short link is parsed and the Redis database is searched.
[0099] Parse the short link type, base64-encoded message template identifier and data volume range of the short code in the short link, and use these values and short link information to retrieve the corresponding data (including dynamic data) from the Redis database.
[0100] In step S450, the local cache area is updated.
[0101] The target data obtained from the Redis database is written into the local cache area 321 for subsequent quick query. After receiving the target data, the local cache area 321 updates the cache data.
[0102] And return the target data to the requesting client 310, completing the parameter pulling process.
[0103] Figure 5 yes Figure 2 A flow chart of another possible implementation of the method. Figure 5 As shown, the wireless communication method of the embodiment of the present application may mainly include steps S510 to S570, and these steps are described in detail below.
[0104] In step S510, a request for pulling references is received, that is, a request for pulling references for a short link in a reading message.
[0105] In step S520, the type of the short link is parsed.
[0106] Identify the type of short link and determine whether it is a mass short link or a personalized short link for subsequent retrieval.
[0107] In step S530, the Bloom filter is called.
[0108] According to the short link type, the corresponding Bloom filter is called. For example, if the short link type is a personalized short link, the corresponding Bloom filter of the personalized short link is called. This helps to reduce the load of the Redis database and improve the QPS of the interface.
[0109] In step S540, it is checked whether the local cache is hit.
[0110] Check whether the local cache area has the corresponding parameter information. For example, the local cache area can be checked for the corresponding parameter information based on the identifier of the short link (i.e., the short code). If it exists, proceed to step S570; if it does not exist in the local cache, proceed to step S550.
[0111] In step S550, the short link is parsed and the Redis database is searched.
[0112] Parse the short link type, base64-encoded message template identifier and data volume range of the short code in the short link, and use these values and short link information to retrieve the corresponding data (including dynamic data) from the Redis database.
[0113] In step S560, the local cache is updated.
[0114] The target data obtained from the Redis database is written to the local cache area for subsequent quick query. After the local cache area receives the target data, the cache data is updated.
[0115] In step S570, cache target data is directly obtained from the local cache area, which helps to reduce query time and system resource consumption.
[0116] In step S580, the target data is returned to the requesting party, completing the parameter pulling process.
[0117] In an embodiment of the present application, a short code corresponding to a short link in the message is generated according to a random factor, a short link type, a base64-encoded message template identifier, and a data volume interval, which helps to ensure the uniqueness of the short link. The short code information displays the message template identifier corresponding to the short link and the data volume interval where the short link is located. In an embodiment of the present application, short links and dynamic data are evenly distributed in different nodes, and the generated short links are written into a Bloom filter. This embodiment of the present application helps to reduce the waste of storage resources, optimize storage and improve the retrieval efficiency of short links, and avoid invalid requests and repeated queries. In an embodiment of the present application, a local cache mechanism is used to cache the short link parameters queried for the first time, which helps to reduce repeated queries to the target database, improve the efficiency of parameter queries, and reduce the time required to find specific target short links and their corresponding parameters in massive data.
[0118] Combination of the above Figure 1-Figure 5 The method embodiment of the present application is described in detail. Figures 6 to 8 The device embodiment of the present application is described in detail. It should be understood that the description of the device embodiment corresponds to the description of the method embodiment, so the parts not described in detail can refer to the previous method embodiment.
[0119] An embodiment of the present application provides a device for generating a short chain. Figure 6 Schematic diagram of the composition of the device for generating short chains provided in the embodiment of the present application. Figure 6 As shown, the device 600 for generating a short link may include: a first generating module 610 , a second generating module 620 , and a storage module 630 .
[0120] The first generating module 610 is used to generate a first short code based on a random factor, a first message template identifier, and a first data volume interval. The random factor is a random string, the first data volume interval is any interval among multiple data volume intervals corresponding to the first message template of the message, and the first message template identifier is an identifier corresponding to the first message template. The first message template is any template among multiple message templates of the message.
[0121] The second generating module 620 is used to generate a first short link based on the domain name and the first short code. The first short code is an identifier of the first short link, and the first short link is a short link corresponding to the reading letter.
[0122] The storage module 630 is used to store the first short chain and the dynamic data corresponding to the first short chain in the target database based on the first short code.
[0123] Optionally, the first generating module 610 is used to generate a first short code based on a random factor, a short chain type, a first message template identifier, and a first data volume interval.
[0124] Optionally, the first generation module 610 is used to encode the first message template identifier to obtain the encoded first message template identifier; 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.
[0125] Optionally, the first short chain is any short chain among a plurality of short chains, and the plurality of short chains correspond to a plurality of short codes. The storage module 630 is used to determine a plurality of slot values to be stored according to information of the plurality of short codes; determine a plurality of corresponding nodes of a target database according to the plurality of slot values; and disperse and store the plurality of short chains and the dynamic data corresponding to the plurality of short chains to a plurality of nodes of the target database.
[0126] Optionally, the apparatus 600 for generating a short chain may further include an access filter. The access filter is written with the first short chain, and the access filter is used to limit invalid requests and / or repeated queries for the first short chain.
[0127] Optionally, the target database is any one of the following databases: a remote dictionary service database, a MySQL database.
[0128] Figure 7 It is a schematic diagram of the composition of the wireless communication device provided in an embodiment of the present application. Figure 7 The wireless communication device is applied to the server. Figure 7 As shown, the wireless communication device 700 may include: a receiving module 710 , a parsing module 720 , an acquiring module 730 , and a sending module 740 .
[0129] The receiving module 710 is used to receive a first access request from a terminal device, where the first access request is an access request for a first short link.
[0130] The parsing module 720 is used to parse the first short link to obtain parsing information of the first short link.
[0131] The acquisition module 730 is used to acquire target data corresponding to the first short link according to the parsing information of the first short link.
[0132] The sending module 740 is used to send target data to the terminal device.
[0133] Among them, the first short link is the short link corresponding to the reading letter, and the first short link is generated based on the domain name and the first short code. The first short code is the identifier of the first short link, and the first short code is generated based on the random factor, the first message template identifier, and the first data volume interval. The random factor is a random string, the first data volume interval is any interval of multiple data volume intervals corresponding to the first message template, the first message template identifier is the identifier corresponding to the first message template, and the first short link is any short link of multiple short links in the first data volume interval.
[0134] Optionally, the first short code is generated based on a random factor, a short link type, a first message template identifier, and a first data volume interval. The acquisition module 730 is used to: determine the short link type of the first short link according to the parsing information of the first short link, where the short link type is one of a personalized short link and a group short link; and acquire the target data corresponding to the first short link according to the short link type and the parsing information of the first short link.
[0135] Optionally, the wireless communication device 700 also includes a filtering module. The filtering module is used to call the access filter corresponding to the short link type according to the short link type of the first short link to filter the first short link. The acquisition module 730 is used to: determine the query type of the first short link according to the filtering result of the access filter; if the first short link is queried for the first time, then obtain the target data corresponding to the first short link from the target database according to the parsing information of the first short link, and the target database is a database storing the first short link and the dynamic data corresponding to the first short link; if the first short link is a repeated query, then obtain the target data corresponding to the first short link from the local cache area.
[0136] Optionally, the wireless communication device 700 further includes a storage module. The storage module is configured to store target data corresponding to the first short link obtained from the target database into a local cache area in response to the first short link being queried for the first time.
[0137] Figure 8 It is a schematic diagram of component units / partial component units of another wireless communication device provided in an embodiment of the present application. Figure 8The wireless communication device is applied to the server, and can also be a server. Figure 8 As shown, the wireless communication device 800 may include: a memory 810 and at least one processor 820.
[0138] The memory 810 is used to store codes or computer programs.
[0139] The processor 820 is connected to the memory 810, and is used to execute the code or computer program stored in the memory 810 to control the wireless communication device 800 to execute any of the methods described above.
[0140] Exemplarily, the computer program may be divided into one or more modules / units, one or more modules / units are stored in the memory 810 and executed by the processor 820 to complete the present application.
[0141] Those skilled in the art will understand that Figure 8 This is only an example of the wireless communication device 800 and does not constitute a limitation on the charging compartment. It may include more or fewer components than shown in the figure, or combine certain components, or different components. The wireless communication device 800 provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0142] The processor 820 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) 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, etc.
[0143] An embodiment of the present application further provides a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0144] An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0145] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above method embodiments, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / electronic device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), read-only compact disc (CD-ROM), magnetic tape, floppy disk and optical data storage device. The computer-readable storage medium mentioned in the present application can be a non-volatile storage medium, in other words, it can be a non-transient storage medium.
[0146] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0147] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0148] In the embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0149] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0150] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0151] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0152] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0153] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for generating short chains, characterized in that: Applied to a server, the method comprises: Generate a first short code based on a random factor, a first message template identifier, and a first data volume interval, wherein the random factor is a random string, the first data volume interval is any interval among multiple data volume intervals corresponding to the first message template of the reading letter, and the first message template identifier is an identifier corresponding to the first message template; Generate a first short chain based on the domain name and the first short code, where the first short chain is any short chain among a plurality of short chains in the first data volume interval, and the first short code is an identifier of the first short chain; Based on the first short code, the first short chain and the dynamic data corresponding to the first short chain are stored in a target database.
2. The method according to claim 1, characterized in that: The generating of the first short code based on the random factor, the first message template identifier, and the first data volume interval includes: The first short code is generated based on the random factor, the short chain type, the first message template identifier, and the first data amount interval.
3. The method according to claim 2, characterized in that The generating the first short code based on the random factor, the short chain type, the first message template identifier, and the first data volume interval includes: Encoding the first message template identifier to obtain an encoded first message template identifier; The first short code is generated based on the random factor, the short chain type, the encoded first message template identifier, and the first data volume interval.
4. The method according to claim 1, characterized in that: The plurality of short chains correspond to a plurality of short codes, and based on the first short code, storing the first short chain and the dynamic data corresponding to the first short chain in a target database includes: Determining a plurality of slot values to be stored according to information of the plurality of short codes; Determine, according to the multiple slot values, multiple nodes of the target database corresponding to the multiple slot values; The multiple short links and the dynamic data corresponding to the multiple short links are stored in a distributed manner in multiple nodes of the target database.
5. The method according to claim 1, characterized in that The method further comprises: The first short chain is written into an access filter, where the access filter is used to limit invalid requests and / or repeated queries for the first short chain.
6. A wireless communication method, characterized in that: Applied to a server, the communication method includes: Receiving a first access request from a terminal device, wherein the first access request is an access request for a first short link; Parsing the first short link to obtain parsing information of the first short link; Acquire target data corresponding to the first short link according to the parsed information of the first short link; Sending the target data to the terminal device; Among them, the first short link is generated based on the domain name and the first short code, the first short code is the identifier of the first short chain, the first short code is generated based on a random factor, a first message template identifier, and a first data volume interval, the random factor is a random character string, the first data volume interval is any interval of multiple data volume intervals corresponding to the first message template of the letter reading, the first message template identifier is the identifier corresponding to the first message template, and the first short chain is any short chain of multiple short chains in the first data volume interval.
7. The method according to claim 6, characterized in that The first short code is generated based on a random factor, a short link type, a first message template identifier, and a first data volume interval, and acquiring target data corresponding to the first short link according to parsed information of the first short link includes: Determine a short link type of the first short link according to the parsed information of the first short link, where the short link type is one of a personalized short link and a group short link; According to the short link type of the first short link and the parsing information, target data corresponding to the first short link is acquired.
8. The method according to claim 7, characterized in that The acquiring target data corresponding to the first short link according to the short link type of the first short link and the parsing information includes: According to the short link type of the first short link, calling an access filter adapted to the short link type to filter the first short link; Determining a query type of the first short link according to a filtering result of the access filter; If the first short link is queried for the first time, then according to the parsing information, the target data corresponding to the first short link is obtained from a target database, where the target database is a database storing the first short link and the dynamic data corresponding to the first short link; If the first short chain is a repeated query, the target data corresponding to the first short chain is obtained from the local cache area.
9. The method according to claim 8, characterized in that If the first short link is queried for the first time, the method further includes: The target data corresponding to the first short link obtained from the target database is stored in the local cache area.
10. A wireless communication device, characterized in that: The wireless communication device is applied to a server, and the device includes: A memory for storing codes; A processor, connected to the memory, is used to execute the code stored in the memory so that the wireless communication device executes the method as described in any one of claims 1-5 or 6-9.
Citation Information
Cited By
Short chain management method and device, equipment and medium
CN120358524A
