Rule-based link conversion method, electronic device and computer program product

By introducing a rule-based link conversion method into the short link service system, the problem of database request breakdown in high concurrency scenarios is solved, and flexible storage strategies and efficient short link services are realized.

CN119903251APending Publication Date: 2025-04-29KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411978737.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

Traditional short-link service systems have database request breakdown problems in high concurrency scenarios, and cannot flexibly allocate storage policies, resulting in limited storage location and low efficiency.

Method used

By introducing a rule-based link conversion method, the link and conversion request from the requesting end are received, the target policy rules are determined based on the request, the link is stored in the target database determined according to the rules, and the short link generation and access are realized through index information.

Benefits of technology

It realizes a database that dynamically allocates storage links in high concurrency scenarios, solves the problem of database request breakdown, and improves the efficiency and scalability of short-link services through flexible storage strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119903251A_ABST
    Figure CN119903251A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a rule-based link conversion method, electronic equipment and a computer program product, and the method comprises the steps: receiving a first link and a link conversion request sent by a request end, and determining a target strategy rule according to the link conversion request; the first link is stored in a target database determined according to the target strategy rule, and first index information between the first link and the target database is obtained; determining second index information between a second link and the target database according to the first index information; the second link corresponds to the first link; feeding back the second link and the second index information to the request end; according to the embodiment of the invention, the corresponding target strategy rule is determined according to the link conversion request, the corresponding storage strategies are flexibly determined for different request ends, the database of the storage link is dynamically allocated, and the problem of database request breakdown in a high-concurrency scene is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of short link services, and in particular to a rule-based link conversion method, electronic device, and computer program product. Background Art

[0002] In the era of information explosion, marketers of various businesses are racking their brains to grab the limited attention of users, so the promotional copy for activities and reach content is generally not too long. However, the endless stream of massive activity / content links in the process of brand marketing often have long link addresses. Before the emergence of short link services, it was not easy to convey high-quality information to users within a limited text space.

[0003] The purpose of the short link service is to convert ordinary long links into shorter short links (for example, the long link is: original link: Educative: Interactive Courses for Software Developers, the short link is: tinyurl.com / jlg8zpc). When the user clicks the short link, it will jump to the original link. Short links have several advantages: saving display space, less prone to errors, and hiding the original link. Summary of the invention

[0004] Embodiments of the present disclosure provide a rule-based link conversion method, an electronic device, and a computer program product.

[0005] According to one aspect of an embodiment of the present disclosure, a rule-based link conversion method is provided, comprising:

[0006] receiving a first link and a link conversion request sent by a requesting end, and determining a target policy rule according to the link conversion request;

[0007] storing the first link in a target database determined according to the target policy rule, and determining first index information between the first link and the target database;

[0008] Determine, according to the first index information, second index information between a second link and the target database; the second link corresponds to the first link;

[0009] Feedback the second link and the second index information to the requesting end.

[0010] Optionally, the receiving the first link and the link conversion request sent by the requesting end, and determining the target policy rule according to the link conversion request, includes:

[0011] receiving the first link and the link conversion request sent by the requesting end;

[0012] Determining whether the connection conversion request includes a request flag bit;

[0013] In response to the request flag bit existing in the link conversion request, the target policy rule is determined according to the request flag bit.

[0014] Optionally, it also includes:

[0015] In response to the absence of the request flag in the link conversion request, the target policy rule is determined according to a preset flag.

[0016] Optionally, determining second index information between the second link and the target database according to the first index information includes:

[0017] determining the second link; the length of the second link being shorter than the first link;

[0018] Determine a correspondence relationship between the second link and the first index information according to the first link corresponding to the first index information and the correspondence relationship between the second link and the first link;

[0019] The second index information is determined according to a correspondence between the second link and the first index information.

[0020] Optionally, the determining the second link includes:

[0021] Determine a third link of a preset length according to the first link;

[0022] The request flag is inserted into the third link to obtain the second link.

[0023] Optionally, the target policy rules include: allocation strategy, preset algorithm and index storage location;

[0024] The step of storing the first link in a target database determined according to the target policy rule and determining first index information between the first link and the target database includes:

[0025] Determine the target database according to the allocation strategy and the preset algorithm;

[0026] storing the first link in the target database to obtain first index information between the first link and the target database;

[0027] The first index information is stored in the index storage location.

[0028] Optionally, the target policy rule further includes: a storage identifier corresponding to the database;

[0029] The determining the target database according to the allocation strategy and the preset algorithm includes:

[0030] Performing calculation processing on the first link according to the preset algorithm to determine a corresponding storage identifier;

[0031] The target database is determined according to the allocation strategy and the storage identifier.

[0032] Optionally, determining the target database according to the allocation strategy and the storage identifier includes:

[0033] Determine a target database group from at least one database group corresponding to the target policy rule according to the allocation strategy, each of the database groups including at least one database;

[0034] The target database is determined in the target database group according to the storage identifier.

[0035] Optionally, the target policy rule further includes: storage ratio information; the index storage location includes n index storage repositories; the database corresponding to the target policy rule is divided into n database groups, where n is an integer greater than or equal to 2; each index storage repositories corresponds to one database group;

[0036] The calculating and processing the first link according to the preset algorithm to obtain a storage identifier includes:

[0037] Performing calculation processing on the first link according to the preset algorithm to determine a corresponding initial identifier;

