Hot commodity information caching method and device and readable storage medium

By identifying frequently accessed products in a distributed storage system and migrating their information to a local cache, the problem of low system response efficiency caused by frequently accessed products is solved, achieving efficient access response and stability.

CN121284047APending Publication Date: 2026-01-06创优数字科技(广东)有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511457677.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-13
Publication Date
2026-01-06

AI Technical Summary

Technical Problem

In distributed storage systems, when popular products appear, the system response efficiency is low, and it cannot efficiently handle a large number of concurrent access requests.

Method used

By obtaining the frequency of product access requests within the current time period, hot product objects are identified, and their associated product information is migrated to the local cache, reducing network transmission and directly sending back product information.

Benefits of technology

It improves system response efficiency, ensures system stability in high-concurrency scenarios, reduces network transmission overhead in distributed storage systems, and increases access response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121284047A_ABST
    Figure CN121284047A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the field of distributed storage, and provides a hotspot commodity information caching method and device and a readable storage medium, and the method comprises the steps: obtaining a commodity access request reaching any node in a current time period for any node in all network nodes of a distributed storage system; according to the frequency of each commodity access request in the current time period, identifying a hotspot commodity object corresponding to any node from each commodity object; and migrating commodity information associated with the hot commodity object from the distributed storage system to a local cache region corresponding to any node. By adopting the method, the system response efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of distributed storage technology, and in particular to a method, apparatus and readable storage medium for caching hot commodity information. Background Technology

[0002] In the field of distributed storage, product information that needs to be managed on the Internet is stored in a distributed manner, such as product names and prices in a product information purchasing system, in order to facilitate more efficient information interaction.

[0003] However, when a hot product emerges, such as due to the launch of a new product or a viral online item, a large number of visits to that product suddenly surge, causing excessive system pressure, slow system response time, and bottlenecks in the performance of the distributed cache.

[0004] In summary, when popular products emerge, the large number of concurrent data requests leads to low system response efficiency in traditional distributed storage methods for product information. Summary of the Invention

[0005] This application provides a method, apparatus, and computer-readable storage medium for caching information on popular products, which can improve network transmission efficiency and thus improve system response efficiency.

[0006] In a first aspect, embodiments of this application provide a method for caching information on popular products, including:

[0007] For any node in the network of the distributed storage system, obtain the product access requests that arrive at the node within the current time period; the current time period is a time period used to characterize the recent access status of the node, and the product access request is a network request used to access a product object to obtain the corresponding product information.

[0008] Based on the frequency of access requests for each product within the current time period, the hot product object corresponding to any node is identified from each product object; the hot product object is the product object that is frequently accessed within the current time period.

[0009] The product information associated with the hot product object is migrated from the distributed storage system to the local cache area corresponding to any of the nodes; the local cache area is used for the hot product object to directly send back the product information of the hot product object when the hot product object is accessed by any of the nodes.

[0010] Optionally, in some embodiments of this application, the step of identifying the hot product object corresponding to any node from each product object based on the frequency of each product access request within the current time period includes:

[0011] Construct a circular data queue that meets the time length requirement of the current time period; the circular data queue is a data queue whose addresses are connected end to end in the storage space;

[0012] The product access requests that arrive at any of the nodes within the current time period are stored in the circular data queue in the order of the timestamps of each product access request; the circular data queue is used to dynamically update the elements of the queue when a new product access request arrives.

[0013] The request frequency of each product access request in the circular data queue is obtained, and the product objects corresponding to the product access requests with a request frequency greater than a preset frequency threshold are determined as the hot product objects corresponding to any node.

[0014] Optionally, in some embodiments of this application, the method further includes:

[0015] Obtain the basic frequency threshold; the basic frequency threshold is a benchmark threshold set for all product objects to determine whether they are hot product objects;

[0016] The dynamic weight frequency threshold for each product object is obtained by querying the product identifier of each product object; the dynamic weight frequency threshold is a frequency threshold that characterizes the category characteristics of each product object.

[0017] The preset frequency threshold for each product object is obtained by weighting the basic frequency threshold and the dynamic weighted frequency threshold.

[0018] Optionally, in some embodiments of this application, the method further includes:

[0019] In response to a product access request arriving at any of the nodes, the product information of the product object to be accessed associated with the product access request is queried in the data cache of any of the nodes; the data cache includes the local cache and the distributed cache corresponding to the distributed storage system; the distributed cache is used to cache product information of other product objects besides the hot product object;

[0020] If the product information query for the product object to be accessed fails to find a match, an asynchronous loading task is created associated with the product object to be accessed; the asynchronous loading task is used to query the product information associated with the product object to be accessed in the database.

