Data migration method and device in cache framework upgrade process
By setting traffic redirection rules during the caching framework upgrade process, gradually migrating data and performing small-batch verification, the downtime and database pressure issues during the caching framework upgrade were resolved, achieving seamless migration and business continuity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PINGAN YIQIANBAO E COMMERCE CO LTD
- Filing Date
- 2023-02-09
- Publication Date
- 2026-07-03
AI Technical Summary
During the upgrade of the caching framework, the existing technology requires system downtime or service interruption, which affects business stability and puts excessive pressure on the database, making seamless migration impossible.
By setting a preset first traffic redirection rule, data is gradually migrated from the cache to be upgraded to the upgraded cache. The target business fields are queried using the cache to be upgraded and the upgraded cache, reducing the pressure on the database. Small-batch verification and switching are performed during the migration process.
It enables data migration during the caching framework upgrade process without downtime or service interruption, ensuring the stability and availability of core services, reducing database pressure, and avoiding production failures.
Smart Images

Figure CN115994129B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a data migration method and apparatus during the upgrade process of a caching framework. Background Technology
[0002] In internet companies, caching frameworks are widely used. When business scale and volume are relatively low, the caching framework only needs to meet the immediate business requirements. However, as business volume grows, the old caching framework can no longer meet the increasing business and technical demands, thus requiring an upgrade. This upgrade is equivalent to replacing the backend database, requiring data migration. Currently, most upgrade processes face the following problems: 1. System downtime or service interruption is required. Data in the old cache must be migrated to the new cache before the new cache can assist the database in processing business logic, which is detrimental to business operations. 2. During the switch, directly discarding the old data in the old cache and integrating the new caching architecture puts significant pressure on the database, affecting other services.
[0003] Therefore, how to complete the data migration during the caching framework upgrade process without system downtime or service interruption, ensuring the stability and availability of core services and not affecting business operations, is a current research direction. Summary of the Invention
[0004] This invention provides a data migration method and apparatus for caching framework upgrades, which solves the problem that existing caching upgrades require system downtime or service interruption, affecting business operations and causing significant impact on the database. The invention enables data migration during caching framework upgrades without system downtime or service interruption, ensuring the stability and availability of core services, without affecting business operations, and reducing database pressure.
[0005] A data migration method during a caching framework upgrade process includes: receiving a first request to query a target business field; determining, based on a preset first traffic redirection rule, to query the target business field in a cache to be upgraded or an already upgraded cache; the preset first traffic redirection rule is used to determine data traffic entering the already upgraded cache; if first information corresponding to the target business field is obtained from the cache to be upgraded or the already upgraded cache, then responding to the first request based on the first information; or, if the target business field is not found from the cache to be upgraded or the already upgraded cache, then obtaining second information corresponding to the target business field from a database, writing the second information into the cache to be upgraded or the already upgraded cache, and responding to the first request based on the second information.
[0006] In one embodiment, the preset first traffic redirection rule is determined based on the user information corresponding to the first request. Accordingly, determining to query the target business field in the cache to be upgraded or the cache already upgraded based on the preset first traffic redirection rule includes: if the user information corresponding to the first request meets the preset traffic redirection conditions, then determining to query the target business field in the cache already upgraded; or, if the user information corresponding to the first request does not meet the preset traffic redirection conditions, then determining to query the target business field in the cache to be upgraded.
[0007] In one embodiment, after responding to the first request, the method further includes: receiving a second request to update the target business field; updating the second information corresponding to the target business field in the database; and determining, based on a preset first traffic redirection rule, to delete the target business field and its corresponding information from the cache to be upgraded or from the cache that has already been upgraded.
[0008] In one embodiment, determining to delete the target business field and its corresponding information from the cache to be upgraded or from the upgraded cache based on a preset first traffic redirection rule includes: if the user information corresponding to the first request meets the preset traffic redirection conditions, then determining to delete the target business field and its corresponding information from the upgraded cache; or, if the user information corresponding to the first request does not meet the preset traffic redirection conditions, then determining to delete the target business field and its corresponding information from the cache to be upgraded.
[0009] In one embodiment, deleting the target business field and its corresponding information from the cache to be upgraded includes: determining whether to delete the target business field and its corresponding information from the cache to be upgraded according to a preset second traffic redirection rule.
[0010] In one embodiment, the second traffic redirection rule is determined based on preset key fields. Accordingly, determining whether to delete the target business field and its corresponding information in the cache to be upgraded according to the preset second traffic redirection rule includes: if the target business field is the same as any one of the preset key fields, then retain the target business field and its corresponding information in the cache to be upgraded; or, if the target business field is different from each of the preset key fields, then delete the target business field and its corresponding information in the cache to be upgraded.
[0011] In one embodiment, before retrieving the first information corresponding to the target business field from the cache to be upgraded or the cache that has already been upgraded, the method further includes: updating the first information corresponding to the target business field in the cache to be upgraded or the cache that has already been upgraded.
[0012] A data migration device for a caching framework upgrade process, the device comprising: a receiving module, configured to receive a first request to query a target business field; a determining module, configured to determine, based on a preset first traffic redirection rule, to query the target business field in a cache to be upgraded or an upgraded cache; the preset first traffic redirection rule being used to determine data traffic entering the upgraded cache; a first response module, configured to respond to the first request according to the first information if the target business field is found in the cache to be upgraded or the upgraded cache; or, a second response module, configured to, if the target business field is not found in the cache to be upgraded or the upgraded cache, query a database to obtain second information corresponding to the target business field, write the second information into the cache to be upgraded or the upgraded cache, and respond to the first request according to the second information.
[0013] A computer device includes a memory and a processor, the memory storing computer-readable instructions that, when executed by the processor, cause the processor to perform the steps of the data migration method described above in the cache framework upgrade process.
[0014] A storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the data migration method described above in the cache framework upgrade process.
[0015] The data migration method and apparatus described above for the caching framework upgrade process gradually controls the data traffic entering the upgraded cache by setting a preset first traffic redirection rule. This prevents the data from being directly migrated from the cache to be upgraded to the upgraded cache during the upgrade process. Instead of directly querying the target business fields from multiple requests in the database during the migration, the target business fields are first queried from either the cache to be upgraded or the upgraded cache according to the preset first traffic redirection rule. This distributes the pressure on the database compared to directly querying all requests for the target business fields during the caching framework upgrade process, achieving a smooth, gradual data migration process from the cache to be upgraded to the upgraded cache. Furthermore, by determining the data traffic entering the upgraded cache based on the preset first traffic redirection rule, the flow of traffic into the upgraded cache can be controlled. Small-batch verification can be performed first, and if problems arise, the data can be switched back to the cache to be upgraded in a timely manner, avoiding production failures. Therefore, the data migration during the caching framework upgrade process can be completed without system downtime or service interruption, ensuring the stability and availability of core services, not affecting business operations, and reducing database pressure. Attached Figure Description
[0016] Figure 1 This is a diagram illustrating the implementation environment of a data migration method during a caching framework upgrade process, as provided in one embodiment.
[0017] Figure 2 This is one of the flowcharts illustrating the data migration method during the caching framework upgrade process in one embodiment;
[0018] Figure 3 This is the second flowchart illustrating the data migration method during the caching framework upgrade process in one embodiment.
[0019] Figure 4 This is a structural block diagram of a data migration device during a cache framework upgrade process in one embodiment;
[0020] Figure 5 This is a schematic diagram of an electronic device in one embodiment. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0022] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0023] To facilitate understanding, the technical terms involved in this invention will first be explained.
[0024] Caching is generally used to handle high-concurrency scenarios and alleviate database read / write pressure by storing data in a faster storage medium (such as memory) to speed up data retrieval. A cache is a memory buffer used to temporarily store frequently accessed data. It improves performance because data no longer needs to be retrieved from the original source. Caching is actually a concept that has been used in various areas of the computer / networking industry for quite some time, and therefore, different methods are used to implement caching depending on the use case. In fact, devices such as routers, switches, and personal computers use caching to accelerate memory access. Another very common type of caching used by almost all computers is the web browser cache, which stores requested objects so that the same data does not need to be retrieved multiple times.
[0025] Typically, as business volume increases, caching framework upgrades are necessary. The framework upgrade process usually faces the following problems: 1. It requires system downtime or service interruption. Data from the old cache must be migrated to the new cache before the new cache can assist the database in processing business logic, which is detrimental to business operations. 2. When upgrading the framework, directly discarding the old data in the old cache and implementing the new caching architecture means that since all data is stored in the database and cannot be stored in the cache, all requests will query the database for the corresponding data, putting significant pressure on the database and affecting other services. Therefore, to address these problems, this invention proposes a data migration method for the caching framework upgrade process.
[0026] The following is combined with Figures 1-5 This invention describes a data migration method and apparatus during the upgrade process of a caching framework.
[0027] Figure 1 The implementation environment diagram for the data migration method in the caching framework upgrade process provided in one embodiment includes computer device 110 and terminal device 120.
[0028] Computer device 110 is a device for data migration during the caching framework upgrade process. Computer device 110 includes a database, a cache to be upgraded, and an upgraded cache. Computer device 110 can receive a first request from terminal device 120 to query a target business field, and determine whether to query the target business field in the cache to be upgraded or the upgraded cache based on a preset first traffic redirection rule. The preset first traffic redirection rule is used to determine the data traffic entering the upgraded cache. If first information corresponding to the target business field is obtained from the cache to be upgraded or the upgraded cache, the first request is responded to based on the first information. Or, if the target business field is not found from the cache to be upgraded or the upgraded cache, second information corresponding to the target business field is obtained from the database, written to the cache to be upgraded or the upgraded cache, and the first request is responded to based on the second information.
[0029] It should be noted that the terminal device 120 and the computer device 110 may be smartphones, tablets, laptops, desktop computers, etc., but are not limited to these. The computer device 110 and the terminal device 10 can be connected via Bluetooth, Universal Serial Bus (USB) or other communication connection methods, and the present invention does not impose any limitations on this.
[0030] like Figure 2 As shown, in one embodiment, a data migration method is proposed for a caching framework upgrade process, which can be executed by the aforementioned computer device 110. Specifically, as... Figure 2 As shown, the data migration method during the caching framework upgrade process provided by this invention may include the following steps:
[0031] Step 210: Receive the first request to query the target business field.
[0032] The first request can be a request from a terminal device to query a target business field. It is understood that there may be situations where first requests to query a target business field are received simultaneously from different terminal devices. Therefore, the method provided in this invention can be used to respond accordingly to the requests from different terminal devices.
[0033] Step 220: Based on the preset first traffic redirection rule, determine the target business field to be queried in the cache to be upgraded or the cache that has been upgraded; the preset first traffic redirection rule is used to determine the data traffic entering the upgraded cache.
[0034] Understandably, to avoid the problem of all requests querying the database for the same data during a framework upgrade due to directly discarding old data in the cache to be upgraded and then integrating the upgraded caching architecture, which would put significant pressure on the database and affect other services, a preset first traffic redirection rule is set to gradually control the data traffic entering the upgraded cache. This prevents the data from being directly migrated from the cache to be upgraded to the upgraded cache during the upgrade process. Instead of directly querying the database for the target business field in multiple requests during the migration, the preset first traffic redirection rule allows for querying the target business field from either the cache to be upgraded or the upgraded cache. This distributes the pressure on the database from all requests querying the target business field during the cache framework upgrade process, achieving a smooth migration of data from the cache to be upgraded to the upgraded cache. In other words, by gradually introducing the upgraded caching framework, even if the upgraded caching framework cannot find the target business field, the traffic directly querying the database can be controlled and gradually increased, resulting in smooth and controllable pressure on the database, avoiding the huge pressure or even database crash caused by a one-time switch. Furthermore, based on the preset first traffic redirection rule, the data traffic entering the upgraded cache is determined, and the traffic entering the upgraded cache can be controlled. Small-batch verification can be performed first, and if there are any problems, the system can switch back to the cache to be upgraded in a timely manner to avoid production failures.
[0035] Step 230: If the first information corresponding to the target business field is obtained from the cache to be upgraded or the cache that has been upgraded, then respond to the first request based on the first information.
[0036] Among them, the first information corresponding to the target business field is the value information of the target business field in the cache to be upgraded or the cache that has been upgraded.
[0037] It is understandable that during the data migration process, not all data in the cache to be upgraded is directly migrated to the upgraded cache. Instead, a portion of the data is retained in the cache to be upgraded, while the other portion is updated in the upgraded cache. Therefore, when receiving the first request to query the target business field, it is necessary to determine whether to query the target business field in the cache to be upgraded or in the upgraded cache.
[0038] Optionally, corresponding to step 230, if the target business field is not found in the cache to be upgraded or the upgraded cache, the data migration method in the cache framework upgrade process provided by the present invention may further include step 240: if the target business field is not found in the cache to be upgraded or the upgraded cache, then the second information corresponding to the target business field is obtained from the database, and the second information is written into the cache to be upgraded or the upgraded cache, and the first request is responded to according to the second information.
[0039] The second piece of information corresponding to the target business field is the value information of the target business field in the database.
[0040] It is understood that step 250 may be included before step 230 above.
[0041] Step 250: Update the first information corresponding to the target business field in the cache to be upgraded or the cache that has already been upgraded.
[0042] In other words, before receiving the first request, a request to query the target service field may have already been received from the same terminal device. Therefore, based on steps 210 to 240 above, the first information corresponding to the target service field can be updated in the cache to be upgraded or the cache that has already been upgraded. In other words, the second information written to the cache to be upgraded or the cache that has already been upgraded in step 240 above is the first information of the target service field obtained in the next query.
[0043] It is also understandable that by using the preset first traffic redirection rule to determine the target business field to be queried in the cache to be upgraded or the cache that has already been upgraded, the upgraded cache framework is gradually introduced. For cases where the upgraded cache framework cannot be hit, the traffic to directly query the database can also be controlled and gradually increased. The pressure on the database is smooth and controllable, and it will not cause a huge pressure on the database or even cause the database to crash due to a one-time switch.
[0044] The data migration method provided by this invention during the caching framework upgrade process gradually controls the data traffic entering the upgraded cache by setting a preset first traffic redirection rule. This prevents the direct migration of data from the cache to be upgraded to the upgraded cache during the upgrade process, which would otherwise require querying the target business fields from multiple requests in the database. Instead, the target business fields are queried from either the cache to be upgraded or the upgraded cache according to the preset first traffic redirection rule. This distributes the pressure on the database, avoiding the strain of directly querying all requests for the target business fields during the caching framework upgrade process. This achieves a smooth, gradual data migration process from the cache to be upgraded to the upgraded cache. Furthermore, by determining the data traffic entering the upgraded cache based on the preset first traffic redirection rule, the method controls the traffic entering the upgraded cache, allowing for small-batch verification first. If problems arise, the system can be switched back to the cache to be upgraded in a timely manner, preventing production failures. Therefore, the data migration during the caching framework upgrade process can be completed without system downtime or service interruption, ensuring the stability and availability of core services, maintaining business operations, and reducing database pressure.
[0045] In one embodiment, the preset first traffic redirection rule is determined based on the user information corresponding to the first request. Accordingly, determining to query the target business field in the cache to be upgraded or the cache already upgraded based on the preset first traffic redirection rule includes: if the user information corresponding to the first request meets the preset traffic redirection conditions, then determining to query the target business field in the cache already upgraded; or, if the user information corresponding to the first request does not meet the preset traffic redirection conditions, then determining to query the target business field in the cache to be upgraded.
[0046] The user information corresponding to the first request can be, for example, the identification information (ID) of the user corresponding to the first request. For ease of understanding, the following example illustrates how the above-mentioned query for the target business field is determined in the cache to be upgraded or the cache that has already been upgraded based on the preset first traffic redirection rule.
[0047] For example, if a user ID is a 6-digit number, such as 100001, 100002, 100003, ..., 100009, 100010, ..., then the proportion of users entering the upgraded cache framework can be determined by setting a corresponding traffic switch based on the user ID corresponding to the first request. For example, if the last digit of the user ID corresponding to the first request is set to "1", then all requests received from users whose last digit of their user ID is "1" will query the target business field in the upgraded cache (i.e., if the user information corresponding to the first request meets the preset traffic redirection conditions, then the target business field will be queried in the upgraded cache); all requests received from users whose last digit of their user ID is not "1" will query the target business field in the cache to be upgraded (i.e., if the user information corresponding to the first request does not meet the preset traffic redirection conditions, then the target business field will be queried in the cache to be upgraded). In this way, the number of users querying in the upgraded cache framework can be controlled to approximately 10%. Similarly, if the last two digits of the user ID corresponding to the first request are set to "10", then all requests received from users whose last two digits of their user ID are "10" will query the target business field in the upgraded cache (i.e., if the user information corresponding to the first request meets the preset traffic redirection conditions, then the target business field will be queried in the upgraded cache); all requests received from users whose last two digits of their user ID are not "10" will query the target business field in the cache to be upgraded (i.e., if the user information corresponding to the first request does not meet the preset traffic redirection conditions, then the target business field will be queried in the cache to be upgraded). This way, the number of users querying the upgraded cache framework can be controlled to approximately 1%. Similarly, the last three digits of the user ID corresponding to the first request, "100", can also be set to the traffic switch to control the traffic entering the upgraded cache framework.
[0048] In one embodiment, such as Figure 3 As shown, after responding to the first request, the method further includes the following steps:
[0049] Step 310: A second request to update the target business field is received.
[0050] The second request can be a request from the terminal device to update the target business field.
[0051] Step 320: Update the second information corresponding to the target business field in the database.
[0052] As mentioned earlier, the second information corresponding to the target business field is the value information of the target business field in the database. Therefore, the value information of the target business field will change as the target business changes. In other words, the second information corresponding to the target business field will change as the target business changes, so it is necessary to update the second information corresponding to the target business field in the database according to the changes in the target business.
[0053] Step 330: Based on the preset first traffic redirection rule, determine whether to delete the target business field and its corresponding information from the cache to be upgraded or from the upgraded cache.
[0054] The target business field and its corresponding information can be the target business field and all related information. Typically, the target business field and its corresponding information include key-value pairs of the target business field.
[0055] As mentioned above, the preset first traffic redirection rule can be determined based on the user information corresponding to the first request. Therefore, specifically, if the user information corresponding to the first request meets the preset traffic redirection conditions, the target business field and its corresponding information are deleted from the upgraded cache; or, if the user information corresponding to the first request does not meet the preset traffic redirection conditions, the target business field and its corresponding information are deleted from the cache to be upgraded.
[0056] As can be understood, the process of determining whether the user information corresponding to the first request meets the preset traffic redirection conditions is similar to that described above, and will not be repeated here for the sake of brevity. After determining that the user information corresponding to the first request does not meet the preset traffic redirection conditions, the target business field and its corresponding information can be deleted from the upgraded cache or the cache to be upgraded.
[0057] It is also understood that, since the data migration provided by this invention does not directly migrate all the data in the cache to be upgraded to the upgraded cache, but rather performs a smooth migration to the upgraded cache step by step, it is necessary to gradually migrate the data in the cache to be upgraded to the upgraded cache before all the data in the cache to be upgraded is migrated. Therefore, the first traffic redirection rule can change according to different stages of data migration. For example, in the early stage of data migration, the last 3 digits of the user ID corresponding to the first request, "100", can be set as a traffic switch to control a small amount of traffic entering the upgraded cache framework, perform small-batch verification first, and facilitate timely switching back to the cache to be upgraded if problems occur, avoiding production failures; then, in the middle stage of data migration, the last digit of the user ID corresponding to the first request, "0", can be set as a traffic switch to increase the traffic entering the upgraded cache framework; finally, the traffic switches can be set sequentially according to the last digit of the user ID, "1", "2", "3", ... "9", until the upgraded cache framework is open to all users. Based on this, the traffic entering the upgraded framework can be controlled, which facilitates verification and controllable switching.
[0058] In one embodiment, deleting the target business field and its corresponding information from the cache to be upgraded includes: determining whether to delete the target business field and its corresponding information from the cache to be upgraded according to a preset second traffic redirection rule.
[0059] It is understandable that some important data in the cache to be upgraded may not need to be deleted. Therefore, a second traffic redirection rule can be set to determine whether to delete the target business fields and their corresponding information in the cache to be upgraded.
[0060] In one embodiment, the second traffic redirection rule is determined based on the preset key fields. Accordingly, determining whether to delete the target business field and its corresponding information in the cache to be upgraded according to the preset second traffic redirection rule includes: if the target business field is the same as any one of the preset key fields, then retain the target business field and its corresponding information in the cache to be upgraded; or, if the target business field is different from each of the preset key fields, then delete the target business field and its corresponding information in the cache to be upgraded.
[0061] The preset key fields are some frequently used and important business fields. Specifically, the corresponding key fields can be set according to the actual application scenario.
[0062] The data migration device for the cache framework upgrade process provided by the present invention is described below. The data migration device for the cache framework upgrade process described below corresponds to the data migration method for the cache framework upgrade process described above.
[0063] Figure 4 This is a schematic block diagram of a data migration device during the caching framework upgrade process provided by the present invention.
[0064] like Figure 4 As shown, the data migration device for the caching framework upgrade process provided by the present invention includes:
[0065] The first receiving module 410 is used to receive a first request to query the target business field;
[0066] The first determining module 420 is used to determine the target business field to be queried in the cache to be upgraded or the upgraded cache based on a preset first traffic redirection rule; the preset first traffic redirection rule is used to determine the data traffic entering the upgraded cache.
[0067] The first response module 430 is configured to respond to the first request based on the first information if the first information corresponding to the target business field is retrieved from the cache to be upgraded or the cache that has already been upgraded; or,
[0068] The second response module 440 is used to query the database to obtain the second information corresponding to the target business field if the target business field is not found in the cache to be upgraded or the cache that has been upgraded, and write the second information into the cache to be upgraded or the cache that has been upgraded, and respond to the first request according to the second information.
[0069] The data migration device provided by this invention for the caching framework upgrade process gradually controls the data traffic entering the upgraded cache by setting a preset first traffic redirection rule. This prevents the direct migration of data from the cache to be upgraded to the upgraded cache during the upgrade process, which would otherwise require querying multiple requests for target business fields from the database. Instead, the target business fields are queried from either the cache to be upgraded or the upgraded cache according to the preset first traffic redirection rule. This distributes the pressure on the database, avoiding the strain of directly querying all requests for target business fields during the caching framework upgrade process. This achieves a smooth, gradual data migration process from the cache to be upgraded to the upgraded cache. Furthermore, by determining the data traffic entering the upgraded cache based on the preset first traffic redirection rule, the device can control the traffic entering the upgraded cache. Small-batch verification can be performed first, and if problems arise, the system can be switched back to the cache to be upgraded in a timely manner, avoiding production failures. Therefore, the data migration during the caching framework upgrade process can be completed without system downtime or service interruption, ensuring the stability and availability of core services, maintaining business operations, and reducing database pressure.
[0070] In one embodiment, the first determining module 420 includes:
[0071] The first determining unit is configured to, if the user information corresponding to the first request meets preset traffic redirection conditions, determine to query the target business field in the upgraded cache; or,
[0072] The second determining unit is used to determine to query the target business field in the cache to be upgraded if the user information corresponding to the first request does not meet the preset traffic redirection conditions.
[0073] In one embodiment, the device further includes:
[0074] The second receiving module is used to receive a second request to update the target business field;
[0075] The first update module is used to update the second information corresponding to the target business field in the database;
[0076] The second determining module is used to determine, based on a preset first traffic redirection rule, whether to delete the target business field and its corresponding information from the cache to be upgraded or from the upgraded cache.
[0077] In one embodiment, the second determining module includes:
[0078] The third determining unit is configured to, if the user information corresponding to the first request meets preset traffic redirection conditions, determine to delete the target business field and its corresponding information from the upgraded cache; or,
[0079] The fourth determining unit is used to determine to delete the target business field and its corresponding information from the cache to be upgraded if the user information corresponding to the first request does not meet the preset traffic redirection conditions.
[0080] In one embodiment, the fourth determining unit includes:
[0081] The fifth determining unit is used to determine whether to delete the target business field and its corresponding information in the cache to be upgraded based on the preset second traffic diversion rule.
[0082] In one embodiment, the fifth determining unit is configured to include:
[0083] The retention unit is configured to retain the target business field and its corresponding information in the cache to be upgraded if the target business field is identical to any one of the preset key fields; or,
[0084] The deletion unit is used to delete the target business field and its corresponding information from the cache to be upgraded if the target business field is different from each of the preset key fields.
[0085] In one embodiment, the device further includes:
[0086] The second update module is used to update the first information corresponding to the target business field in the cache to be upgraded or the cache that has already been upgraded.
[0087] In one embodiment, a computer device is provided, the computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps: receiving a first request to query a target business field; determining to query the target business field in a cache to be upgraded or an upgraded cache based on a preset first traffic redirection rule; the preset first traffic redirection rule is used to determine the data traffic entering the upgraded cache; if first information corresponding to the target business field is obtained from the cache to be upgraded or the upgraded cache, then responding to the first request according to the first information; or, if the target business field is not found from the cache to be upgraded or the upgraded cache, then querying a database to obtain second information corresponding to the target business field, writing the second information into the cache to be upgraded or the upgraded cache, and responding to the first request according to the second information.
[0088] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute the data migration method in the cache framework upgrade process provided by the present invention. The data migration method in the cache framework upgrade process includes: receiving a first request to query a target service field; determining to query the target service field in the cache to be upgraded or the upgraded cache based on a preset first traffic redirection rule; the preset first traffic redirection rule is used to determine the data traffic entering the upgraded cache; if the first information corresponding to the target service field is obtained from the cache to be upgraded or the upgraded cache, then responding to the first request according to the first information; or, if the target service field is not found from the cache to be upgraded or the upgraded cache, then obtaining the second information corresponding to the target service field from the database, writing the second information into the cache to be upgraded or the upgraded cache, and responding to the first request according to the second information.
[0089] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0090] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, and when the program instructions are executed by a computer, the computer is able to execute the data migration method in the cache framework upgrade process provided by the present invention, wherein the data migration method in the cache framework upgrade process includes: receiving a first request to query a target business field; determining to query the target business field in the cache to be upgraded or the upgraded cache based on a preset first traffic redirection rule; the preset first traffic redirection rule is used to determine the data traffic entering the upgraded cache; if the first information corresponding to the target business field is obtained from the cache to be upgraded or the upgraded cache, then responding to the first request according to the first information; or, if the target business field is not found from the cache to be upgraded or the upgraded cache, then obtaining the second information corresponding to the target business field from the database, writing the second information into the cache to be upgraded or the upgraded cache, and responding to the first request according to the second information.
[0091] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a data migration method for the caching framework upgrade process provided by the present invention. The data migration method for the caching framework upgrade process includes: receiving a first request to query a target business field; determining, based on a preset first traffic redirection rule, to query the target business field in the cache to be upgraded or the upgraded cache; the preset first traffic redirection rule is used to determine the data traffic entering the upgraded cache; if first information corresponding to the target business field is obtained from the cache to be upgraded or the upgraded cache, then responding to the first request according to the first information; or, if the target business field is not found from the cache to be upgraded or the upgraded cache, then obtaining second information corresponding to the target business field from the database, writing the second information into the cache to be upgraded or the upgraded cache, and responding to the first request according to the second information.
[0092] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0093] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0094] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data migration method during a caching framework upgrade process, characterized in that, The method includes: The first request to query the target business field has been received; The target business field is queried in the cache to be upgraded or the cache that has been upgraded, based on a preset first traffic redirection rule; the preset first traffic redirection rule is used to determine the data traffic entering the upgraded cache, and the preset first traffic redirection rule is determined based on the user information corresponding to the first request; If the first information corresponding to the target business field is obtained from the cache to be upgraded or the cache that has already been upgraded, then the first request is responded to based on the first information; or, If the target business field is not found in the cache to be upgraded or the cache that has been upgraded, then the second information corresponding to the target business field is obtained from the database, and the second information is written into the cache to be upgraded or the cache that has been upgraded, and the first request is responded to according to the second information; After responding to the first request, the method further includes: A second request to update the target business field was received; Update the second information corresponding to the target business field in the database; Based on the preset first traffic redirection rule, the target business field and its corresponding information are either deleted from the cache to be upgraded or from the upgraded cache. Deleting the target business field and its corresponding information from the cache to be upgraded includes: determining whether to delete the target business field and its corresponding information from the cache to be upgraded according to a preset second traffic redirection rule, wherein the second traffic redirection rule is determined based on a preset key field.
2. The data migration method during the caching framework upgrade process as described in claim 1, characterized in that, The step of determining the target business field in the cache to be upgraded or the cache that has already been upgraded based on the preset first traffic redirection rule includes: If the user information corresponding to the first request meets the preset traffic redirection conditions, then the target business field will be queried from the upgraded cache; or, If the user information corresponding to the first request does not meet the preset traffic redirection conditions, then the target business field will be queried from the cache to be upgraded.
3. The data migration method during the caching framework upgrade process as described in claim 1, characterized in that, The step of determining whether to delete the target business field and its corresponding information from the cache to be upgraded or from the upgraded cache based on a preset first traffic redirection rule includes: If the user information corresponding to the first request meets the preset traffic redirection conditions, then the target business field and its corresponding information will be deleted from the upgraded cache; or, If the user information corresponding to the first request does not meet the preset traffic redirection conditions, then the target business field and its corresponding information will be deleted from the cache to be upgraded.
4. The data migration method during the caching framework upgrade process as described in claim 1, characterized in that, The step of determining whether to delete the target business field and its corresponding information in the cache to be upgraded according to the preset second traffic redirection rule includes: If the target business field is the same as any of the preset key fields, then the target business field and its corresponding information in the cache to be upgraded are retained; or, If the target business field is different from each of the preset key fields, then delete the target business field and its corresponding information from the cache to be upgraded.
5. The data migration method during the caching framework upgrade process as described in claim 1, characterized in that, Before retrieving the first information corresponding to the target business field from the cache to be upgraded or the cache that has already been upgraded, the method further includes: updating the first information corresponding to the target business field in the cache to be upgraded or the cache that has already been upgraded.
6. A data migration device for a caching framework upgrade process, characterized in that, The device includes: The receiving module is used to receive the first request for querying the target business field; The determination module is used to determine the target business field to be queried in the cache to be upgraded or the cache that has been upgraded based on a preset first traffic redirection rule; the preset first traffic redirection rule is used to determine the data traffic entering the upgraded cache, and the preset first traffic redirection rule is determined based on the user information corresponding to the first request; The first response module is configured to respond to the first request based on the first information if the first information corresponding to the target business field is retrieved from the cache to be upgraded or the cache that has already been upgraded; or, The second response module is used to query the database to obtain the second information corresponding to the target business field if the target business field is not found in the cache to be upgraded or the cache that has been upgraded, and write the second information into the cache to be upgraded or the cache that has been upgraded, and respond to the first request according to the second information. The device further includes: The second receiving module is configured to receive a second request to update the target business field after responding to the first request; The first update module is used to update the second information corresponding to the target business field in the database; The second determining module is used to determine, based on a preset first traffic redirection rule, whether to delete the target business field and its corresponding information from the cache to be upgraded or from the upgraded cache. The second determining module includes: The fifth determining unit is used to determine whether to delete the target business field and its corresponding information in the cache to be upgraded according to the preset second traffic redirection rule, the second traffic redirection rule being determined based on the preset key field.
7. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, characterized in that, When the computer-readable instructions are executed by the processor, the processor performs the steps of the data migration method in the cache framework upgrade process as described in any one of claims 1 to 5.
8. A storage medium storing computer-readable instructions, characterized in that, When the computer-readable instructions are executed by one or more processors, the one or more processors perform the steps of the data migration method in the cache framework upgrade process as described in any one of claims 1 to 5.