[0038] Determine the index storage repository corresponding to the first link according to the storage ratio information;

[0039] The storage identifier is determined according to the database group corresponding to the index storage repository and the initial identifier.

[0040] Optionally, the target policy rule further includes an extended interface;

[0041] The step of determining the target database according to the allocation strategy and the storage identifier includes:

[0042] The target policy rule is updated based on at least one extended information received through the extended interface to obtain an extended policy rule;

[0043] Processing the storage identifier through the extended information to obtain the extended identifier;

[0044] Determine a target database group from at least one database group corresponding to the expansion strategy rule according to the allocation strategy, each of the database groups including at least one database;

[0045] The target database is determined in the target database group according to the extension identifier.

[0046] According to another aspect of an embodiment of the present disclosure, a rule-based link conversion device is provided, comprising:

[0047] A rule determination module, configured to receive a first link and a link conversion request sent by a requesting end, and determine a target policy rule according to the link conversion request;

[0048] a database determination module, configured to store the first link in a target database determined according to the target policy rule, and obtain first index information between the first link and the target database;

[0049] A second link indexing module, configured to determine second index information between a second link and the target database according to the first index information; the second link corresponds to the first link;

[0050] A link feedback module is used to feed back the second link and the second index information to the request end.

[0051] Optionally, the rule determination module is specifically used to receive the first link and the link conversion request sent by the requesting end; determine whether the connection conversion request includes a request flag; in response to the presence of the request flag in the link conversion request, determine the target policy rule according to the request flag.

[0052] Optionally, the rule determination module is further configured to, in response to the absence of the request flag in the link conversion request, determine the target policy rule according to a preset flag.

[0053] Optionally, the second link index module is specifically used to determine the second link; the length of the second link is smaller than the first link; based on the first link corresponding to the first index information, and the correspondence between the second link and the first link, determine the correspondence between the second link and the first index information; based on the correspondence between the second link and the first index information, determine the second index information.

[0054] Optionally, when determining the second link, the second link index module is used to determine a third link of a preset length according to the first link; and insert the request flag into the third link to obtain the second link.

[0055] Optionally, the target policy rules include: allocation strategy, preset algorithm and index storage location;

[0056] The database determination module comprises:

[0057] A target database determining unit, configured to determine the target database according to the allocation strategy and the preset algorithm;

[0058] A first indexing unit, configured to store the first link in the target database, and obtain first index information between the first link and the target database;

[0059] An information storage unit is used to store the first index information into the index storage location.

[0060] Optionally, the target policy rule further includes: a storage identifier corresponding to the database;

[0061] The target database determination unit is specifically configured to perform calculation processing on the first link according to the preset algorithm to determine a corresponding storage identifier; and determine the target database according to the allocation strategy and the storage identifier.

[0062] Optionally, when determining the target database according to the allocation strategy and the storage identifier, the target database determination unit is used to determine a target database group from at least one database group corresponding to the target policy rule according to the allocation strategy, each of the database groups including at least one database; and determine the target database in the target database group according to the storage identifier.

[0063] Optionally, the target policy rule further includes: storage ratio information; the index storage location includes n index storage repositories; the database corresponding to the target policy rule is divided into n database groups, where n is an integer greater than or equal to 2; each index storage repositories corresponds to one database group;

[0064] When the target library determination unit calculates and processes the first link according to the preset algorithm to obtain a storage identifier, it is used to calculate and process the first link according to the preset algorithm to determine the corresponding initial identifier; determine the index storage library corresponding to the first link according to the storage ratio information; and determine the storage identifier according to the database group corresponding to the index storage library and the initial identifier.

[0065] Optionally, the target policy rule further includes an extended interface;

[0066] Optionally, when determining the target database according to the allocation strategy and the storage identifier, the target library determination unit is further used to update the target policy rule based on at least one extended information received through the extended interface to obtain the extended policy rule; process the storage identifier through the extended information to obtain the extended identifier; determine the target database group from at least one database group corresponding to the extended policy rule according to the allocation strategy, each of the database groups including at least one database; and determine the target database in the target database group according to the extended identifier.

[0067] According to another aspect of the embodiments of the present disclosure, there is provided an electronic device, including:

[0068] A memory for storing a computer program product;

[0069] The processor is used to execute the computer program product stored in the memory, and when the computer program product is executed, the rule-based link conversion method described in any one of the above embodiments is implemented.

[0070] According to another aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the rule-based link conversion method described in any of the above embodiments is implemented.

[0071] According to another aspect of the embodiments of the present disclosure, a computer program product is provided, including computer program instructions, which, when executed by a processor, implement the rule-based link conversion method described in any of the above embodiments.

[0072] Based on the rule-based link conversion method, electronic device and computer program product provided by the above-mentioned embodiments of the present disclosure, a first link and a link conversion request sent by a requesting end are received, and a target policy rule is determined according to the link conversion request; the first link is stored in a target database determined according to the target policy rule, and a first index information between the first link and the target database is obtained; according to the first index information, the second index information between the second link and the target database is determined; the second link corresponds to the first link; the second link and the second index information are fed back to the requesting end; the embodiment of the present disclosure determines the corresponding target policy rule according to the link conversion request, so as to flexibly determine the corresponding storage strategy for different requesting ends, and determines the target database for storing the first connection based on the target policy rule, so as to dynamically allocate the database for the storage link, and solve the problem of database request breakdown in high concurrency scenarios; and the second link and the second index information are fed back to the requesting end to generate a short link, and the connection to the first link based on the second index information fed back to the requesting end can be realized, thereby realizing efficient short link service.