[0021] The product information of the product object to be accessed, sent by the database in response to the asynchronous loading task, is cached in the data cache area of ​​any of the nodes.

[0022] Optionally, in some embodiments of this application, the method further includes:

[0023] If the product information query for the product object to be accessed fails to find a match, the corresponding product fallback data for the product object to be accessed is obtained; the product fallback data is pre-stored basic data used to characterize the product's features;

[0024] The product information display area corresponding to the product object to be accessed displays the product's backstop data.

[0025] Optionally, in some embodiments of this application, the method further includes:

[0026] If a change is detected in the information of any product object in the distributed storage system, the version mapping information corresponding to that product object is updated; the version mapping information includes the identifier of the changing node and the version number of the product object; the changing node is the network node where the information change occurred.

[0027] A broadcast change event is triggered based on the updated version mapping information; the broadcast change event is used to broadcast the version mapping information and product identifier corresponding to any product object to the nodes to be broadcast; the nodes to be broadcast are other network nodes in the distributed storage system besides the change node.

[0028] Optionally, in some embodiments of this application, the method further includes:

[0029] If it is detected that the broadcast reception version number received by any of the nodes is later than the local version number, the product information of the product object corresponding to the local version number will be set to an invalid state.

[0030] Wherein, the broadcast received version number is the version number received via broadcast, the local version number is the version number stored in the local cache of any node, and the broadcast received version number and the local version number are version numbers corresponding to the same product object.

[0031] Secondly, embodiments of this application provide a caching device for popular product information, which has the function of implementing the caching method for popular product information corresponding to the first aspect described above. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above function, and the modules can be software and / or hardware.

[0032] In one possible design, the device includes:

[0033] The product access request acquisition module is used to acquire product access requests that arrive at any of the network nodes in the distributed storage system within the current time period; the current time period is a time period used to characterize the recent access status of any of the nodes, and the product access request is a network request used to access a product object to obtain the corresponding product information.

[0034] The hot-spot product object identification module is used to identify the hot-spot product object corresponding to any node from each product object based on the frequency of access requests for each product within the current time period; the hot-spot product object is the product object that is frequently accessed within the current time period.

[0035] The hot-spot product information migration module is used to migrate the product information associated with the hot-spot product object from the distributed storage system to the local cache area corresponding to any node; the local cache area is used for the hot-spot product object to directly send back the product information of the hot-spot product object when the hot-spot product object is accessed by any node.

[0036] Another aspect of this application provides a caching device for hot product information, which includes at least one connected processor, memory, and transceiver, wherein the memory is used to store program code, and the processor is used to call the program code in the memory to execute the methods described in the above aspects.

[0037] In another aspect, this application provides a computer storage medium including instructions that, when executed on a computer, cause the computer to perform the methods described in the above aspects.

[0038] Compared to existing distributed storage methods, in this embodiment, for any node in the distributed storage system's network nodes, the system first acquires product access requests arriving at that node within the current time period. Then, based on the frequency of each product access request within the current time period, it identifies hot-selling product objects from among the product objects. The product information associated with these hot-selling product objects is then migrated to the local cache of any node, facilitating the direct return of product information when these hot-selling product objects are accessed. In this embodiment, hot-selling products are identified based on real-time access frequency. Dynamic data migration adapts to changes in business traffic, ensuring system stability under high concurrency scenarios. Local caching reduces the network transmission overhead of the distributed storage system, and direct return of hot-selling products from the local cache improves access response speed. By routing cached data, intelligently identifying hot-selling cached data and switching it to the local cache reduces network transmission time, thereby improving system response efficiency. Attached Figure Description

[0039] Figure 1 This is an application environment diagram of a method for caching hot product information in one embodiment;

[0040] Figure 2 This is a flowchart illustrating a method for caching information on popular products in one embodiment;

[0041] Figure 3 This is a timing diagram illustrating the implementation principle of the intelligent degradation channel in one embodiment;

[0042] Figure 4 This is a flowchart illustrating the version conflict resolution mechanism in one embodiment;

[0043] Figure 5 This is a flowchart illustrating a method for caching information on popular products in another embodiment;

[0044] Figure 6 This is a flowchart illustrating dynamic routing in one embodiment;

[0045] Figure 7 This is a structural block diagram of a caching device for hot product information in one embodiment;

[0046] Figure 8 This is an internal structural diagram of a caching device for hot product information in one embodiment;

[0047] Figure 9 This is an internal structural diagram of a caching device for hot product information in another embodiment. Detailed Implementation

