Dynamic data updating method and computer readable storage medium
By setting up a hot library in the server to store dynamic data in the most recent preset time period of all accounts, it solves the problem of slow display of the latest dynamics when users pay more attention to merchants, and achieves faster dynamic update speed and better user experience.
Patent Information
- Application Number
- CN202210692633.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-17
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2042-06-17
AI Technical Summary
In e-commerce platforms, when users pay more attention to merchants, the latest updates are displayed slowly, resulting in poor user experience.
By pre-stored a hot library containing dynamic data in the most recent preset time period of all accounts in the server, after receiving a dynamic update request from the terminal device, the target dynamic data is obtained from the hot library based on the account information that the user is concerned about and sent it to the terminal device.
Obtaining dynamic data through hot databases improves dynamic update speed, especially when users pay more attention to merchants, the latest updates are displayed faster, which significantly improves the user experience.
Smart Images

Figure CN115098206B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a dynamic data updating method and a computer-readable storage medium. Background Art
[0002] On the pages of e-commerce platforms, users usually need to view some dynamics. For example, users can view the latest dynamics of the merchants they follow on the pages of e-commerce platforms. Usually, the latest dynamics are sorted according to the release or update time of each dynamic. However, when the user follows many merchants, the speed of displaying the latest dynamics is slow, and the user experience is not good. Summary of the invention
[0003] The main technical problem solved by this application is that when a user follows many businesses, the speed of displaying the latest updates is slow, resulting in a poor user experience.
[0004] According to the first aspect, an embodiment provides a dynamic data update method, including:
[0005] Receiving a dynamic update request sent by a terminal device, wherein the dynamic update request includes user information;
[0006] Determining, based on the user information, information of an account followed by the user corresponding to the user information;
[0007] According to the information of the account followed by the user and the hot database, the target dynamic data is obtained, wherein the hot database contains the dynamic data of all accounts within the latest preset time period, and the target dynamic data is the latest one or more dynamic data;
[0008] A dynamic update request response is sent to the terminal device, wherein the dynamic update request response includes the target dynamic data.
[0009] Optionally, acquiring target dynamic data according to the information of the account followed by the user and the hot database includes:
[0010] Dividing the accounts followed by the user into multiple groups;
[0011] For each of the multiple groups into which the accounts followed by the user are divided, obtaining first dynamic data corresponding to the accounts in the group from the hot database;
[0012] Sort all first dynamic data according to update time from recent to earliest to obtain a first dynamic queue;
[0013] According to the first dynamic queue, target dynamic data is acquired.
[0014] Optionally, acquiring target dynamic data according to the first dynamic queue includes:
[0015] If the number of first dynamic data in the first dynamic queue is greater than N, acquiring the latest N first dynamic data from the first dynamic data as the target dynamic data;
[0016] If the number of first dynamic data in the first dynamic queue is less than or equal to N and greater than 0, determining the first dynamic data as the target dynamic data;
[0017] If the amount of the first dynamic data in the first dynamic queue is 0, the target dynamic data is obtained from the general library, wherein the general library contains the dynamic data of all accounts.
[0018] Optionally, the acquiring the target dynamic data from the general library includes:
[0019] For each of the multiple groups into which the accounts followed by the user are divided, obtaining second dynamic data corresponding to the accounts in the group from the general database;
[0020] Sort all second dynamic data according to update time from recent to earliest to obtain a second dynamic queue;
[0021] According to the second dynamic queue, target dynamic data is acquired.
[0022] Optionally, acquiring target dynamic data according to the second dynamic queue includes:
[0023] If the number of second dynamic data in the second dynamic queue is greater than N, acquiring the latest N second dynamic data from the first dynamic data as the target dynamic data;
[0024] If the number of first dynamic data in the second dynamic queue is less than or equal to N and greater than 0, determining the first dynamic data as the target dynamic data;
[0025] If the amount of the first dynamic data in the first dynamic queue is 0, it is determined that the target dynamic data is empty.
[0026] Optionally, the dynamic update request is a refresh operation on a target interface received by the terminal device, and the refresh operation may include an initialization operation or a pull-down operation; if the refresh operation is a pull-down operation, the dynamic update request also includes a maximum timestamp, and the maximum timestamp is the most recent time among the times corresponding to the dynamic data currently acquired; acquiring target dynamic data according to the information of the account followed by the user and the hot library includes:
[0027] According to the information of the account followed by the user, the dynamic data after the maximum timestamp is obtained from the hot database as the target dynamic data.
[0028] Optionally, the method further includes:
[0029] Receiving a historical dynamic acquisition request sent by a terminal device, wherein the historical dynamic acquisition request includes user information and a minimum timestamp of target dynamic data;
[0030] If the time of the minimum timestamp is within the most recent preset time period, determining, according to the user information, information of the account followed by the user corresponding to the user information;
[0031] According to the information of the account followed by the user and the hot database, historical dynamic data is obtained, where the historical dynamic data is one or more dynamic data with a publishing or updating time after the minimum timestamp.
[0032] Optionally, the method further includes:
[0033] If the time of the minimum timestamp exceeds the most recent preset time period, for each of the multiple groups into which the accounts followed by the user are divided, obtain from the general database the third dynamic data corresponding to the accounts in the group before the minimum timestamp;
[0034] Sort all third dynamic data according to update time from recent to earliest to obtain a third dynamic queue;
[0035] According to the third dynamic queue, target dynamic data is acquired.
[0036] According to the second aspect, an embodiment provides a dynamic data updating method, comprising:
[0037] Receive dynamic update instructions;
[0038] In response to the dynamic update instruction, target dynamic data corresponding to the current user is obtained, where the target dynamic data is obtained by the server from a hot database according to the accounts followed by the current user, and the hot database contains dynamic data of all accounts within a recent preset time period;
[0039] The target dynamic data is displayed in order of update time from recent to earliest.
[0040] According to the third aspect, an embodiment provides a computer-readable storage medium, on which a program is stored, and the program can be executed by a processor to implement the method as described in any one of the first aspect or the second aspect.
[0041] According to the dynamic data update method and computer-readable storage medium of the above embodiment, in addition to the total library of dynamic data of all accounts, the server also pre-stores a hot library containing dynamic data of all accounts within the most recent preset time period. The terminal device receives the dynamic update instruction on the target interface and sends a dynamic update request to the server. The server determines the information of the account that the user follows corresponding to the user information contained in the received dynamic update request, obtains the target dynamic data corresponding to the account that the user follows in the hot library, and the server sends the target dynamic data to the terminal device. The terminal device can display the target dynamic data in the order of update time from recent to far. When the server obtains the target dynamic data, if it is directly obtained from the total library, the calculation amount is large and the speed of obtaining the target dynamic data is low. Since the hot library stores the dynamic data within the most recent preset time period, the data volume is smaller than the total library, and the dynamic update request is also for obtaining the most recent dynamic data, therefore, the present application obtains through the hot library, and by setting the hot library, the dynamic data can be quickly obtained from the hot library, which improves the dynamic update speed, especially when the user follows many merchants, the speed of displaying the latest dynamics is faster, which improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A structural diagram of a dynamic data updating system provided in an embodiment of the present application;
[0043] Figure 2 An interactive schematic diagram of a dynamic data updating method provided in an embodiment of the present application;
[0044] Figure 3 An interactive schematic diagram of another dynamic data updating method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] The present application is further described in detail below by specific embodiments in conjunction with the accompanying drawings. Wherein similar elements in different embodiments adopt associated similar element numbers. In the following embodiments, many detailed descriptions are intended to enable the present application to be better understood. However, those skilled in the art can easily recognize that some of the features can be omitted in different situations, or can be replaced by other elements, materials, and methods. In some cases, some operations related to the present application are not shown or described in the specification, in order to avoid the core part of the present application being overwhelmed by too much description, and for those skilled in the art, it is not necessary to describe these related operations in detail, and they can fully understand the related operations based on the description in the specification and the general technical knowledge in the art.
[0046] In addition, the features, operations or characteristics described in the specification can be combined in any appropriate manner to form various implementations. At the same time, the steps or actions in the method description can also be interchanged or adjusted in a manner that is obvious to those skilled in the art. Therefore, the various sequences in the specification and the drawings are only for the purpose of clearly describing a certain embodiment and are not meant to be a required sequence, unless otherwise specified that a certain sequence must be followed.
[0047] The serial numbers of the components in this document, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning. The "connection" and "coupling" mentioned in this application, unless otherwise specified, include direct and indirect connections (couplings).
[0048] A dynamic data update method provided by the present application is applied to a dynamic data update system, and the dynamic data update system includes a server and a terminal device. The server may be one server or a server group consisting of multiple servers. The terminal device may be one or more, and the terminal device may be a personal computer, a mobile phone, a tablet device, etc., which is not limited by the present application.
[0049] Combine the following Figure 1 Introduce the dynamic data update system provided by this application.
[0050] See also Figure 1 , Figure 1 A structural diagram of a dynamic data updating system provided in an embodiment of the present application is shown in FIG. Figure 1 The example in FIG. 1 shows a server 11 and three terminal devices (terminal device 12, terminal device 13 and terminal device 14), and the server 11 is connected to the terminal device 12, terminal device 13 and terminal device 14 through a network. It can be understood that Figure 1This is just an example and does not constitute a limitation to the present application. The following is an example in which the terminal device is the terminal device 12. The terminal device 12 can access the interface of the e-commerce platform through the application or webpage installed by itself, and the user of the terminal device 12 can log in to his own account to view the dynamic data of the account he is following. In addition to the general library of dynamic data of all accounts, the server 11 also pre-stores a hot library containing dynamic data of all accounts within the latest preset time period. The terminal device 12 receives the dynamic update instruction on the target interface and sends a dynamic update request to the server 11. The server 11 obtains the target dynamic data in the hot library according to the user information contained in the received dynamic update request and the information of the account that the user is following corresponding to the user information. The server 11 sends the target dynamic data to the terminal device 12, and the terminal device 12 can display the target dynamic data. When the server 11 obtains the target dynamic data, if it is directly obtained from the general library, the calculation amount is large and the speed of obtaining the target dynamic data is low. Since the hot database stores dynamic data within the most recent preset time period and the data volume is smaller than the total database, and the dynamic update request is also to obtain the most recent dynamic data, this application obtains through the hot database. By setting up the hot database, dynamic data can be quickly obtained from the hot database, which improves the dynamic update speed. Especially when the user follows a large number of merchants, the latest dynamics can be displayed faster, thereby improving the user experience.
[0051] The technical solution provided in this application is described in detail below with specific embodiments.
[0052] Please refer to Figure 2 , Figure 2 The following is an interactive diagram of a dynamic data updating method provided in an embodiment of the present application. The method provided in this embodiment includes the following steps:
[0053] Step 21: The terminal device receives the dynamic update instruction.
[0054] The dynamic update instruction is used to instruct to obtain target dynamic data, which is the latest one or more dynamic data. Dynamic data refers to dynamic information released by an account in an e-commerce platform. For example, a merchant releases information about a product through the merchant's account. The information about the product may include text and / or pictures and / or videos. Users who follow the merchant's account can view the dynamic information when logging into the target interface.
[0055] Optionally, the dynamic update instruction may be a refresh operation received on the target interface, and the refresh operation is used to obtain the latest dynamic data of the account followed by the user. Among them, the refresh operation can be an operation in various forms. For example, the refresh operation can be an initialization operation or a pull-down operation. The initialization operation is an operation when the user opens an application on the terminal device or logs into the web page of the e-commerce platform through a click operation. The pull-down operation is an operation in which the user pulls down the finger in the target interface on the terminal device. It can be understood that the present application does not limit the specific form of the refresh operation.
[0056] Step 22: The terminal device sends a dynamic update request to the server in response to the dynamic update instruction.
[0057] The dynamic update request is used to request to obtain target dynamic data and contains user information.
[0058] The user information may be information of a user currently logged in on the terminal device, for example, an identity document (ID) of the user.
[0059] Step 23: The server determines, based on the user information, information of the account that the user is following that corresponds to the user information.
[0060] Step 24: The server obtains target dynamic data based on the information of the account followed by the user and the hot database.
[0061] The heat library contains dynamic data of all accounts in the latest preset time period. The latest preset time period can be the time period closest to the present time, for example, the latest month or the latest 15 days.
[0062] Optionally, the dynamic data in the hot database can be obtained from the main database, and the dynamic data in the hot database can be updated in real time or at a preset period. For example, the dynamic data published or updated by all accounts can be stored in the hot database in real time, and the dynamic data in the hot database that exceeds the most recent preset time period can be deleted at a preset period.
[0063] Optionally, the target dynamic data may include a timestamp, and the timestamp of the dynamic data is the time when the dynamic data is published or updated.
[0064] Optionally, the target dynamic data may be one or more pieces, and the target dynamic data to be acquired may generally be set to 32 pieces. For example, 32 pieces of target dynamic data are generally expected to be acquired, and 32 pieces of dynamic data may generally meet the needs of users to view the latest dynamic data, and may also reduce the computing pressure of the server to acquire data, thereby ensuring the speed of acquiring dynamic data.
[0065] Step 25: The server sends a dynamic update request response to the terminal device.
[0066] The dynamic update request response includes target dynamic data.
[0067] Step 26: The terminal device displays the target dynamic data in the order of update time from recent to far.
[0068] The terminal device can update and display the target dynamic data on the target interface.
[0069] In this embodiment, when the terminal device accesses the interface of the e-commerce platform, the user of the terminal device can log in to his own account to view the dynamic data of the account he is following. In addition to the general library of dynamic data of all accounts, the server also pre-stores a hot library containing dynamic data of all accounts within the latest preset time period. The terminal device receives a dynamic update instruction on the target interface and sends a dynamic update request to the server. The server obtains the target dynamic data in the hot library according to the information of the user contained in the received dynamic update request and the information of the account followed by the user corresponding to the user information. The server sends the target dynamic data to the terminal device, and the terminal device can display the target dynamic data in the order of update time from recent to far. When the server obtains the target dynamic data, if it is directly obtained from the general library, the calculation amount is large and the speed of obtaining the target dynamic data is low. Since the dynamic data within the latest preset time period is stored in the hot library, the data volume is smaller than that of the general library, and the dynamic update request is also for obtaining the latest dynamic data, therefore, the present application obtains through the hot library, and by setting the hot library, the dynamic data can be quickly obtained from the hot library, which improves the dynamic update speed, especially when there are many merchants followed by the user, the speed of displaying the latest dynamics is faster, which improves the user experience.
[0070] Based on any of the above embodiments, when acquiring target dynamic data in step 24, the first dynamic data may be acquired in groups, and then a dynamic queue may be formed, and the target dynamic data may be acquired according to the dynamic queue, so that the acquired target dynamic data is described in detail below with a specific embodiment.
[0071] In some embodiments, the above step 24 can be implemented by the following steps:
[0072] Step 241: The server divides the accounts followed by the user into multiple groups.
[0073] Exemplarily, the server may group the accounts equally. For example, if there are 5,000 accounts in total, every 50 accounts may be grouped into one group.
[0074] Step 242: For each of the multiple groups into which the accounts followed by the user are divided, the server obtains the first dynamic data corresponding to the accounts in the group from the hot database.
[0075] The quantity of the first dynamic data may be the same as the quantity of the target dynamic data.
[0076] For example, if the target dynamic data is expected to be 32, the first dynamic data can be set to be expected to be 32, that is, at most 32 first dynamic data corresponding to the accounts in the group are obtained from the hot database. In some scenarios, there are many dynamic data corresponding to the accounts in the group, and the latest 32 dynamic data are obtained as the first dynamic data. In other scenarios, there are fewer dynamic data corresponding to the accounts in the group, which may be less than 32 dynamic data, and all the obtained dynamic data are used as the first dynamic data.
[0077] Step 243: The server sorts all the first dynamic data according to the update time from recent to earliest to obtain a first dynamic queue.
[0078] Step 244: The server obtains target dynamic data according to the first dynamic queue.
[0079] In this embodiment, when acquiring target dynamic data, the accounts followed by the user are first grouped, so that the first dynamic data is obtained in batches according to the groups. The group processing is faster and more efficient, so that the efficiency of acquiring the target dynamic data is higher.
[0080] In some embodiments, the refresh operation received by the terminal device may be an initialization operation or a pull-down operation.
[0081] In a possible implementation, if the refresh operation is a pull-down operation, it means that the user has stayed on the target interface for a period of time and just wants to check whether there is any newly updated dynamic data. In this case, the target dynamic data can be obtained only from the hot database without considering the total database. The dynamic update request also includes a maximum timestamp, which is the most recent time corresponding to the dynamic data currently obtained. The following describes a process of a pull-down operation.
[0082] Further, step 24 includes:
[0083] Step 24a: The server obtains the dynamic data after the maximum timestamp from the hot database as the target dynamic data based on the information of the account followed by the user.
[0084] Among them, step 24a can also be processed using the method of steps 241 to 244 above. When processing using the method of steps 241 to 244 above, in step 242, it is necessary to obtain the first dynamic data after the maximum timestamp.
[0085] In another possible implementation, if the refresh operation is an initialization operation, the server needs to obtain the target dynamic data based on the first dynamic queue. If the target dynamic data cannot be obtained in the first dynamic queue, that is, the target dynamic data cannot be obtained in the hot library, the target dynamic data can be obtained from the general library.
[0086] The following is a method for obtaining target dynamic data from the general library.
[0087] Furthermore, the target dynamic data may be determined according to the amount of dynamic data in the queue in step 244. The following is a detailed description with reference to a specific embodiment.
[0088] In some embodiments, the above step 244 may be implemented by the following steps:
[0089] Step 2441: The server determines whether the amount of first dynamic data in the first dynamic queue is greater than N.
[0090] Wherein, N is an integer greater than 0. N is the number of target dynamic data expected to be acquired. For example, if 32 target dynamic data are expected to be acquired, then N is 32, and the number of first dynamic data in the first dynamic queue is compared with N.
[0091] If yes, continue to step 2442. If no, continue to step 2443.
[0092] Step 2442: The server obtains the latest N pieces of first dynamic data from the first dynamic data as target dynamic data.
[0093] Step 2443: The server determines whether the amount of first dynamic data in the first dynamic queue is equal to 0.
[0094] If so, it means that there is no updated dynamic data in the hot library, and you can go to the main library to obtain dynamic data, and continue to execute step 2444; if not, directly use the data in the first dynamic queue obtained from the hot library as the target dynamic data, and continue to execute step 2445.
[0095] Step 2444: The server obtains the target dynamic data from the general database, where the general database contains the dynamic data of all accounts.
[0096] Furthermore, a method of obtaining data from the general database is introduced below. Step 2444 can be implemented through the following steps 24441-24443:
[0097] Step 24441: For each of the multiple groups into which the accounts followed by the user are divided, the server obtains the second dynamic data corresponding to the accounts in the group from the general library.
[0098] The amount of the second dynamic data may be the same as the amount of the target dynamic data.
[0099] For example, if the target dynamic data is expected to be 32, the second dynamic data can be set to be expected to be 32, that is, at most 32 second dynamic data corresponding to the accounts in the group are obtained from the general library. In some scenarios, there are many dynamic data corresponding to the accounts in the group, and the latest 32 dynamic data are obtained from the general library as the second dynamic data. In other scenarios, there are fewer dynamic data corresponding to the accounts in the group, which may be less than 32 dynamic data, and all dynamic data obtained from the general library are used as the second dynamic data.
[0100] It can be understood that the implementation principles of step 24441 are similar to those of step 242.
[0101] Step 24442: The server sorts all the second dynamic data according to the update time from recent to earliest to obtain a second dynamic queue.
[0102] It can be understood that the implementation principles of step 24442 are similar to those of step 243.
[0103] Step 24443: The server obtains target dynamic data according to the second dynamic queue.
[0104] Step 2445: The server determines the first dynamic data as the target dynamic data.
[0105] In this embodiment, when the target dynamic data cannot be obtained in the hot store, the dynamic data is obtained in batches in the general store, so that the target dynamic data is obtained comprehensively. The batch acquisition also improves the acquisition efficiency and the speed of dynamic data acquisition.
[0106] On the basis of the above embodiment, further, step 24443 can be implemented by the following steps:
[0107] Step 244431: The server determines whether the amount of second dynamic data in the second dynamic queue is greater than N.
[0108] Wherein, N is an integer greater than 0. N is the number of target dynamic data expected to be acquired. For example, if 32 target dynamic data are expected to be acquired, then N is 32, and the number of first dynamic data in the first dynamic queue is compared with N.
[0109] If yes, continue to step 244432. If no, continue to step 244433.
[0110] Step 244432: The server obtains the latest N pieces of second dynamic data from the second dynamic data as target dynamic data.
[0111] Step 244433: The server determines whether the amount of second dynamic data in the second dynamic queue is equal to 0.
[0112] If so, it means that there is no updated dynamic data in the general library, then continue to execute step 244434; if not, the data in the second dynamic queue obtained from the hot library is directly used as the target dynamic data, then continue to execute step 244435.
[0113] Step 244434: The server determines that the target dynamic data is empty.
[0114] Step 244435: The server determines the first dynamic data as the target dynamic data.
[0115] In some scenarios, the user usually pulls up on the target interface to view the acquired target dynamic data. After viewing the target dynamic data, the user can continue to pull up on the target interface to obtain dynamic data after the target dynamic data. The following is a detailed description of a specific embodiment.
[0116] See also Figure 3 , Figure 3 The interactive schematic diagram of another dynamic data updating method provided in the embodiment of the present application can be understood as follows: Figure 3 The embodiment shown can be performed independently, or can be performed after step 26 based on the above embodiment. The method provided in this embodiment includes the following steps:
[0117] Step 31: The terminal device receives a historical dynamic update instruction.
[0118] The historical dynamic update instruction is used to instruct to obtain historical dynamic data, where the historical dynamic data is the latest one or more dynamic data after the dynamic data currently obtained.
[0119] Optionally, the history dynamic update instruction may be a pull-up operation received on the target interface. The pull-up operation is an operation in which the user pulls the finger upwards on the target interface of the terminal device.
[0120] Step 32: The terminal device sends a historical dynamic update request to the server in response to the historical dynamic update instruction.
[0121] The historical dynamic update request is used to request the acquisition of historical dynamic data, and includes the user's information and the minimum timestamp of the target dynamic data.
[0122] The user information may be information of a user currently logged in on the terminal device, for example, an identity document (ID) of the user.
[0123] Step 33: The server determines whether the time of the minimum timestamp is within the most recent preset time period.
[0124] If yes, continue to step 34.
[0125] Optionally, if not, continue to step 36.
[0126] Step 34: The server determines, based on the user information, information of the account that the user is following that corresponds to the user information.
[0127] Step 35: The server obtains historical dynamic data based on the information of the accounts followed by the user and the hot database.
[0128] The historical dynamic data refers to one or more pieces of dynamic data whose publishing or updating time is after the minimum timestamp.
[0129] It can be understood that the implementation method and principle of step 34-step 35 are similar to those of step 23-step 24, and will not be repeated here.
[0130] Step 36: For each of the multiple groups into which the accounts followed by the user are divided, the server obtains from the general database the third dynamic data corresponding to the accounts in the group before the minimum timestamp.
[0131] Step 37: The server sorts all the third dynamic data from the latest to the oldest update time to obtain a third dynamic queue. The server obtains the target dynamic data according to the third dynamic queue.
[0132] It can be understood that the implementation method and principle of steps 36 and 37 are similar to those of step 244, and will not be repeated here.
[0133] Step 38: The server sends a history dynamic update request response to the terminal device.
[0134] The historical dynamic update request response includes historical dynamic data.
[0135] Step 39: The terminal device displays the historical dynamic data in the order of update time from recent to oldest.
[0136] The terminal device can display historical dynamic data on the target interface.
[0137] In this embodiment, the terminal device receives the historical dynamic update instruction on the target interface and sends a historical dynamic update request to the server. The server compares the minimum timestamp contained in the received historical dynamic update request with the latest preset time period set by the hot database. When the minimum timestamp is within the latest preset time period, the server obtains the historical dynamic data in the hot database according to the information of the account that the user follows corresponding to the user information. If the minimum timestamp is not within the latest preset time period, the server obtains the historical dynamic data from the total database. The server sends the historical dynamic data to the terminal device, and the terminal device can display the historical dynamic data in the order of update time from recent to far. Since the hot database stores the dynamic data within the latest preset time period, the data volume is smaller than the total database. It can be determined whether the currently updated dynamic data has exceeded the range of the dynamic data stored in the hot database according to the minimum timestamp. When it does not exceed the range of the dynamic data stored in the hot database, the historical dynamic data is obtained through the hot database. By setting the hot database, the historical dynamic data can be quickly obtained from the hot database, which improves the speed of historical dynamic update. Especially when there are many merchants that the user follows, the speed of displaying the historical dynamic data is faster, which ensures the continuity of the data and improves the user experience.
[0138] The dynamic data updating method of the present application is described in detail below with reference to a specific example.
[0139] Assume that the user currently logged in by the terminal device follows 5,000 merchants. The server stores the dynamic data of the merchants in 100 sub-tables of the total library according to the last two digits of the merchant ID. The server also stores a hot library of the dynamic data of all merchants in the last month. The terminal device in this application can also be called the front end, and the server can also be called the back end.
[0140] Scenario 1: A user uses a terminal device to access a dynamic page for the first time through an application.
[0141] Step 41. When entering the dynamic page for the first time, the front end requests and notifies the back end to initialize and obtain the latest 32 dynamic data.
[0142] Step 42. The backend groups the 5,000 merchants followed by the user into batches of 50, and then obtains the latest 32 dynamic data in the group from the hot database in batches.
[0143] Step 43. After the acquisition is completed, all the dynamic data acquired by all groups are put into a queue, which can be represented by resultList, and the dynamic data in the queue are sorted.
[0144] Step 431: If the number of dynamic data in resultList is greater than 32, directly return the latest 32 dynamic data.
[0145] Step 432: If the number of dynamic data in resultList>0, and the number of dynamic data in resultList<32, directly return all dynamic data in the current resultList.
[0146] Furthermore, it can be marked that the hot storage has no data and returned to the front end.
[0147] Step 433: If the amount of dynamic data in resultList = 0, it is necessary to obtain dynamic data from 100 sub-tables.
[0148] Step 4331. First, divide the 5,000 merchants into 100 queues (albumList0-99) according to the table division rules.
[0149] Step 4332. Then take a queue, which can be represented by albumListX. If the number of merchants in the queue is greater than 50, the queue needs to be further split. For example, it can be split into multiple queues, which can be represented by albumListX-1, albumListX-2...albumListX-n.
[0150] Step 4333. Then obtain the latest 32 data from the sub-table in batches.
[0151] Step 4334. After looping 100 queues, all data are summarized into the result, which can be represented by resultListNew. Sort and take the latest 32 data. If there are less than 32 data, get all data.
[0152] Step 44. Send the timestamp of each product to the front end.
[0153] Scenario 2: Pull up to get the next batch of data.
[0154] Step 51. Pull up to obtain the most recent historical data. The front end requests the back end, tells the back end that it is currently pulling up, and passes in the minimum timestamp minTime of the local product.
[0155] Step 52. After obtaining the timestamp minTime and the pull-up status, determine whether minTime exceeds one month. If it exceeds one month, directly query the data in 100 sub-tables and continue to step 543. If it does not exceed one month, continue to step 53.
[0156] Step 53. Similarly, divide all merchants into batches of 50, and then obtain the latest 32 data that is less than minTime from the hot database in batches.
[0157] Step 54. After the acquisition is completed, all the data are put into a queue and sorted.
[0158] Step 541.resultList>32 items, return 32 items directly.
[0159] Step 542. resultList>0and list<32, directly return to the current list, mark that there is no data in the hot database, and return it to the front end.
[0160] Step 543.resultList=0, data needs to be obtained from 100 sub-tables.
[0161] Step 5431. First, divide the 5,000 merchants into 100 queues (albumList0-99) according to the table division rules.
[0162] Step 5432. Then take a queue albumListX. If the number of merchants in the queue is greater than 50, it is necessary to continue splitting albumListX-1, albumListX-2...albumListX-n.
[0163] Step 5433. Then obtain the latest 32 data from the sub-table in batches.
[0164] Step 5434. After looping 100 queues, aggregate all data into resultListNew, sort and take the latest 32 data items, if there are less than 32 items, get all data items.
[0165] Step 55. Take the 32 data with the largest time and send the timestamp of each product to the front end.
[0166] Scenario 3: Pull down to get updated data.
[0167] Step 61. Pull down to get updated data. The front end requests the back end, tells the back end that it is currently pulling down, and passes in the minimum timestamp of the local product. The maximum timestamp can be represented by minTime.
[0168] Step 62. After getting the timestamp minTime and the drop-down status, all merchants are divided into batches of 50, and then the latest 32 data that are less than minTime are obtained from the hot database in batches.
[0169] Step 63. After the acquisition is completed, all the data are put into a queue and sorted.
[0170] Step 631. resultList>32 items, return 32 items directly.
[0171] Step 632. resultList>0and list<32, directly return to the current list, mark that there is no data in the hot database, and return it to the front end.
[0172] Step 633. resultList=0 returns directly.
[0173] Step 64. Take the 32 pieces of data with the smallest time and send the timestamp of each product to the front end.
[0174] An embodiment of the present application provides a computer-readable storage medium, on which a program is stored. The program can be executed by a processor to implement a dynamic data update method as described in any of the above embodiments.
[0175] Those skilled in the art will appreciate that all or part of the functions of the various methods in the above-mentioned embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, and the storage medium can include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to implement the above-mentioned functions. For example, the program is stored in the memory of the device, and when the program in the memory is executed by the processor, all or part of the above-mentioned functions can be implemented. In addition, when all or part of the functions in the above-mentioned embodiments are implemented by computer programs, the program can also be stored in a storage medium such as a server, another computer, disk, optical disk, flash disk or mobile hard disk, and can be downloaded or copied and saved in the memory of the local device, or the system of the local device is updated, and when the program in the memory is executed by the processor, all or part of the functions in the above-mentioned embodiments can be implemented.
[0176] The above specific examples are used to illustrate the present application, which is only used to help understand the present application and is not intended to limit the present application. For technicians in the technical field to which the present application belongs, they can also make some simple deductions, deformations or substitutions based on the ideas of the present application.
Claims
1. A dynamic data updating method, characterized in that: include: Receiving a dynamic update request sent by a terminal device, wherein the dynamic update request includes user information; Determining, based on the user information, information of an account followed by the user corresponding to the user information; According to the information of the account followed by the user and the hot database, the target dynamic data is obtained, wherein the hot database contains the dynamic data of all accounts within the latest preset time period, and the target dynamic data is the latest one or more dynamic data; Sending a dynamic update request response to the terminal device, wherein the dynamic update request response includes the target dynamic data; Receiving a historical dynamic acquisition request sent by a terminal device, wherein the historical dynamic acquisition request includes user information and a minimum timestamp of target dynamic data; If the time of the minimum timestamp is within the most recent preset time period, determining, based on the user information, information of the account followed by the user corresponding to the user information; According to the information of the account followed by the user and the hot database, historical dynamic data is obtained, where the historical dynamic data is one or more dynamic data whose publishing or updating time is after the minimum timestamp; A historical dynamic update request response is sent to the terminal device, wherein the historical dynamic update request response includes the historical dynamic data.
2. The method according to claim 1, characterized in that The step of acquiring target dynamic data according to the information of the account followed by the user and the hot database includes: Dividing the accounts followed by the user into multiple groups; For each of the multiple groups into which the accounts followed by the user are divided, obtaining first dynamic data corresponding to the accounts in the group from the hot database; Sort all first dynamic data according to update time from recent to earliest to obtain a first dynamic queue; According to the first dynamic queue, target dynamic data is acquired.
3. The method according to claim 2, characterized in that The acquiring target dynamic data according to the first dynamic queue includes: If the number of first dynamic data in the first dynamic queue is greater than N, acquiring the latest N first dynamic data from the first dynamic data as the target dynamic data; If the number of first dynamic data in the first dynamic queue is less than or equal to N and greater than 0, determining the first dynamic data as the target dynamic data; If the amount of the first dynamic data in the first dynamic queue is 0, the target dynamic data is obtained from the general library, wherein the general library contains the dynamic data of all accounts.
4. The method according to claim 3, characterized in that The step of obtaining the target dynamic data from the master database includes: For each of the multiple groups into which the accounts followed by the user are divided, obtaining second dynamic data corresponding to the accounts in the group from the general database; Sort all second dynamic data according to update time from recent to earliest to obtain a second dynamic queue; According to the second dynamic queue, target dynamic data is acquired.
5. The method according to claim 4, characterized in that The acquiring target dynamic data according to the second dynamic queue includes: If the number of second dynamic data in the second dynamic queue is greater than N, acquiring the latest N second dynamic data from the first dynamic data as the target dynamic data; If the number of first dynamic data in the second dynamic queue is less than or equal to N and greater than 0, determining the first dynamic data as the target dynamic data; If the amount of the first dynamic data in the first dynamic queue is 0, it is determined that the target dynamic data is empty.
6. The method according to claim 1, characterized in that The dynamic update request is a refresh operation on the target interface received by the terminal device, and the refresh operation includes an initialization operation or a pull-down operation; if the refresh operation is a pull-down operation, the dynamic update request also includes a maximum timestamp, and the maximum timestamp is the most recent time among the times corresponding to the dynamic data currently acquired; The step of acquiring target dynamic data according to the information of the account followed by the user and the hot database includes: According to the information of the account followed by the user, the dynamic data after the maximum timestamp is obtained from the hot database as the target dynamic data.
7. The method according to claim 1, characterized in that The method further comprises: If the time of the minimum timestamp exceeds the most recent preset time period, for each of the multiple groups into which the accounts followed by the user are divided, obtain from the general database the third dynamic data corresponding to the accounts in the group before the minimum timestamp; Sort all third dynamic data according to update time from recent to earliest to obtain a third dynamic queue; According to the third dynamic queue, target dynamic data is acquired.
8. A dynamic data updating method, characterized in that: include: Receive dynamic update instructions; In response to the dynamic update instruction, target dynamic data corresponding to the current user is obtained, where the target dynamic data is obtained by the server from a hot database according to the accounts followed by the current user, and the hot database contains dynamic data of all accounts within a recent preset time period; Displaying the target dynamic data in the order of update time from recent to earliest; Receive historical dynamic update instructions; In response to the historical dynamic update instruction, the historical dynamic data corresponding to the current user is obtained, where the historical dynamic data is obtained by the server from a hot database according to the account followed by the current user; The historical dynamic data is displayed in order of update time from recent to oldest.
9. A computer-readable storage medium, characterized in that: The medium stores a program, which can be executed by a processor to implement the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Data reading method and device, equipment and storage medium
CN113821537A