[0073] The technical solution of the present disclosure is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0075] The present disclosure may be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:

[0076] Figure 1 is a flowchart of a rule-based link conversion method provided by an exemplary embodiment of the present disclosure;

[0077] Figure 2 This disclosure Figure 1 A schematic flow chart of step 102 in the embodiment shown;

[0078] Figure 3 This disclosure Figure 1 A schematic flow chart of step 104 in the embodiment shown;

[0079] Figure 4 This disclosure Figure 3 A schematic flow chart of step 1041 in the embodiment shown;

[0080] Figure 5 This disclosure Figure 4 A flow chart of step 402 in the embodiment shown;

[0081] Figure 6This disclosure Figure 1 A schematic flow chart of step 106 in the embodiment shown;

[0082] Figure 7 is a structural schematic diagram of a rule-based link conversion device provided by an exemplary embodiment of the present disclosure;

[0083] Figure 8 A block diagram of an electronic device according to an embodiment of the present disclosure is illustrated. DETAILED DESCRIPTION

[0084] Below, the exemplary embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure, and it should be understood that the present disclosure is not limited to the exemplary embodiments described here.

[0085] It should be noted that the relative arrangement of components and steps, the numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.

[0086] Those skilled in the art can understand that the terms "first" and "second" in the embodiments of the present disclosure are only used to distinguish different steps, devices or modules, etc., and neither represent any specific technical meaning nor indicate the necessary logical order between them.

[0087] It should also be understood that in the embodiments of the present disclosure, “plurality” may refer to two or more than two, and “at least one” may refer to one, two, or more than two.

[0088] It should also be understood that any component, data or structure mentioned in the embodiments of the present disclosure can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.

[0089] In addition, the term "and / or" in this disclosure is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this disclosure generally indicates that the previous and next associated objects are in an "or" relationship. The data referred to in this disclosure may include unstructured data such as text, images, and videos, and may also be structured data.

[0090] It should also be understood that the description of the various embodiments in the present disclosure focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.

[0091] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0092] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.

[0093] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.

[0094] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0095] The disclosed embodiments can be applied to electronic devices such as terminal devices, computer systems, servers, etc., which can operate with many other general or special computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, servers, etc. include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, large computer systems, and distributed cloud computing technology environments including any of the above systems, etc.

[0096] Electronic devices such as terminal devices, computer systems, servers, etc. can be described in the general context of computer system executable instructions (such as program modules) executed by computer systems. Generally, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in a distributed cloud computing environment, where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.

[0097] Application Overview

[0098] In the process of implementing the present disclosure, the inventors found that the traditional short link service system is usually directly stored through the database, with one flag bit corresponding to one database. Due to the limited number of flag bits, the traditional solution can only correspond to a limited number of storage locations, and there is a problem of database request breakdown in high concurrency scenarios.

[0099] Exemplary Methods

[0100] Figure 1is a flowchart of a rule-based link conversion method provided by an exemplary embodiment of the present disclosure. This embodiment can be applied to electronic devices such as a server that can provide storage services, such as Figure 1 As shown, the following steps are included:

[0101] Step 102: Receive a first link and a link conversion request sent by a requesting end, and determine a target policy rule according to the link conversion request.

[0102] Among them, the requesting end can be any business party, the first link is a long link of any content, the long link is the link that the requesting end needs to convert, and the requesting end can send multiple first links at the same time; optionally, the link conversion request may include a request flag corresponding to the requesting end, or may not include it. The link conversion request may correspond to each first link, or to the requesting end. When the requesting end sends multiple first links, each first link corresponds to a link conversion request, or multiple first links correspond to one link conversion request; optionally, the first link and link conversion request sent by at least one requesting end can be received at the same time, and different requesting ends can be distinguished by corresponding different request flags.

[0103] Although the traditional flag-associated storage location method can achieve short link storage in a directional space, it is not possible to flexibly allocate and set storage policies for different business scenarios, and it is not possible to dynamically allocate storage to a designated high-concurrency database according to weight for high-concurrency scenarios; in addition, a single flag (usually a single letter) in the prior art can only correspond to one storage location. Due to the limited number of letters, the storage locations that can be provided are limited, and high-concurrency scenarios cannot be handled. The present application proposes policy rules, and each flag corresponds to a policy rule; the policy rules may include but are not limited to at least one of the following: storage location, storage expiration time, short link storage index method, etc. The expansion and flexible configuration of storage locations are achieved through policy rules.

[0104] Optionally, the target policy rule corresponding to the requesting end may be determined by a flag bit corresponding to the requesting end, for example, by adding a flag bit to the link conversion request to determine the corresponding target policy rule.

[0105] Step 104: store the first link in a target database determined according to the target policy rule, and obtain first index information between the first link and the target database.

[0106] In one embodiment, the target policy rule corresponds to a certain number of databases, and the first link is processed by an algorithm corresponding to the target policy rule to determine a target database corresponding to the first link from multiple databases. The target database is used to store the first link. In addition, in order to be able to search for the first link later, this embodiment determines the correspondence between the first link and the target database as the first index information. In the application stage, after the user receives the short link, the target database storing the first link can be quickly found based on the first index information, thereby obtaining the first link. Determining the target database through the policy rule makes the storage flexibility of the first link stronger.