[0048] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those explicitly listed, but may include other steps or modules not explicitly listed or inherent to these processes, methods, products, or devices. The module divisions appearing in the embodiments of this application are merely logical divisions; in actual applications, there may be other division methods. For example, multiple modules may be combined into or integrated into another system, or some features may be ignored or not performed. Furthermore, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces, and the indirect couplings or communication connections between modules may be electrical or other similar forms. These are not limited in the embodiments of this application. Moreover, modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed across multiple circuit modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of this application.

[0049] This application provides a method for caching information on popular products, which can be applied to, for example... Figure 1 In the application scenario shown, terminal 102 communicates with server 104 via a network.

[0050] The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle systems. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0051] It should be noted that the terminal 102 involved in this application embodiment can be a device that provides voice and / or data connectivity to a user, a handheld device with wireless connectivity, or other processing devices connected to a wireless modem. The wireless terminal can communicate with one or more core networks via a Radio Access Network (RAN). The wireless terminal can be a mobile terminal, such as a mobile phone (or "cellular" phone) and a computer with a mobile terminal, for example, a portable, pocket-sized, handheld, computer-embedded, or vehicle-mounted mobile device, which exchanges voice and / or data with the RAN. Examples include Personal Communication Service (PCS) phones, cordless phones, Session Initiation Protocol (SIP) phones, Wireless Local Loop (WLL) stations, and Personal Digital Assistants (PDAs). Wireless terminals can also be referred to as systems, subscriber units, subscriber stations, mobile stations, mobile stations, remote stations, access points, remote terminals, access terminals, user terminals, terminal equipment, user agents, user devices, or user equipment.

[0052] In distributed storage, when a popular product becomes available, a sudden surge of accesses to that product leads to low system response efficiency. To address this issue, this application provides the following technical solutions:

[0053] For any node in the distributed storage system, obtain the product access requests that arrive at that node within the current time period; based on the frequency of each product access request within the current time period, identify the hot product object corresponding to any node from each product object; migrate the product information associated with the hot product object from the distributed storage system to the local cache area corresponding to any node; the local cache area is used to directly return the product information of the hot product object when it is accessed by any node.

[0054] The above technical solutions improve network transmission efficiency, thereby improving system response efficiency.

[0055] Please refer to Figure 2 The following describes a method for caching hot product information provided by an embodiment of this application. The embodiments of this application mainly include:

[0056] S201: For any node in the network of the distributed storage system, obtain the product access request that arrives at any node within the current time period.

[0057] The distributed storage system is the storage system used in the embodiments of this application. The system includes at least two network nodes. It should be noted that the caching method for hot product information provided in this application can be applied to any node in each network node. That is, any network node can identify hot product objects based on the incoming product access requests, so as to migrate the product information to the local cache area.

[0058] The current time period is used to characterize the recent access status of any node. The current time period is set based on a sliding window mechanism. For example, the current time period can be set to a time period of 5 minutes (300,000 milliseconds). Correspondingly, the fixed time window in the sliding window mechanism is 5 minutes long and is used to reflect the access status of the network node in the past 5 minutes.

[0059] Among them, a product access request is a network request used to access a product object to obtain the corresponding product information. The product object can be the product to be purchased in the online shopping system, such as a book for sale. The product information can be the relevant information of the book, such as basic information like the book name and cover, or dynamic information such as the real-time price and real-time inventory of the book.

[0060] For example, for a certain network node, different clients can send product access requests to that network node for a certain product object to query the product information of that product object or to purchase the product. At this time, the product access requests that arrive at the node within 5 minutes can be collected to determine which products are popular in the last 5 minutes.

[0061] S202, based on the frequency of access requests for each product within the current time period, identify the hot product object corresponding to any node from each product object.

[0062] Each product access request generally corresponds to a product object. The frequency of the request can be regarded as the frequency of the product object being requested to be accessed. Through this frequency information, it is possible to identify which product objects are popular from among many product objects.

[0063] For example, a hot product object is a product object that is frequently accessed within the current time period. For instance, if a book has been accessed 100 times in the last 5 minutes, this book can be considered a hot product object in the last 5 minutes based on a certain frequency judgment rule.

[0064] S203 migrates the product information associated with the hot product object from the distributed storage system to the local cache area corresponding to any node.

[0065] The distributed storage system can be a Redis distributed cluster system, the product information can be stored in the database of the distributed storage system, and the local cache can be a high-performance local cache library such as Caffeine.

[0066] For example, after identifying a book as a popular product, the product information of this book is migrated from the distributed storage system to the local cache of the network node to which the request arrives, thus achieving local caching. If the product information of this book is accessed again by the client on this network node, the local cache can directly send back the product information without having to access it again from the database of the distributed storage system, thereby improving the network response speed.

