A snapshot generation method and device
By receiving snapshot generation requests and determining the storage method based on the multiplexing rate, the problem of waste of transaction snapshot storage resources is solved, and the effect of saving storage resources and improving storage efficiency is achieved.
Patent Information
- Application Number
- CN202111060359.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-10
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-09-10
AI Technical Summary
The existing transaction snapshot storage method requires huge storage resources, resulting in a large number of repeated storage of transaction snapshot data and wasted storage resources.
By receiving a snapshot generation request, the target snapshot data corresponding to the task identification and item identification are determined, and the storage method of the transaction field is determined based on the multiplexing rate, and compressed storage is used to save storage resources.
It realizes saving snapshot storage resources, reducing storage space consumption, preventing waste of storage resources, and improving storage efficiency.
Smart Images

Figure CN113722273B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a snapshot generation method and device. Background Art
[0002] Online shopping refers to a service in which consumers select the goods they need, place an order and pay for them through various electronic commodity platforms on the Internet, and the merchants deliver the purchased goods to the consumers' door by mail.
[0003] In the existing data processing process, for user consumption data, it is necessary to store a transaction snapshot of each product included in each order at the time the user places the order, so as to provide a reference for possible transaction disputes in the future.
[0004] With the rise of online shopping, a huge amount of order data may be received every day, which requires huge storage resources for transaction snapshots. However, transaction snapshot information usually does not change within a small sales cycle, resulting in a large amount of duplicate storage of transaction snapshot data. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a snapshot generation method and device, which can save snapshot storage resources, reduce storage space consumption, and prevent waste of storage resources.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a snapshot generation method is provided, comprising:
[0007] Receiving a snapshot generation request; the snapshot generation request indicates an item identifier and a task identifier for which a snapshot is to be generated;
[0008] Determining target snapshot data corresponding to the task identifier and the item identifier from the pre-stored snapshot data corresponding to the plurality of historical tasks; the snapshot data is pre-extracted from the transaction data of the plurality of historical tasks and stored in correspondence with the historical tasks;
[0009] A target snapshot corresponding to the item identifier is generated according to the target snapshot data and a preconfigured snapshot generation template.
[0010] Optionally, it also includes:
[0011] Extracting the snapshot data corresponding to one or more item identifiers from the transaction data in the historical tasks; wherein each of the snapshot data includes one or more transaction fields;
[0012] Determining a storage method corresponding to the transaction field in the snapshot data according to a reuse rate of the transaction field;
[0013] According to the storage method, the item identifier is stored correspondingly to the transaction field and the value of the transaction field.
[0014] Optionally, determining the storage mode corresponding to the transaction field in the snapshot data according to the reuse rate of the transaction field includes:
[0015] When the reuse rate of the transaction field is not less than the reuse rate threshold, it is determined that the storage mode of the transaction field is compressed storage.
[0016] Optionally, it also includes:
[0017] The reuse rate of the transaction field is determined according to the data storage space required for storing the transaction field and the data update period of the transaction field.
[0018] Optionally, the snapshot generation template is a page template, and generating the target snapshot corresponding to the item identifier according to the target snapshot data and a preconfigured snapshot generation template includes:
[0019] The page template is rendered using the target snapshot data to obtain a page including the target snapshot.
[0020] Optionally, it also includes:
[0021] Acquire historical transaction fields corresponding to the task identifier and the item identifier in multiple historical tasks;
[0022] The snapshot generation template is determined according to the historical transaction field.
[0023] Optionally, the transaction fields include any one or more of the following: item specification information, item picture information, item price information, item discount information, item fulfillment information, item service information, item delivery information, and item provider information.
[0024] According to another aspect of an embodiment of the present invention, there is provided a snapshot generation device, comprising:
[0025] A receiving module, configured to receive a snapshot generation request; the snapshot generation request indicates an item identifier and a task identifier for which a snapshot is to be generated;
[0026] A data processing module, used to determine target snapshot data corresponding to the task identifier and the item identifier from the pre-stored snapshot data corresponding to the plurality of historical tasks; the snapshot data is pre-extracted from the transaction data of the plurality of historical tasks and stored in correspondence with the historical tasks;
[0027] A generation module is used to generate a target snapshot corresponding to the item identifier according to the target snapshot data and a preconfigured snapshot generation template.
[0028] According to another aspect of an embodiment of the present invention, there is provided a snapshot generation electronic device, comprising:
[0029] one or more processors;
[0030] a storage device for storing one or more programs,
[0031] When the one or more programs are executed by the one or more processors, the one or more processors implement the snapshot generation method provided by the present invention.
[0032] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the snapshot generation method provided by the present invention is implemented.
[0033] An embodiment of the above invention has the following advantages or beneficial effects: because the snapshot data with a reuse rate of transaction fields not less than the reuse rate threshold is compressed and stored, when the snapshot needs to be queried, a technical means of generating a snapshot is used by using a snapshot generation template and snapshot data, thereby overcoming the technical problem that the existing transaction snapshot storage method consumes huge storage resources and causes a large amount of repeated storage of transaction snapshot data, thereby achieving the technical effect of saving snapshot storage resources, reducing the consumption of storage space, and preventing the waste of storage resources.
[0034] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0036] Figure 1 An exemplary system architecture diagram suitable for applying a snapshot generation method or a snapshot generation device in an embodiment of the present invention is shown;
[0037] Figure 2 is a schematic diagram of the main process of the snapshot generation method according to an embodiment of the present invention;
[0038] Figure 3 is a schematic diagram of the main process of the snapshot data storage method according to an embodiment of the present invention;
[0039] Figure 4 is a schematic diagram of the main process of a method for querying target snapshot data according to an embodiment of the present invention;
[0040] Figure 5 is a schematic diagram of the main process of a method for querying target snapshot data according to an embodiment of the present invention;
[0041] Figure 6 is a schematic diagram of main modules of a snapshot generating device according to an embodiment of the present invention;
[0042] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0044] HBASE: A distributed, column-oriented open source database suitable for storing unstructured data, including office documents, text, pictures, XML, HTML, reports, images, and audio / video information.
[0045] rowkey: A unique identifier for a piece of data in a table in an Hbase database.
[0046] Freemarker: Template engine, a general tool for generating text output based on templates, written in pure Java. FreeMarker is designed to generate HTML Web pages, especially applications based on the MVC pattern.
[0047] md5: MD5 Message-Digest Algorithm, a cryptographic hash function that can generate a 128-bit (16-byte) hash value to ensure the integrity and consistency of information transmission.
[0048] Figure 1 An exemplary system architecture diagram suitable for applying a snapshot generation method or a snapshot generation device in an embodiment of the present invention is shown. Figure 1 As shown, an exemplary system architecture of a snapshot generation method or a snapshot generation device according to an embodiment of the present invention includes:
[0049] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0050] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0051] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0052] The server 105 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using the terminal devices 101, 102, and 103. The backend management server may analyze and process the received data such as the snapshot generation request, and feed back the processing results (such as the item snapshot) to the terminal devices 101, 102, and 103.
[0053] It should be noted that the snapshot generation method provided in the embodiment of the present invention is generally executed by the server 105 , and accordingly, the snapshot generation device is generally disposed in the server 105 .
[0054] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0055] Figure 2 FIG. 1 is a schematic diagram of the main process of the snapshot generation method according to an embodiment of the present invention. Figure 2 As shown, the snapshot generation method of the present invention includes:
[0056] Step S201, receiving a snapshot generation request; the snapshot generation request indicates an item identifier and a task identifier for which a snapshot is to be generated.
[0057] The snapshot is a display photo or display page of the product details page corresponding to the moment when the user places an order; wherein, the order placed by the user may include one or more items, and each item corresponds to a details page.
[0058] In the embodiment of the present invention, before receiving the snapshot generation request, the snapshot data is pre-stored, and the snapshot data may include text, pictures, and the like.
[0059] In the embodiment of the present invention, the task identifier may be orderId, the item identifier may be skuID of one or more items in the order, and the snapshot to be generated is a snapshot corresponding to orderId and skuID.
[0060] Step S202, determining target snapshot data corresponding to the task identifier and the item identifier from the pre-stored snapshot data corresponding to the plurality of historical tasks; the snapshot data is pre-extracted from the transaction data of the plurality of historical tasks and stored corresponding to the historical tasks.
[0061] In the embodiment of the present invention, the historical tasks may be multiple user orders, and the target snapshot data includes snapshot data of the details page corresponding to the task identifier and the item identifier.
[0062] In the embodiment of the present invention, Figure 3 As shown, the snapshot data storage method of the present invention comprises the following steps:
[0063] Step S301: extract snapshot data corresponding to one or more item identifiers from the transaction data in each historical task.
[0064] In an embodiment of the present invention, each snapshot data includes one or more transaction fields, and the transaction fields include any one or more of the following: item specification information, item image information, item price information, item discount information, item fulfillment information, item service information, item delivery information, and item provider information.
[0065] Step S302: determining the reuse rate of the transaction field according to the data storage space required for storing the transaction field and the data update cycle of the transaction field.
[0066] In the embodiment of the present invention, the multiplexing rate of the transaction field is f, the data storage space required to store the transaction field is s, and the data update period of the transaction field is z.
[0067] In the embodiment of the present invention, the relationship between f, s, and z can be: f = s*z. For example, the data storage space f required to store item discount information is 10KB, and the data update cycle of the item discount information is 2 days, then the reuse rate of the item discount information is f = s*z = 10*2 = 20; for another example, the data storage space f required to store item fulfillment information is 0.1KB, and the data update cycle of the item fulfillment information is 0.3 days, then the reuse rate of the item fulfillment information is f = s*z = 0.1*0.3 = 0.03.
[0068] In the embodiment of the present invention, the transaction fields that are updated simultaneously may be combined to calculate the reuse rate.
[0069] Step S303: determining the storage mode corresponding to the transaction field in the snapshot data according to the reuse rate of the transaction field.
[0070] In an embodiment of the present invention, when the reuse rate of the transaction field is not less than the reuse rate threshold, the storage mode of the transaction field is determined to be compressed storage; when the reuse rate of the transaction field is less than the reuse rate threshold, the storage mode of the transaction field is determined to be any storage mode, such as compressed storage or non-compressed storage.
[0071] In the embodiment of the present invention, the multiplexing rate is not less than the multiplexing rate threshold, corresponding to a high multiplexing rate; the multiplexing rate is less than the multiplexing rate threshold, corresponding to a low multiplexing rate.
[0072] In the embodiment of the present invention, the snapshot data includes a task identifier, an item identifier, a transaction field, and a value of the transaction field.
[0073] In the embodiment of the present invention, the snapshot data is stored in the HBASE database according to the corresponding storage method.
[0074] Step S304: compress and store the transaction fields with high reuse rate and the values of the transaction fields in a shared data table of the HBASE database.
[0075] In the embodiment of the present invention, according to the task identifier of the historical task, the item identifier of one or more items corresponding to the historical task, the transaction field corresponding to the item identifier, and the value of the transaction field, storage is performed in accordance with the storage method corresponding to the transaction field. The transaction field with a high reuse rate corresponding to the item identifier and the value of the transaction field are compressed and stored; the transaction field with a low reuse rate corresponding to the task identifier and the item identifier and the value of the transaction field are non-compressed and stored.
[0076] In the embodiment of the present invention, the transaction fields with high reuse rate and the values of the transaction fields are compressed and stored in the shared data table snapshot_shared of the HBASE database.
[0077] In the embodiment of the present invention, after determining the transaction field with high reuse rate and the value of the transaction field, when compressing and storing them in the shared data table snapshot_shared of the HBASE database, it is queried whether snapshot_shared includes the transaction field with high reuse rate. If snapshot_shared includes the transaction field with high reuse rate, it is directly stored according to the value of the transaction field corresponding to the item identification; if snapshot_shared does not include the transaction field with high reuse rate, a transaction field corresponding to the item identification is created, and the value of the corresponding transaction field is saved. Therefore, the shared data table snapshot_shared includes the transaction field with high reuse rate corresponding to the item identification and the value of the transaction field.
[0078] In an embodiment of the present invention, when the transaction fields with high reuse rate and the values of the transaction fields are compressed and stored in the shared data table snapshot_shared of the HBASE database, the item identification and the transaction fields with high reuse rate are used as the rowkey of the shared data table snapshot_shared (for example, ${skuID}-${transaction field}), and the value of the transaction field is used as the corresponding value.
[0079] Step S305, concatenate and encrypt the transaction fields with high reuse rate to determine the sharedkey.
[0080] In the embodiment of the present invention, the transaction fields with high reuse rate are concatenated and encrypted, and used as the value of snapshot_version in the private data table snapshot_private with rowkey as snapshot_version, which is recorded as sharedkey.
[0081] In the embodiment of the present invention, the encryption method may be md5 encryption.
[0082] Step S306, storing the sharedkey and the data with low reuse rate in a private data table.
[0083] In the embodiment of the present invention, the sharedkey and the transaction field with low reuse rate and the value of the transaction field are stored in the private data table snapshot_private of the HBASE database. Therefore, the private data table snapshot_private includes the transaction field with low reuse rate and the value of the transaction field corresponding to the task identifier and the item identifier, snapshot_version and the value of snapshot_version.
[0084] In an embodiment of the present invention, when transaction fields with low and high reuse rates and the values of transaction fields are stored in the private data table snapshot_private of the HBASE database, the task identifier, item identifier and transaction fields with low reuse rates are used as the rowkey of the private data table snapshot_private (for example, ${orderId}-${skuID}-${transaction field}), and the value of the transaction field is used as the corresponding value; snapshot_version is used as the rowkey of the private data table snapshot_private (for example, ${orderId}-${skuID}-${snapshot_version}), and sharedkey is used as the value of snapshot_version.
[0085] In the existing snapshot storage, a snapshot is generated and stored in real time every time an order is received. The number of snapshots generated and stored is equal to the number of products in each order. If an order includes three products, three snapshots will be generated and stored. If a snapshot is stored for each product under an order, when the order volume increases suddenly, the storage of snapshots will occupy a huge amount of storage resources. However, the description information of a product is usually unchanged in a short period of time. Accordingly, snapshots can be reused in a short period of time, especially in similar scenarios such as flash sales. The product snapshots are the same within one minute, but the number of orders may be tens of thousands, resulting in the repeated storage of a large number of snapshots, wasting a lot of storage space.
[0086] Through the snapshot data storage method of the present invention, only the snapshot data of the product is saved. For multiple products of an order, compared with the method of saving multiple snapshots, storage resources can be saved, the consumption of storage space can be reduced, and the waste of storage resources can be prevented; for similar scenarios such as flash sales, the same product only needs to save snapshot data once, which greatly reduces the consumption of storage resources and improves storage efficiency.
[0087] In the embodiment of the present invention, the snapshot data storage method of the present invention can save storage resources, reduce the consumption of storage space, and prevent the waste of storage resources.
[0088] In the embodiment of the present invention, after determining the data in the shared data table and the private data table, the data can be compressed again and stored in the HBASE database. By compressing the data again based on determining different storage methods according to the reuse rate, storage resources can be further saved, the consumption of storage space can be reduced, and the waste of storage resources can be prevented.
[0089] In an embodiment of the present invention, the text of the target snapshot data may be a transaction field and the value of the transaction field, including item specification information and the value of the item specification information; item price information and the value of the item price information; item discount information and the value of the item discount information; item fulfillment information and the value of the item fulfillment information; item service information and the value of the item service information; item delivery information and the value of the item delivery information; item provider information and the value of the item provider information. For example, key is item specification information, value is "12L", "13L", "16L", "17L", etc.; key is item price information, value is "1099", "1599", "2099", "2999", etc.; key is item discount information, value is "gift", "discount on purchase over a certain amount", etc.; key is item fulfillment information, value is "inventory (1653)", "inventory (1825)", "inventory (459)", "inventory (569)", etc.; key is item service information, value is "safe shopping", "warranty period of 1 year", etc.; key is item delivery information, value is "No. xx, building xx, unit xx, xx community, xx road, xx street, Xicheng District, Beijing"; key is item provider information, value is "self-operated", "third party", etc.
[0090] The target snapshot data may be a transaction field and a value of the transaction field, including item image information and the value of the item image information. For example, the key is the item image information, and the value is one or more item images on the detail page.
[0091] In the embodiment of the present invention, the target snapshot data comes from the HBASE database.
[0092] In the embodiment of the present invention, when determining the target snapshot data corresponding to the task identifier and the item identifier from the snapshot data corresponding to the pre-stored multiple historical tasks, the private data table snapshot_private and the shared data table snapshot_shared in the HBASE database are queried.
[0093] like Figure 4 As shown, the query method of target snapshot data of the present invention includes the following steps:
[0094] Step S401, determining private data in a private data table according to the task identifier and the item identifier.
[0095] In the embodiment of the present invention, the private data in the private data table is determined according to orderId and skuID. For example, the rowkey "${orderId}-${skuID}-${transaction field}" of the private data table snapshot_private is queried to determine the low-reuse transaction field corresponding to orderId and skuID in the private data table snapshot_private and the value of the transaction field.
[0096] Step S402, determining the sharedkey in the private data table according to the task identifier and the item identifier.
[0097] In the embodiment of the present invention, according to orderId and skuID, the value corresponding to snapshot_version in the private data table snapshot_private is queried to determine the sharedkey corresponding to skuID. For example, the rowkey "${orderId}-${skuID}-${snapshot_version}" of the private data table snapshot_private is queried to determine the sharedkey corresponding to skuID.
[0098] Step S403, decrypt the sharedkey.
[0099] Step S404, determining the shared data in the shared data table according to the item identification and the decrypted sharedkey.
[0100] In the embodiment of the present invention, skuID and the decrypted sharedkey are concatenated to obtain ${skuID}-${sharedkey}, and the shared data table snapshot_shared is queried, and ${skuID}-${sharedkey} is used as the rowkey to determine the shared data in the shared data table. For example, the rowkey "${skuID}-${transaction field}" of the shared data table snapshot_shared is queried to determine the high-reuse transaction field corresponding to the item identifier and the value of the transaction field.
[0101] In the embodiment of the present invention, the target snapshot data can be quickly acquired through the query method of the target snapshot data of the present invention, so as to be used for generating the target snapshot when a transaction dispute or other needs arise.
[0102] Step S203: Generate a target snapshot corresponding to the item identifier according to the target snapshot data and a preconfigured snapshot generation template.
[0103] In an embodiment of the present invention, the snapshot generation template can be a page template. The page template can be written by using the FreeMarker template engine and the written page template is stored in a relational database (e.g., a MySQL database). When generating a snapshot, the page template is obtained from the MySQL database and the page template is rendered using the target snapshot data to obtain a page including the target snapshot.
[0104] In the embodiment of the present invention, the snapshot generation template may also be a picture template, a document template, etc.
[0105] In the embodiment of the present invention, when the snapshot generation template is stored in the MySQL database, the item identification and the snapshot generation template are stored correspondingly.
[0106] In an embodiment of the present invention, when determining the snapshot generation template, the corresponding snapshot generation template is searched from the MySQL database according to the item identifier; alternatively, the snapshot data in the HBASE database and the snapshot generation template in the MySQL database can be associated according to other identifiers to generate the target snapshot.
[0107] In the embodiment of the present invention, Figure 5 As shown, the method for generating a snapshot generation template of the present invention comprises the following steps:
[0108] Step S501, obtaining a plurality of historical tasks; wherein the historical tasks indicate task identifiers.
[0109] Step S502, determining one or more identical historical items in multiple historical tasks; wherein the historical items indicate item identifiers.
[0110] In the embodiment of the present invention, each historical task includes one or more historical items, wherein the same historical items correspond to the same item identifier.
[0111] Step S503: determining a plurality of historical transaction fields corresponding to the item identifier according to one or more historical items corresponding to the item identifier.
[0112] Step S504, determining a transaction field with a high reuse rate among the multiple historical transaction fields.
[0113] Step S505: determining a snapshot generation template according to the historical transaction fields with high reuse rate.
[0114] Step S506: storing the snapshot generation template in the MySQL database.
[0115] In the embodiment of the present invention, through the snapshot generation template generation method of the present invention, multiple snapshot generation templates can be generated, so as to be used for generating target snapshots when transaction disputes or other needs arise.
[0116] In the embodiment of the present invention, by receiving a snapshot generation request; the snapshot generation request indicates the item ID and the task ID of the snapshot to be generated; determining the target snapshot data corresponding to the task ID and the item ID from the snapshot data corresponding to the pre-stored multiple historical tasks; the snapshot data is pre-extracted from the transaction data of the multiple historical tasks and stored according to the historical tasks; generating the snapshot corresponding to the item ID according to the target snapshot data and the pre-configured snapshot generation template, etc., it is possible to save storage resources, reduce the consumption of storage space, and prevent the waste of storage resources. .
[0117] Figure 6 is a schematic diagram of main modules of a snapshot generating device according to an embodiment of the present invention, such as Figure 6 As shown, the snapshot generating device 600 of the present invention includes:
[0118] The receiving module 601 is used to receive a snapshot generation request; the snapshot generation request indicates the item identifier and task identifier of the snapshot to be generated.
[0119] In the embodiment of the present invention, the receiving module 601 of the snapshot generating device 600 is used to receive a snapshot generating request.
[0120] The data processing module 602 is used to determine the target snapshot data corresponding to the task identifier and the item identifier from the snapshot data corresponding to the multiple pre-stored historical tasks; the snapshot data is pre-extracted from the transaction data of the multiple historical tasks and stored in correspondence with the historical tasks.
[0121] In an embodiment of the present invention, when the data processing module 602 determines the target snapshot data corresponding to the task identifier and the item identifier from the snapshot data corresponding to multiple pre-stored historical tasks, it queries the private data table snapshot_private and the shared data table snapshot_shared in the HBASE database to determine the target snapshot data corresponding to the task identifier and the item identifier.
[0122] In the embodiment of the present invention, the historical tasks may be multiple user orders, and the snapshot data may include text, pictures, etc.
[0123] In an embodiment of the present invention, the target snapshot data includes snapshot data of the detail page corresponding to the task identifier and the item identifier. The text of the target snapshot data may be a transaction field and a value of the transaction field, including item specification information and a value of the item specification information; item price information and a value of the item price information; item discount information and a value of the item discount information; item fulfillment information and a value of the item fulfillment information; item service information and a value of the item service information; item delivery information and a value of the item delivery information; item provider information and a value of the item provider information.
[0124] In the embodiment of the present invention, the snapshot generating device 600 further includes a storage module 604, which is used to store the snapshot data in the HBASE database according to the corresponding storage mode according to the snapshot data storage method of the present invention.
[0125] The generating module 603 is used to generate a target snapshot corresponding to the item identifier according to the target snapshot data and a preconfigured snapshot generating template.
[0126] In an embodiment of the present invention, the snapshot generation template can be a page template. The page template can be written by using the FreeMarker template engine, and the written page template is stored in a relational database (for example, a MySQL database). When generating a snapshot, the generation module 603 obtains the page template from the MySQL database, and uses the target snapshot data to render the page template to obtain a page including the target snapshot.
[0127] In the embodiment of the present invention, when determining the snapshot generation template, the generation module 603 searches the MySQL database for the corresponding snapshot generation template according to the item identifier.
[0128] The snapshot generation device 600 further includes a template generation module 605 for generating a plurality of snapshot generation templates based on the snapshot data of the historical tasks according to the snapshot generation template generation method of the present invention.
[0129] In the embodiment of the present invention, through the modules such as the receiving module, the data processing module and the generating module, snapshot storage resources can be saved, the consumption of storage space can be reduced, and the waste of storage resources can be prevented.
[0130] Figure 7 is a schematic diagram of the structure of a computer system of a terminal device suitable for implementing an embodiment of the present invention, such as Figure 7 As shown, the computer system 700 of the terminal device according to the embodiment of the present invention includes:
[0131] A central processing unit (CPU) 701 can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage portion 708 into a random access memory (RAM) 703. Various programs and data required for the operation of the system 700 are also stored in the RAM 703. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0132] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0133] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0134] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0135] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0136] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a receiving module, a data processing module and a generating module. The names of these modules do not constitute a limitation on the modules themselves in some cases. For example, the generating module may also be described as "a module for generating a target snapshot corresponding to an item identifier based on target snapshot data and a preconfigured snapshot generating template".
[0137] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: receiving a snapshot generation request; the snapshot generation request indicates the item identifier and task identifier of the snapshot to be generated; determining the target snapshot data corresponding to the task identifier and the item identifier from the snapshot data corresponding to the pre-stored multiple historical tasks; the snapshot data is pre-extracted from the transaction data of the multiple historical tasks and stored according to the historical tasks; and generating the target snapshot corresponding to the item identifier according to the target snapshot data and the pre-configured snapshot generation template.
[0138] According to the technical solution of the embodiment of the present invention, snapshot storage resources can be saved, the consumption of storage space can be reduced, and the waste of storage resources can be prevented.
[0139] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A snapshot generation method, characterized in that: include: Receive a snapshot generation request; The snapshot generation request indicates the item identifier and task identifier of the snapshot to be generated; Determining target snapshot data corresponding to the task identifier and the item identifier from the pre-stored snapshot data corresponding to the plurality of historical tasks; The snapshot data is extracted in advance from the transaction data of the plurality of historical tasks and stored corresponding to the historical tasks; Extracting the snapshot data corresponding to one or more item identifiers from the transaction data in the historical task; storing the item identifiers, the transaction fields, and the values of the transaction fields in correspondence with each other according to the storage method corresponding to the transaction fields in the snapshot data; A target snapshot corresponding to the item identifier is generated according to the target snapshot data and a preconfigured snapshot generation template.
2. The method according to claim 1, characterized in that The storing the item identifier, the transaction field, and the value of the transaction field in correspondence with each other according to the storage mode corresponding to the transaction field in the snapshot data includes: Determine the storage mode corresponding to the transaction field in the snapshot data according to the reuse rate of the transaction field; wherein each of the snapshot data includes one or more transaction fields; According to the storage method, the item identifier is stored correspondingly to the transaction field and the value of the transaction field.
3. The method according to claim 2, characterized in that The determining, according to the reuse rate of the transaction field, a storage mode corresponding to the transaction field in the snapshot data includes: When the reuse rate of the transaction field is not less than the reuse rate threshold, it is determined that the storage mode of the transaction field is compressed storage.
4. The method according to claim 2, characterized in that: Also includes: The reuse rate of the transaction field is determined according to the data storage space required for storing the transaction field and the data update period of the transaction field.
5. The method according to claim 2, characterized in that: The snapshot generation template is a page template, and the target snapshot corresponding to the item identifier is generated according to the target snapshot data and the preconfigured snapshot generation template, including: The page template is rendered using the target snapshot data to obtain a page including the target snapshot.
6. The method according to claim 5, characterized in that Also includes: Acquire historical transaction fields corresponding to the task identifier and the item identifier in multiple historical tasks; The snapshot generation template is determined according to the historical transaction field.
7. The method according to any one of claims 1 to 6, characterized in that: The transaction fields include any one or more of the following: item specification information, item picture information, item price information, item discount information, item fulfillment information, item service information, item delivery information, and item provider information.
8. A snapshot generation device, characterized in that: include: A receiving module, used for receiving a snapshot generation request; The snapshot generation request indicates the item identifier and task identifier of the snapshot to be generated; A data processing module, used to determine target snapshot data corresponding to the task identifier and the item identifier from the snapshot data corresponding to the pre-stored multiple historical tasks; The snapshot data is extracted in advance from the transaction data of the plurality of historical tasks and stored corresponding to the historical tasks; A storage module, used to extract the snapshot data corresponding to one or more item identifiers from the transaction data in the historical task; store the item identifiers, the transaction fields and the values of the transaction fields in correspondence with each other according to the storage mode corresponding to the transaction fields in the snapshot data; A generation module is used to generate a target snapshot corresponding to the item identifier according to the target snapshot data and a preconfigured snapshot generation template.
9. An electronic device for generating a snapshot, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method for creating data snapshot in cluster and terminal device
CN109542841A
Account adjustment method and device, terminal equipment and storage medium
CN111383089A