[0107] Step 106: Determine second index information between the second link and the target database according to the first index information.

[0108] The second link corresponds to the first link, for example, each second link corresponds to one first link.

[0109] In this embodiment, the second link is a short link. Optionally, the second link can be obtained based on any method, as long as each first link corresponds to a unique second link. To ensure that the user can view the first link based on the second link after obtaining the second link, this embodiment determines the correspondence between the second link and the target database as second index information. The second index information can be used to determine the target database that stores the corresponding first link based on the second link.

[0110] Step 108: Feedback the second link and the second index information to the requesting end.

[0111] In this embodiment, the second link and the corresponding second index information are fed back to the requesting end, thereby realizing a short link service for the requesting end.

[0112] The rule-based link conversion method provided by the above-mentioned embodiment of the present disclosure receives a first link and a link conversion request sent by a requesting end, determines a target policy rule according to the link conversion request; stores the first link in a target database determined according to the target policy rule, and obtains first index information between the first link and the target database; determines second index information between a second link and the target database according to the first index information; the second link corresponds to the first link; and feeds back the second link and the second index information to the requesting end; the embodiment of the present disclosure determines the corresponding target policy rule according to the link conversion request, and realizes flexible determination of corresponding storage strategies for different requesting ends, determines the target database for storing the first connection based on the target policy rule, realizes dynamic allocation of the database for storage links, and solves the problem of database request breakdown in high concurrency scenarios; and feeds back the second link and the second index information to the requesting end to realize the generation of a short link, and based on the second index information fed back to the requesting end, it can be realized to connect to the first link based on the second link, thereby realizing efficient short link service.

[0113] like Figure 2 As shown in the above Figure 1 Based on the illustrated embodiment, step 102 may include the following steps:

[0114] Step 1021: Receive a first link and a link conversion request sent by a requesting end.

[0115] Optionally, the requesting end may have a corresponding flag bit or allocate a corresponding flag bit according to historical requests. For example, a corresponding flag bit is allocated to the requesting end according to a business scenario corresponding to the requesting end. Optionally, different business scenarios may correspond to different flag bits.

[0116] Step 1022, determine whether the connection conversion request includes a request flag, if so, execute step 1023; otherwise, execute step 1024.

[0117] Optionally, when the requesting end sends a link conversion request, in order to obtain a corresponding policy rule, a request flag bit corresponding to the requesting end may be inserted into the link conversion request, so as to achieve the purpose of sending the request flag bit.

[0118] Step 1023, determine the target policy rule according to the request flag.

[0119] Optionally, each flag bit corresponds to a policy rule, and the flag bit may be a small placeholder identifier such as a single letter, for example, the flag bit may be: a, or b, or c, or d, etc. When the connection conversion request includes the request flag bit, the target measurement rule may be determined according to the corresponding relationship between the flag bit and the measurement rule.

[0120] Step 1024, determining the target policy rule according to the preset flag bit.

[0121] Optionally, when there is no request flag, a preset flag can be used to correspond to the link conversion request. The preset flag can be determined according to a pre-set setting. For example, flag a is determined to be a preset flag. Whenever a link conversion request without a flag is received, the flag a is used to determine the corresponding target policy rule, wherein the policy rule corresponding to the preset flag is usually a more general policy rule. This embodiment matches the target policy rule through the flag. Compared with the solution of associating the database location with the traditional flag, this embodiment can provide more storage locations and storage methods by combining the flag with the policy rule, thereby meeting the link storage requirements of high-concurrency scenarios. The present disclosure introduces policy rules, associates the policy rules through the flag, and uses the parsing rule capability provided by the policy rules to provide short link storage (including index location, storage location, automatic storage expansion conditions, index query conditions, storage invalidation conditions, ...) rule parameters defined in the policy rules, and the calling code stores, distributes, and invalidates short links according to the parameter definition rules.

[0122] like Figure 3 As shown in the above Figure 1 Based on the illustrated embodiment, the target policy rules may include but are not limited to: allocation strategy, preset algorithm and index storage location; correspondingly, step 104 may include the following steps:

[0123] Step 1041, determining the target database according to the allocation strategy and the preset algorithm.

[0124] In this embodiment, each policy rule corresponds to a preset algorithm, and the preset algorithm may include but is not limited to: summing, averaging, weighted calculation, etc.; for example, the target policy rule corresponding to the flag bit a is average(sum,redis,0,mysql,1,100), wherein the storage location corresponding to the target policy rule is mysql,1,100, that is, including 100 databases numbered 1-100; the allocation strategy is average, indicating that multiple first links are evenly distributed to 100 databases (database 1 to database 100); the preset algorithm is sum, indicating that the digital information corresponding to the first link is summed to determine the identifier of the target database; the index storage location is redis,0; indicating that the first index information corresponding to the first link stored in databases 1-100 this time is stored in redis0. In this embodiment, the data storage efficiency for high-concurrency scenarios is improved by corresponding to multiple databases through one policy rule; and the rationality of the determination of the target database is improved by combining the allocation strategy with the preset algorithm to determine the target database from multiple databases.

[0125] Step 1042: store the first link in the target database, and obtain first index information between the first link and the target database.

[0126] After the target database is determined, the first link is stored in the target database to implement storage of the first link, so that subsequent users can connect to the first link when receiving the short link.