[0067] Compared to existing distributed storage methods, in this embodiment, for any node in the distributed storage system's network nodes, the system first acquires product access requests arriving at that node within the current time period. Then, based on the frequency of each product access request within the current time period, it identifies hot-selling product objects from among the product objects. The product information associated with these hot-selling product objects is then migrated to the local cache of any node, facilitating the direct return of product information when these hot-selling product objects are accessed. In this embodiment, hot-selling products are identified based on real-time access frequency. Dynamic data migration adapts to changes in business traffic, ensuring system stability under high concurrency scenarios. Local caching reduces the network transmission overhead of the distributed storage system, and direct return of hot-selling products from the local cache improves access response speed. By routing cached data, intelligently identifying hot-selling cached data and switching it to the local cache reduces network transmission time, thereby improving system response efficiency.

[0068] Optionally, in some embodiments of this application, step S202 may include: constructing a circular data queue that meets the time length requirement of the current time period; storing product access requests that arrive at any node within the current time period into the circular data queue in the order of the timestamps of each product access request; obtaining the request frequency of each product access request in the circular data queue, and determining the product object corresponding to the product access request with a request frequency greater than a preset frequency threshold as the hot product object corresponding to any node.

[0069] Among them, the circular data queue is a data queue with the addresses of the first and last connected in the storage space. For example, the queue size is 300, corresponding to the current time period of 5 minutes (300 seconds). Each second in the 300 seconds is a slot. Each slot is used to store the product access requests that arrive within that second. The product access requests can be stored in the form of timestamps.

[0070] The circular data queue is used to dynamically update the elements of the queue when a new product access request arrives. For example, if a queue records requests from 12:00:00 to 12:05:00, and one second has passed, the current time is 12:05:01, then the product access requests from the first second (12:00:00 to 12:00:01) in the queue are replaced with the product access requests from the current first second (12:05:00 to 12:05:01). The elements in the queue are the individual product access requests, or more specifically, the timestamps of each product access request. In this way, the circular data queue is maintained through dynamic updates.

[0071] For example, firstly, a circular data queue that meets the 5-minute time requirement is constructed. Product access requests that arrive at any node within the last 5 minutes are stored in the circular data queue in the order of their timestamps. Then, the request frequency of each product access request in the circular data queue is obtained. In the last 5 minutes, the frequency of product access requests for a certain book is 100 times, and the preset frequency threshold for this book is 50 times. Obviously, the access frequency of this book is greater than this threshold, so this book can be regarded as a popular product object in the last 5 minutes.

[0072] In this embodiment, the design of a circular data queue enables dynamic calculation of the frequency of recent requests, and a dynamic sliding window is used to determine the popularity. Each request can dynamically update the window data, and the circular queue automatically eliminates the oldest data, thereby improving the accuracy and timeliness of popular product object identification.

[0073] Optionally, in some embodiments of this application, the method further includes: obtaining a basic frequency threshold; querying the dynamic weighted frequency threshold corresponding to each product object based on the product identifier of each product object; and weighting the basic frequency threshold and the dynamic weighted frequency threshold corresponding to each product object to obtain a preset frequency threshold corresponding to each product object.

[0074] The basic frequency threshold is a benchmark threshold set for all product objects to determine whether they are hot product objects. For example, the basic threshold is 100. The basic threshold is a unified benchmark for all products and can be adjusted according to business needs, such as changing it to 50 or 200.

[0075] Among them, the dynamic weight frequency threshold is a frequency threshold that characterizes the category characteristics of each product object. The weight of its category can be obtained through the identifier of the product object (such as product ID). Different categories of products have different weights, which are used to reflect the differences in the sensitivity of products of different categories to hot topics in actual business.

[0076] For example, a basic frequency threshold of 100 is obtained, and the dynamic weighted frequency threshold corresponding to the book category is obtained by querying the product identifier of each product object, which is 200. The basic frequency threshold and the dynamic weighted frequency threshold are weighted and summed (e.g., directly added) to obtain a preset frequency threshold of 300.

[0077] In this embodiment, the frequency threshold is divided into a basic frequency threshold and a dynamic weighted frequency threshold. The basic threshold reflects the baseline situation of all products, while the dynamic weighted frequency threshold changes dynamically with different product categories. This breaks through the limitations of traditional static thresholds, realizes dynamic threshold determination, improves the flexibility and adaptability of threshold settings, and thus improves the accuracy of hot product object identification.

[0078] In another embodiment, the design of the hot item identification function includes three aspects: data structure design, sliding window mechanism, and popularity judgment logic. Specifically, in terms of data structure design, a ConcurrentHashMap from a programming language (such as Java) is used to store the access records of each item. For example, the key in the mapping is set as the item ID, and the value is a fixed-size circular queue (e.g., the queue name is CircularFifoQueue) to store the timestamp. In terms of the sliding window mechanism, a fixed time window of 5 minutes (300,000 milliseconds) is set, the queue size is 300, corresponding to a duration of 300 seconds, with one slot per second, and the window is automatically maintained for each request. In terms of popularity judgment logic, the current request timestamp is first added to the queue, then the number of valid requests within the window (i.e., the current size of the queue) is calculated, and finally, a dynamic threshold judgment is performed.