[0127] Step 1043, store the first index information into the index storage location.

[0128] In the embodiment of the present disclosure, the target policy rule also specifies an index storage location, for example, redis0 represents an index repository numbered 0; for another example, the index storage location includes two index repositories: redis0 and redis1. When only one index repository is included, the first index information can be directly stored in the index repository; when multiple index repositories are included, the corresponding index repository can be determined according to the allocation strategy (for example, each index repository corresponds to a database group. In one example, the target database group is determined from at least one database group corresponding to the target policy rule according to the allocation strategy, and the first index information is stored according to the index repository corresponding to the determined target database group); the first index information is stored in the index storage location, and after the user receives the short link (the second link), the first index information corresponding to the short link is searched in the index storage location (when there are multiple index repositories, each index repository is searched) through the second index information, and the first link (long link) corresponding to the short link is determined based on the matching first index information to achieve efficient and stable short link access.

[0129] like Figure 4 As shown in the above Figure 3 Based on the embodiment shown, the target policy rule further includes: a storage identifier corresponding to the database; step 1041 may include:

[0130] Step 401: perform calculation processing on the first link according to a preset algorithm to determine a corresponding storage identifier.

[0131] Optionally, the storage identifier can be a number or address in numerical form, for example, database 1-database 100, and a numerical value between 1-100 can be used as the storage identifier to correspond to the database; the first link is calculated and processed by a preset algorithm to obtain a digital feature value, and the corresponding storage identifier is determined based on the digital feature value. For example, the preset algorithm is a murmur algorithm, a hash value is calculated for the first link, and a numerical conversion is performed according to the hash value. The numerical conversion can adopt any conversion method, for example, a table lookup method, a correspondence method, etc.; in an optional example, a table lookup method can be used to determine a=1, b=2, c=3. When the hash value is abc, by calculating a+b+c=6, the digital feature value can be determined to be 6, and the corresponding storage identifier is determined to be 6; the corresponding storage identifier is determined by the numerical feature value, which improves the rationality of the storage of the first link and avoids the storage of a large amount of data in the same database.

[0132] Optionally, the target policy rule further includes: storage ratio information; the index storage location includes n index storage repositories; the database corresponding to the target policy rule is divided into n database groups, where n is an integer greater than or equal to 2; each index storage repositories corresponds to one database group;

[0133] Optionally, step 401 includes:

[0134] Calculate and process the first link according to a preset algorithm to determine a corresponding initial identifier;

[0135] Determine the index storage repository corresponding to the first link according to the storage ratio information;

[0136] The storage identifier is determined according to the database group and the initial identifier corresponding to the index repository.

[0137] Optionally, the initial identifier can be determined based on the above-mentioned method of calculating the digital characteristic value. When the storage ratio information is specified, when determining the storage identifier, it is first determined whether the storage data in the database group reaches the storage ratio. For example, in an example, the target policy rule is: average(sum, switchcondition, 80%, reids, 0, mysql, 1, 100, redis, 1, mysql, 101-500), where switchcondition represents a constraint condition. In this embodiment, the constraint condition is that the storage ratio is 80%, that is, in the example, in the database mysql1-m When the storage capacity in ysql100 reaches 80% of the storage space, mysql101-mysql500 corresponding to redis1 is automatically used for storage; that is, when the storage ratio information reaches the preset storage ratio, it automatically moves to the next corresponding index storage repository. For example, in the above example, when the storage ratio is greater than 80%, the index storage repository is determined to be redis1. At this time, the position of the corresponding initial identifier is searched in the database group corresponding to the index storage repository to determine the storage identifier. For example, the initial identifier is 6, and the starting storage identifier of mysql101-mysql500 is 101. Counting 6 from 101 can determine that the storage identifier is 106. This embodiment realizes the determination of storage identifiers when there is storage ratio information in multiple database groups, meets the different needs of different database groups, realizes link storage according to database characteristics, and improves link storage efficiency.

[0138] Step 402: determine the target database according to the allocation strategy and the storage identifier.

[0139] When the target policy rule only includes the database group, that is, all databases corresponding to the target policy rule correspond to the same index repository, the corresponding database can be directly determined as the target database from multiple databases based on the storage identifier. For example, the determined storage identifier is 6, and database 6 in databases 1-100 is determined as the target database; optionally, the policy rule may include multiple database groups, and step 402 may include: determining the target database group from at least one database group corresponding to the target policy rule according to the allocation strategy, each database group including at least one database; and determining the target database in the target database group according to the storage identifier. For example, in an example, the target policy rule is: distributebyweight(murmur,reids,2,mysql,1,90%,mysql,2,10%), which includes two database groups (each database group includes a database, mysql1 and mysql2), and the two database groups correspond to index storage locations: reids2 and reids1 respectively; the distribution policy distributebyweight indicates distribution according to weight, and the weight is specifically 90% for mysql1 and 10% for mysql2, that is, after determining the storage identifier, it is necessary to determine the corresponding target database according to the weight, so as to distribute the first link in the ratio of 9:1 to database 1 and database 2. This embodiment realizes more reasonable use of the database by combining the distribution policy and the storage identifier to jointly determine the target database, so that the distribution of the first link in the database is more in line with the distribution policy, and the problem of database request breakdown is avoided.

[0140] like Figure 5 As shown in the above Figure 4 Based on the embodiment shown, the target policy rule further includes an extended interface; step 402 may also include:

[0141] Step 4021: Update the target policy rule based on receiving at least one extended information through the extended interface to obtain an extended policy rule.

[0142] This embodiment receives at least one extension information through an extension interface to implement dynamic configuration rules, and can expand and / or dynamically rewrite policy rules based on the originally defined policy rules, thereby realizing the ability to dynamically expand short link storage space, multiple index locations, automatic expansion conditions, etc. multiple times without modifying the flag bit. It can more flexibly cope with various special business scenarios without modifying the flag bit.

[0143] In some optional examples, Case 1: The target strategy rule corresponding to flag a is average(sum,redis,0,mysql,1,100), and the allocation strategy average is an equal distribution strategy, which tries to evenly distribute the storage traffic of the long link to the database range represented by the rule parameter; use redis No. 0 as the index database, mysql databases No. 1-100 as the actual storage long chain database, and use the link weighted sum sum algorithm to distribute it to a mysql database in 1-100. Case 2: Based on Case 1, if further capacity expansion is required to cope with traffic peaks or storage exhaustion scenarios, the target policy rule can be extended through the extension interface without adding new flags. For example, the target policy rule corresponding to the a flag can be changed from the initial: average(sum,reids,0,mysql,1,100) to: average(sum,switchcondition,80%,reids,0,mysql,1,100,redis,1,mysql,101-500) according to the received extended information. The storage ratio information is added. After the total storage capacity of MySQL databases 1-100 reaches 80%, the index information is allocated to redis1, and the link weighted sum algorithm is used to determine the target database from databases 101-500.

[0144] Case 3: For some short links, they need to expire directly after being clicked and no one else is allowed to click them again. Based on Case 2, the above target policy rule can be extended to the following extended policy rule: average(sum, switchcondition, 80%, reids, 0, mysql, 1, 100, redis, 1, mysql, 101-500, 'expirationpolicy', 1), and the newly added 'expirationpolicy' = 1 means that the number of expiration clicks is 1. If you need to expire after 10 clicks, you can set 'expirationpolicy' = 10.

[0145] Step 4022, the storage identifier is processed through the extended information to obtain the extended identifier.

[0146] Optionally, a corresponding extension identifier may be determined in a database group corresponding to the extension policy rule according to the extension information. For example, the extension identifier may be determined by referring to the storage identifier determination method in any of the above embodiments.

[0147] Step 4023: Determine a target database group from at least one database group corresponding to the expansion policy rule according to the allocation policy.

[0148] Each database group includes at least one database. The corresponding index storage repository can be determined according to the allocation strategy, and then the target database group can be determined according to the database group corresponding to the index storage repository.

[0149] Step 4024: determine the target database in the target database group according to the extension identifier.

[0150] The process of determining the target database in the target database group based on the determined extension identifier can refer to the process of determining the target database based on the storage identifier in any of the above embodiments. This embodiment realizes dynamic modification of storage (location, expiration time, index query and other indicators) by dynamically modifying the rule strategy. It can better cope with special scenarios: multiple expansion requirements in high-concurrency scenarios, dynamic control of short-link storage failure, dynamic configuration of short-link generation location based on multiple factors, etc.

[0151] like Figure 6 As shown in the above Figure 1 Based on the illustrated embodiment, step 106 may include the following steps:

[0152] Step 1061, determine the second link.

[0153] The length of the second link is shorter than that of the first link. For example, the first link is a long link and the second link is a short link. The first link and the second link correspond to the same network address. Optionally, when the second link is accessed, the access to the corresponding network address is achieved by accessing the first link.

[0154] Optionally, step 1061 may include: determining a third link of a preset length according to the first link; and inserting a request flag bit into the third link to obtain the second link.

[0155] In this embodiment, the third link can be generated by any method, and it is only necessary to ensure that the length of the third link is within a preset range. For example, a link of a preset length is randomly generated as the third link. In an optional example, the first link is Educative: Interactive Courses for Software Developers, and the corresponding third link can be: tinyurl.com / 123, or tinyurl.com / 456, or ingg.com / 234, etc.; after the third link is determined, the request flag corresponding to the first link is inserted into the third link to obtain the second link. For example, the request flag is a, and the third link is tinyurl.com / 123. After insertion, the second link tinyurl.com / 123a can be obtained; this embodiment realizes the correspondence between the second link and the first link by inserting the request flag.

[0156] Step 1062: Determine the correspondence between the second link and the first index information according to the first link corresponding to the first index information and the correspondence between the second link and the first link.

[0157] Optionally, since the first index information corresponds to the first link, and the second link corresponds to the first link one-to-one, the second link corresponds to the first index information one-to-one, that is, each second link corresponds to one first index information.

[0158] Step 1063: Determine the second index information according to the correspondence between the second link and the first index information.

[0159] In this embodiment, the correspondence between the second link and the first index information is used as the second index information, and the second index information is stored in a separate index storage repository. After returning to the requesting end, the requesting end sends the second link to the user. The user clicks on the second link to determine the first index information corresponding to the second link through the stored second index information, determines the target database according to the first index information, reads the corresponding first link from the target database, and enters the network address corresponding to the second link through the first link, thereby realizing short link access and solving the short link demand of the requesting end. In addition, due to the introduction of policy rules, the policy rules corresponding to the same flag bit can be updated incrementally without destroying the original rule structure. Whether it is for high concurrency scenarios, short link click active failure scenarios, or other scenarios, this solution is more applicable and flexible.