[0079] Optionally, in some embodiments of this application, the method further includes: in response to a product access request arriving at any node, querying the product information of the product object to be accessed associated with the product access request in the data cache of any node; if the product information query for the product object to be accessed is not successful, creating an asynchronous loading task associated with the product object to be accessed; and caching the product information of the product object to be accessed sent by the database in response to the asynchronous loading task to the data cache of any node.

[0080] The data cache includes a local cache and a distributed cache corresponding to the distributed storage system. The distributed cache is used to cache product information of other product objects except for hot product objects. In other words, the method provided in this embodiment can be applied to the cache access process of the distributed cache or the cache access process of the local cache, as long as an asynchronous loading task can be established to refill the cache in the event of cache breakdown. The asynchronous loading task is used to query the product information associated with the product object to be accessed in the database.

[0081] In this embodiment, if the product information is not found in the data cache, an asynchronous loading task is created to avoid the impact of synchronous concurrency of tasks on the database. Then, the product information sent by the database in response to the asynchronous loading task is cached in the data cache of any node, realizing cache backfilling. This makes it easier for subsequent requests for the product object to be responded to quickly, thereby avoiding the risk of cache breakdown and improving the system efficiency and availability in the information access process.

[0082] Optionally, in some embodiments of this application, the method further includes: if the product information query for the product object to be accessed in the data cache is not found, obtaining the product backup data corresponding to the product object to be accessed; and displaying the product backup data in the display area of ​​the product information corresponding to the product object to be accessed.

[0083] Among them, the product safety net data consists of pre-stored basic data used to characterize the product, such as the book's name and cover image.

[0084] For example, if a query for product information of a book fails to find the desired product in the data cache, the book title and cover image are retrieved and displayed in the product information display area of ​​the book. After the asynchronous loading task is completed, other dynamic information of the book, such as real-time price and inventory, is retrieved from the cache after it has been refilled, and then all product information is displayed.

[0085] In this embodiment, by returning the product backup data during the loading process of the asynchronous loading task, the system's response speed is improved, and the data access experience for users of product information is enhanced.

[0086] like Figure 3 As shown, Figure 3 A timing diagram illustrating the implementation principle of the intelligent degradation channel. Figure 3 It includes a client, a degradation channel, a database, and a cache. The client is the device that initiates the access request for the product. The degradation channel is a virtual functional module that ensures the stability of data return. The database is used to store product information. The cache can be a local cache or a distributed cache corresponding to a distributed storage system.

[0087] In this embodiment, to address the cache breakdown problem in high-concurrency scenarios and prevent the database from being overwhelmed by a large number of requests due to cache invalidation, the design goal is to first maintain the mapping from product IDs to loading tasks. For example, the ConcurrentHashMap function in a programming language (such as Java) can be used to maintain this mapping. When multiple requests access the same invalid product simultaneously, only a single asynchronous loading task is created, and subsequent requests directly reuse the existing task, avoiding repeated database queries and achieving asynchronous loading. In addition, this embodiment designs an immediate response strategy to avoid blocking while waiting for data loading. When cache breakdown occurs, a fallback object containing basic information is immediately returned. Thus, by setting up a fallback channel, creating asynchronous loading tasks, and returning fallback data, the risk of cache breakdown is avoided, the system's response speed is improved, and the data access experience for users accessing product information is enhanced.

[0088] Optionally, in some embodiments of this application, the method further includes: updating the version mapping information corresponding to any product object when a change in the information of any product object in the distributed storage system is detected; and triggering a broadcast change event based on the updated version mapping information.

[0089] The version mapping information includes the identifier of the change node and the version number of any product object. The version mapping information can be represented in the form of a vector, such as a two-dimensional vector whose two component elements are the identifier of the change node and the version number.

[0090] Among them, the change node is the network node where the information change occurs; the broadcast change event is used to broadcast the version mapping information and product identifier corresponding to any product object to the broadcast node, which is another network node in the distributed storage system other than the change node.

[0091] Updating the version mapping information refers to updating the version number, such as incrementing the version number to generate a new version number.

[0092] For example, in terms of data synchronization, the design goal of this embodiment is to achieve eventual consistency of cached data in a distributed environment and minimize synchronization overhead. Its core implementation principles include a vector clock mechanism and a change propagation process. Specifically, in the vector clock mechanism, each data item maintains a version mapping. For example, its programming language expression can be: Map<node ID, version number>. For instance, a version mapping information of "node1, 3" means that the version number of a certain product recorded by the node1 network node is 3. In the change propagation process, the local version number can be incremented through the change event detection function, thereby broadcasting the change event.