[0160] Any rule-based link conversion method provided in the embodiments of the present disclosure may be executed by any appropriate device with data processing capabilities, including but not limited to: a terminal device and a server, etc. Alternatively, any rule-based link conversion method provided in the embodiments of the present disclosure may be executed by a processor, such as the processor executing any rule-based link conversion method mentioned in the embodiments of the present disclosure by calling corresponding instructions stored in a memory. This will not be described in detail below.

[0161] Exemplary Devices

[0162] Figure 7 FIG. 1 is a schematic diagram of a structure of a rule-based link conversion device provided by an exemplary embodiment of the present disclosure. Figure 7 As shown, the device provided in this embodiment may include:

[0163] The rule determination module 71 is used to receive the first link and the link conversion request sent by the request end, and determine the target policy rule according to the link conversion request.

[0164] The database determination module 72 is used to store the first link in a target database determined according to the target policy rule, and obtain first index information between the first link and the target database.

[0165] The second link index module 73 is used to determine the second index information between the second link and the target database according to the first index information.

[0166] Among them, the second link corresponds to the first link.

[0167] The link feedback module 74 is used to feed back the second link and the second index information to the requesting end.

[0168] The rule-based link conversion device provided by the above-mentioned embodiment of the present disclosure receives a first link and a link conversion request sent by a requesting end, determines a target policy rule according to the link conversion request; stores the first link in a target database determined according to the target policy rule, and obtains first index information between the first link and the target database; determines second index information between a second link and the target database according to the first index information; the second link corresponds to the first link; and feeds back the second link and the second index information to the requesting end; the embodiment of the present disclosure determines the corresponding target policy rule according to the link conversion request, realizes flexible determination of corresponding storage strategies for different requesting ends, determines the target database for storing the first connection based on the target policy rule, realizes dynamic allocation of the database for storage links, and solves the problem of database request breakdown in high concurrency scenarios; and feeds back the second link and the second index information to the requesting end to realize the generation of a short link, and based on the second index information fed back to the requesting end, it can be realized to connect to the first link based on the second link, thereby realizing efficient short link service.

[0169] In some optional embodiments, the rule determination module 71 is specifically used to receive a first link and a link conversion request sent by a requesting end; determine whether the connection conversion request includes a request flag; in response to the presence of a request flag in the link conversion request, determine a target policy rule according to the request flag.

[0170] Optionally, the rule determination module 71 is further configured to determine a target policy rule according to a preset flag bit in response to the absence of a request flag bit in the link conversion request.

[0171] In some optional embodiments, the second link index module 73 is specifically used to determine the second link; the length of the second link is less than the first link; based on the first link corresponding to the first index information, and the correspondence between the second link and the first link, determine the correspondence between the second link and the first index information; based on the correspondence between the second link and the first index information, determine the second index information.

[0172] Optionally, when determining the second link, the second link index module 73 is configured to determine a third link of a preset length according to the first link; and insert a request flag into the third link to obtain the second link.

[0173] In some optional embodiments, the target policy rule includes: an allocation strategy, a preset algorithm and an index storage location; the database determination module 72 includes:

[0174] A target database determination unit, used to determine a target database according to an allocation strategy and a preset algorithm;

[0175] A first indexing unit, used to store the first link in a target database, and obtain first index information between the first link and the target database;

[0176] The information storage unit is used to store the first index information into the index storage location.

[0177] Optionally, the target policy rule also includes: a storage identifier corresponding to the database; a target database determination unit, specifically configured to perform calculation processing on the first link according to a preset algorithm to determine the corresponding storage identifier; and determine the target database according to the allocation policy and the storage identifier.

[0178] Optionally, when determining the target database according to the allocation strategy and the storage identifier, the target database determination unit is used to determine the target database group from at least one database group corresponding to the target policy rule according to the allocation strategy, each database group including at least one database; and determine the target database in the target database group according to the storage identifier.

[0179] Optionally, the target policy rule further includes: storage ratio information; the index storage location includes n index storage repositories; the database corresponding to the target policy rule is divided into n database groups, where n is an integer greater than or equal to 2; each index storage repositories corresponds to one database group;

[0180] When the target library determination unit calculates and processes the first link according to the preset algorithm to obtain the storage identifier, it is used to calculate and process the first link according to the preset algorithm to determine the corresponding initial identifier; determine the index storage library corresponding to the first link according to the storage ratio information; and determine the storage identifier according to the database group and the initial identifier corresponding to the index storage library.

[0181] Optionally, the target policy rule also includes an extended interface; optionally, when the target database determination unit determines the target database according to the allocation strategy and the storage identifier, it is also used to update the target policy rule based on at least one extended information received through the extended interface to obtain the extended policy rule; process the storage identifier through the extended information to obtain the extended identifier; determine the target database group from at least one database group corresponding to the extended policy rule according to the allocation strategy, each database group including at least one database; determine the target database in the target database group according to the extended identifier.

[0182] Exemplary Electronic Devices

[0183] Below, reference Figure 8 The electronic device according to the embodiment of the present disclosure is described. The electronic device may be any one or both of the first device and the second device, or a stand-alone device independent of them, and the stand-alone device may communicate with the first device and the second device to receive the collected input signals from them.

[0184] Figure 8 A block diagram of an electronic device according to an embodiment of the present disclosure is illustrated.

[0185] like Figure 8 As shown, the electronic device includes one or more processors and memory.

[0186] The processor may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.

[0187] The memory may store one or more computer program products, and the memory may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program products may be stored on the computer-readable storage medium, and the processor may run the computer program product to implement the rule-based link conversion method of each embodiment of the present disclosure described above and / or other desired functions.

[0188] In one example, the electronic device may further include: an input device and an output device, and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0189] In addition, the input device may also include, for example, a keyboard, a mouse, and the like.

[0190] The output device can output various information to the outside, including the determined distance information, direction information, etc. The output device can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.

[0191] Of course, to simplify, Figure 8 Only some of the components related to the present disclosure in the electronic device are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device may further include any other appropriate components.

[0192] In addition to the above-mentioned methods and devices, an embodiment of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps in the rule-based link conversion method according to various embodiments of the present disclosure described in the above part of this specification.

[0193] The computer program product may be written in any combination of one or more programming languages ​​to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0194] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, enables the processor to execute the steps of the rule-based link conversion method according to various embodiments of the present disclosure described in the above part of this specification.

[0195] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0196] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.

[0197] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0198] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.

[0199] The method and apparatus of the present disclosure may be implemented in many ways. For example, the method and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above, unless otherwise specifically stated. In addition, in some embodiments, the present disclosure may also be implemented as a program recorded in a recording medium, which includes machine-readable instructions for implementing the method according to the present disclosure. Therefore, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.

[0200] It should also be noted that in the apparatus, device and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.

[0201] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0202] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. A rule-based link conversion method, characterized in that: include: receiving a first link and a link conversion request sent by a requesting end, and determining a target policy rule according to the link conversion request; storing the first link in a target database determined according to the target policy rule, and determining first index information between the first link and the target database; Determine, according to the first index information, second index information between a second link and the target database; the second link corresponds to the first link; Feedback the second link and the second index information to the requesting end.

2. The method according to claim 1, characterized in that The receiving the first link and the link conversion request sent by the requesting end, and determining the target policy rule according to the link conversion request, comprises: receiving the first link and the link conversion request sent by the requesting end; Determining whether the connection conversion request includes a request flag bit; In response to the request flag bit existing in the link conversion request, the target policy rule is determined according to the request flag bit.

3. The method according to claim 2, characterized in that Also includes: In response to the absence of the request flag in the link conversion request, the target policy rule is determined according to a preset flag.

4. The method according to claim 2 or 3, characterized in that: The determining, according to the first index information, second index information between the second link and the target database includes: determining the second link; the length of the second link being shorter than the first link; Determine a correspondence relationship between the second link and the first index information according to the first link corresponding to the first index information and the correspondence relationship between the second link and the first link; The second index information is determined according to a correspondence between the second link and the first index information.

5. The method according to claim 4, characterized in that The determining the second link comprises: Determine a third link of a preset length according to the first link; The request flag is inserted into the third link to obtain the second link.

6. The method according to any one of claims 1 to 5, characterized in that: The target strategy rules include: allocation strategy, preset algorithm and index storage location; The step of storing the first link in a target database determined according to the target policy rule and determining first index information between the first link and the target database includes: Determine the target database according to the allocation strategy and the preset algorithm; storing the first link in the target database to obtain first index information between the first link and the target database; The first index information is stored in the index storage location.

7. The method according to claim 6, characterized in that The target policy rule also includes: a storage identifier corresponding to the database; The determining the target database according to the allocation strategy and the preset algorithm includes: Performing calculation processing on the first link according to the preset algorithm to determine a corresponding storage identifier; The target database is determined according to the allocation strategy and the storage identifier.

8. The method according to claim 7, characterized in that The step of determining the target database according to the allocation strategy and the storage identifier includes: Determine a target database group from at least one database group corresponding to the target policy rule according to the allocation strategy, each of the database groups including at least one database; The target database is determined in the target database group according to the storage identifier.

9. The method according to claim 7 or 8, characterized in that: The target policy rule also includes: storage ratio information; the index storage location includes n index storage repositories; the database corresponding to the target policy rule is divided into n database groups, where n is an integer greater than or equal to 2; each index storage repositories corresponds to one database group; The calculating and processing the first link according to the preset algorithm to obtain a storage identifier includes: Performing calculation processing on the first link according to the preset algorithm to determine a corresponding initial identifier; Determine the index storage repository corresponding to the first link according to the storage ratio information; The storage identifier is determined according to the database group corresponding to the index storage repository and the initial identifier.

10. The method according to any one of claims 7 to 9, characterized in that: The target policy rule also includes an extended interface; The step of determining the target database according to the allocation strategy and the storage identifier includes: The target policy rule is updated based on at least one extended information received through the extended interface to obtain an extended policy rule; Processing the storage identifier through the extended information to obtain the extended identifier; Determine a target database group from at least one database group corresponding to the expansion strategy rule according to the allocation strategy, each of the database groups including at least one database; The target database is determined in the target database group according to the extension identifier.

11. An electronic device, characterized in that: include: A memory for storing a computer program product; A processor is used to execute the computer program product stored in the memory, and when the computer program product is executed, the rule-based link conversion method described in any one of claims 1 to 10 is implemented.

12. A computer program product comprising computer program instructions, characterized in that When the computer program instructions are executed by a processor, the rule-based link conversion method described in any one of claims 1 to 10 is implemented.