[0093] In addition, this embodiment has the advantage of incremental synchronization in terms of data transmission. This embodiment only transmits metadata (such as product ID and version mapping information), instead of transmitting the full data of the product object in the traditional data synchronization method. The amount of data synchronized in this embodiment is fixed (about 8-32 bytes / event). For example, the data to be broadcast includes "000012000251345 v001", where the network node number is 00001, the product ID is 2000251345, and the version number is v001. With this design, compared with the traditional solution, the data transmission mechanism of this embodiment can save 99% of bandwidth resources.

[0094] Optionally, in some embodiments of this application, the method further includes: setting the product information of the product object corresponding to the local version number to an invalid state when it is detected that the broadcast reception version number received by any node is later than the local version number.

[0095] Among them, the broadcast received version number is the version number received via broadcast, and the local version number is the version number stored in the local cache of any node. The broadcast received version number and the local version number are the version numbers corresponding to the same product object.

[0096] In this embodiment, the version number is compared with the local version number to analyze the version age. When the broadcast received version number is later than the local version number, the product information of the local version number is invalidated, thereby ensuring the availability of data.

[0097] In addition, based on the above embodiments, this application also provides a more comprehensive version conflict resolution mechanism, such as... Figure 4 As shown, after a node receives a change notification, it compares the local version with the broadcast version. If the broadcast version is greater than the local version, the local cache is invalidated. If there is a version conflict, the highest version priority strategy is adopted.

[0098] Specifically, after a node broadcasts version mapping information (such as a local version vector), other nodes receive the broadcast notification and compare their local version vector with the received version vector. If the received version is greater than the local version, it means the other node's data is newer, while the local cached data has expired. The node will invalidate its local cache for that product and fetch the latest data from the data source or the node that broadcast the notification the next time it reads the data. If the received version is less than the local version, it means the local data is newer, and the notification can be ignored. If there is a version conflict, i.e., the sizes cannot be compared, it indicates that concurrent modifications have occurred, and the conflict needs to be resolved according to a preset strategy (such as re-fetching data from the data source). Here, a conflict refers to multiple nodes having version numbers that are different in value.

[0099] In another embodiment, such as Figure 5As shown, a method for caching information on popular products is provided, including the following steps:

[0100] S501: For any node in the network of the distributed storage system, obtain the product access request that arrives at any node within the current time period.

[0101] S502, construct a circular data queue that meets the time length requirement of the current time period, and store the product access requests that arrive at any node within the current time period into the circular data queue in the order of the timestamps of each product access request.

[0102] S503, obtain the basic frequency threshold, query the dynamic weighted frequency threshold corresponding to each product object based on the product identifier of each product object, and weight the basic frequency threshold and dynamic weighted frequency threshold corresponding to each product object to obtain the preset frequency threshold corresponding to each product object.

[0103] S504, obtain the request frequency of each product access request in the circular data queue, and determine the product object corresponding to the product access request with a request frequency greater than a preset frequency threshold as the hot product object corresponding to any node.

[0104] S505 migrates the product information associated with hot product objects from the distributed storage system to the local cache area corresponding to any node;

[0105] S506, If the product information query for the product object to be accessed is not found, create an asynchronous loading task associated with the product object to be accessed;

[0106] S507 caches the product information of the product object to be accessed sent by the database in response to the asynchronous loading task to the data cache area of ​​any node;

[0107] S508: Obtain the product catchment data corresponding to the product object to be accessed, and display the product catchment data in the product information display area corresponding to the product object to be accessed.

[0108] It should be noted that the specific limitations of the above steps can be found in the specific limitations of a caching method for hot product information mentioned above, and will not be repeated here.

[0109] For the convenience of those skilled in the art, Figure 6 A flowchart illustrating the overall process of a method for caching information on popular products is provided below for reference. Figure 6 This document describes in detail a method for caching information on popular products using a specific embodiment. It is important to understand that the following description is merely illustrative and not intended to limit the scope of the application.

[0110] The system architecture used in this embodiment is divided into an access layer, a cache layer, and a business logic layer. The access layer includes a user request parsing and routing module, which directs requests to the local cache or distributed cache based on the popularity of the product. The cache layer consists of a Redis cluster and local Caffeine nodes, and load balancing is achieved through a consistent hashing algorithm.

[0111] like Figure 6 As shown, Figure 6 The process of dynamic routing is demonstrated. A sliding window collects the request frequency in the last N seconds and calculates the product popularity using the TF-IDF (Term Frequency-Inverse Document Frequency) algorithm. When the product popularity exceeds the threshold, the system automatically loads it into the local cache and marks it as hot data. Finally, the business layer queries the data layer for data calculation, data display and other business logic.

[0112] In this embodiment, regarding dynamic cache routing, it can automatically identify popular products (such as flash sale items) and migrate hot data from Redis to the local cache (Caffeine), while non-hot products still use the distributed cache, thereby achieving data diversion. It also employs an innovative technology that combines a sliding window with the TF-IDF algorithm to calculate product popularity in real time, thus completing the identification of hot product objects. In terms of the design of the intelligent degradation channel, when the cache is breached, it automatically switches to a pre-computation queue, returns fallback data, and performs asynchronous refresh. It adopts a circular buffer data caching structure and uses the Future mechanism to achieve zero blocking. In terms of data synchronization, it adopts lightweight consistency synchronization, which achieves eventual consistency of local / distributed cache data based on version number vector clocks. Change propagation only requires 8 bytes of metadata, improving the efficiency of data synchronization.

[0113] In this embodiment, to address the issue of high distributed cache load and slow response time when hot data appears in the system, a smart cache routing scheme for hot products is provided. This scheme can route cached data, intelligently identify hot cached data, and dynamically switch hot data to the local cache, reducing network transmission time and thus improving system availability and response speed.

[0114] The core of this embodiment lies in classifying the cache, routing hot and cold data separately, and employing a circular cache to achieve a zero-blocking mechanism. This design saves costs, for example, reducing the Redis cluster size by 60% and bandwidth costs by 90% for the same data volume. Furthermore, it improves the user experience for visitors of product information, reducing latency for popular products from 15ms to 0.5ms, and avoiding white screen errors caused by cache breakdown.

[0115] Figures 1 to 6Any technical feature in the embodiments corresponding to any of the above items is also applicable to the embodiments of this application. Figures 7 to 9 The corresponding implementation examples will not be repeated hereafter.

[0116] The above describes a method for caching hot product information in the embodiments of this application. The following describes the apparatus for executing the above method for caching hot product information.

[0117] Reference Figure 7 The caching device for popular product information is described below. The caching device for popular product information includes:

[0118] The product access request acquisition module 701 is used to acquire product access requests that have arrived at any node in the network nodes of the distributed storage system within the current time period. The current time period is a time period used to characterize the recent access status of any node, and the product access request is a network request used to access a product object to obtain the corresponding product information.

[0119] The hot-spot product object identification module 702 is used to identify the hot-spot product object corresponding to any node from each product object based on the frequency of access requests for each product within the current time period; the hot-spot product object is the product object that is frequently accessed within the current time period.

[0120] The hot product information migration module 703 is used to migrate the product information associated with hot product objects from the distributed storage system to the local cache area corresponding to any node; the local cache area is used to directly send back the product information of hot product objects when they are accessed on any node.

[0121] In this embodiment, the cooperation between the above-mentioned product access request acquisition module 701, hot product object identification module 702, and hot product information migration module 703 can improve network transmission efficiency, thereby improving system response efficiency.

[0122] In another embodiment, a caching device for popular product information is provided. This caching device can be a server, and its internal structure diagram can be as follows: Figure 8As shown, the device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface of this computer device is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for caching hot-topic product information.

[0123] In one embodiment, a caching device for popular product information is provided. This caching device can be a terminal, and its internal structure diagram can be as follows: Figure 9 As shown, it includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides the environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a method for caching hot-topic product information. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the computer equipment casing, or external keyboards, touchpads, or mice, etc.

[0124] Those skilled in the art will understand that Figure 8 and Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the device to which the present application is applied. A specific device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0125] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0126] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0127] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, apparatuses, or modules, and may be electrical, mechanical, or other forms.

[0128] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0129] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.

[0130] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.

[0131] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)).

[0132] The technical solutions provided in the embodiments of this application have been described in detail above. Specific examples have been used in the embodiments of this application to illustrate the principles and implementation methods of the embodiments of this application. The description of the above embodiments is only for the purpose of helping to understand the methods and core ideas of the embodiments of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the embodiments of this application. Therefore, the content of this specification should not be construed as a limitation on the embodiments of this application.

Claims

1. A cache method of hot item information, characterized by, The method comprises: For any node in each network node of a distributed storage system, obtaining a commodity access request reaching the any node in a current time period; the current time period is a time period for characterizing a recent access condition of the any node, and the commodity access request is a network request for accessing a commodity object to obtain corresponding commodity information; According to the frequency of each commodity access request in the current time period, a hot commodity object corresponding to the any node is identified from each commodity object; the hot commodity object is a commodity object frequently accessed in the current time period; The commodity information associated with the hot commodity object is migrated from the distributed storage system to the local cache area corresponding to the any node; the local cache area is used for directly returning the commodity information of the hot commodity object when the hot commodity object is accessed in the any node.

2. The method of claim 1, wherein, The hot commodity object corresponding to the any node is identified from each commodity object according to the frequency of each commodity access request in the current time period, comprising: A ring-shaped data queue meeting the length requirement of the current time period is constructed; the ring-shaped data queue is a data queue with addresses connected at the head and tail in the storage space; The commodity access request reaching the any node in the current time period is stored in the ring-shaped data queue according to the order of the time stamp of each commodity access request; the ring-shaped data queue is used to dynamically update the elements of the queue when a new commodity access request arrives; The request frequency of each commodity access request in the ring-shaped data queue is obtained, and the commodity object corresponding to the commodity access request with a request frequency greater than a preset frequency threshold is determined as the hot commodity object corresponding to the any node.

3. The method of claim 2, wherein, The method further comprises: Obtaining a basic frequency threshold; the basic frequency threshold is a reference threshold for judging whether it is a hot commodity object set for all commodity objects; According to the commodity identifier of each commodity object, a dynamic weight frequency threshold corresponding to each commodity object is queried; the dynamic weight frequency threshold is a frequency threshold representing the category characteristics of each commodity object; The basic frequency threshold and the dynamic weight frequency threshold corresponding to each commodity object are weighted to obtain the preset frequency threshold corresponding to each commodity object.

4. The method of claim 1, wherein, The method further comprises: In response to the commodity access request reaching the any node, querying the commodity information of the to-be-accessed commodity object associated with the commodity access request in the data cache area of the any node; the data cache area includes the local cache area and the distributed cache area corresponding to the distributed storage system; the distributed cache area is used to cache the commodity information of other commodity objects except the hot commodity object; In the case that the commodity information query of the to-be-accessed commodity object is not hit, an asynchronous loading task associated with the to-be-accessed commodity object is created; the asynchronous loading task is used to query the commodity information associated with the to-be-accessed commodity object in the database; The commodity information of the to-be-accessed commodity object sent by the database in response to the asynchronous loading task is cached to a data cache area of the any node.

5. The method of claim 4, wherein, The method further comprises: In the case that the commodity information query of the to-be-accessed commodity object is not hit, obtaining commodity bottom-up data corresponding to the to-be-accessed commodity object; the commodity bottom-up data is basic data pre-stored for representing commodity characteristics; Displaying the commodity bottom-up data in a display area of the commodity information corresponding to the to-be-accessed commodity object.

6. The method of claim 1, wherein, The method further comprises: In the case that it is detected that the information of any commodity object in the distributed storage system is changed, updating version mapping information corresponding to the any commodity object; the version mapping information comprises an identification of a change node and a version number of the any commodity object; the change node is a network node in which the information change occurs; Triggering a broadcast change event based on the updated version mapping information; the broadcast change event is used for broadcasting the version mapping information and commodity identification corresponding to the any commodity object to a to-be-broadcast node; the to-be-broadcast node is a network node other than the change node in the distributed storage system.

7. The method of claim 6, wherein, The method further comprises: In the case that it is detected that a broadcast-received version number received by the any node is later than a local version number, setting commodity information of a commodity object corresponding to the local version number to an invalid state; The broadcast-received version number is a version number received through broadcasting, the local version number is a version number stored in a local cache area of the any node, and the broadcast-received version number and the local version number are version numbers corresponding to the same commodity object.

8. A caching device for information on popular products, characterized in that, The apparatus comprises: A commodity access request obtaining module is configured to obtain, for any node of network nodes of a distributed storage system, a commodity access request reaching the any node in a current time period; the current time period is a time period used for representing a recent access status of the any node, and the commodity access request is a network request used for accessing a commodity object to obtain corresponding commodity information; A hot commodity object identifying module is configured to identify, from commodity objects, a hot commodity object corresponding to the any node according to a frequency of each commodity access request in the current time period; the hot commodity object is a commodity object frequently accessed in the current time period; A hot commodity information migrating module is configured to migrate commodity information associated with the hot commodity object from the distributed storage system to a local cache area corresponding to the any node; the local cache area is used for directly returning commodity information of the hot commodity object when the hot commodity object is accessed in the any node.

9. A caching device for information on popular products, characterized in that, The apparatus comprises: At least one processor, a memory; The memory is configured to store program code, and the processor is configured to invoke the program code stored in the memory to execute the method in any one of claims 1 to 7.

10. A computer storage medium, characterized in that, It comprises instructions that, when executed on a computer, cause the computer to perform the method in any one of claims 1 to 7.