Data cache optimization method and device, electronic equipment and storage medium

By building user behavior models and dynamically adjusting prefetching strategies, the problem of mismatch between prefetched resources and actual needs was solved, improving the loading efficiency and interactive smoothness of web applications.

CN121579385APending Publication Date: 2026-02-27CHINA UNICOM ONLINE INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511524188.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-23
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

In existing technologies, prefetching technology lacks user behavior modeling, which leads to a mismatch between prefetched resources and actual user needs, resulting in bandwidth waste and crowding out critical resource loading channels, affecting the loading efficiency and smoothness of web applications.

Method used

By collecting multi-dimensional user behavior data, a user behavior model is built, a prefetch resource list is generated, and browser caching is performed based on resource dependencies and priorities. Cached resources are called first, and when a resource is not cached, the prefetch quantity and lazy loading trigger quantity are dynamically adjusted according to the loading progress and network status.

Benefits of technology

It improved resource loading efficiency, reduced bandwidth waste, ensured critical resource loading channels, and enhanced the smoothness of web application interaction and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121579385A_ABST
    Figure CN121579385A_ABST
Patent Text Reader

Abstract

The invention discloses a data caching optimization method and device, electronic equipment and a storage medium, and belongs to the technical field of data processing. According to the data caching optimization method and device, a model can be constructed based on multi-dimensional user behavior data to predict a target resource subsequently accessed by a user, and a prefetching list matched with an actual demand is generated and cached in combination with a resource dependency relationship and a priority; when the loading condition is met, the cache resource is preferentially called, and when the cache resource is not hit, the prefetching quantity and the lazy loading advance can be dynamically adjusted according to the loading progress, the network state and the like, so that blind prefetching is avoided; the technical problems that due to the fact that an existing prefetching technology lacks user behavior modeling, prefetching resources are not matched with actual requirements, bandwidth is wasted, key resource channels are occupied, and Web application loading efficiency and interaction fluency are affected can be solved. The technical effects of improving the resource loading efficiency, reducing the bandwidth waste, guaranteeing the key resource loading channel, enhancing the Web application interaction fluency and optimizing the user experience are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing technology, and in particular to an optimization method and apparatus for data caching, electronic equipment, and storage medium. Background Technology

[0002] Web front-end performance optimization, as a core technology for improving user experience, is widely used in high-frequency interaction scenarios such as e-commerce and news. With the increasing complexity and richness of web application functions and content, resource loading efficiency has become a key bottleneck restricting performance.

[0003] Among related technologies, prefetching technology lacks user behavior modeling, resulting in a mismatch between prefetched resources and actual user needs. This leads to bandwidth waste and may crowd out critical resource loading channels, thereby affecting the loading efficiency and smoothness of web applications. Summary of the Invention

[0004] This disclosure provides a method, apparatus, electronic device, and storage medium for optimizing data caching. Its main purpose is to address the problem of bandwidth waste that may congest critical resource loading channels, thereby affecting the loading efficiency and interactive smoothness of web applications.

[0005] According to a first aspect of this disclosure, an optimization method for data caching is provided, comprising: Collect multi-dimensional user behavior data and construct a user behavior model based on the user behavior data; wherein, the user behavior model is used to predict the target resources that users will visit in the future; Based on the prediction results of the user behavior model, page resource dependencies, and resource priorities, a prefetch resource list is generated, and the resources in the prefetch resource list are cached in the browser. In response to a page element meeting the loading trigger condition, the page element is rendered by first calling the prefetched resources in the browser cache; If the prefetched resources are not found, the number of prefetched resources and the lazy loading trigger advance are dynamically allocated based on the page loading progress, network status parameters, and the user behavior model.

[0006] Optionally, the collection of multi-dimensional user behavior data and the construction of a user behavior model based on the user behavior data include: Based on preset monitoring codes, the system collects user page dwell time, click operation sequence and page scrolling trend data in real time to form a multi-dimensional user behavior dataset. Feature extraction and user behavior pattern recognition are performed on the user behavior dataset to generate the user behavior model, which includes user interest tags and page browsing path prediction results.

[0007] Optionally, the step of generating a prefetch resource list by combining the prediction results of the user behavior model, page resource dependencies, and resource priorities, and caching the resources in the prefetch resource list in the browser includes: Based on the preset resource priority division rules, page resources are divided into core resources for the first screen and extended resources for the non-first screen. The core resources for the first screen include the basic page style file, the core script file and the first screen display image, and the prefetching priority of the core resources for the first screen is higher than that of the extended resources for the non-first screen. The server-side pre-rendering technology is used to generate dynamic resources with high access probability predicted by the user behavior model in advance, and the dynamic resources are cached to the content delivery network node through a message queue. Then, a complete list of prefetched resources is generated by combining the dynamic resources with static resources.

[0008] Optionally, the step of rendering the page element by preferentially calling the prefetched resources in the browser cache in response to the page element meeting the loading trigger condition includes: Establish a cache call priority rule, in which the call priority of prefetched resources in the browser cache is higher than that of historical cached resources.

[0009] Optionally, if the prefetched resources are not found, dynamically allocating the number of prefetched resources and the lazy loading trigger advance based on the page loading progress, network status parameters, and the user behavior model includes: The CPU utilization and memory usage of the user equipment are obtained, and a weighted scoring algorithm is used to convert the network status parameters into resource allocation coefficients. The threshold for the number of prefetched resources is determined based on the resource allocation coefficients. The network status parameters include bandwidth parameters and network packet loss rate. When it is detected that the current time period is a peak user access period and the page loading progress exceeds the preset threshold, the lazy loading trigger advance will be extended to the time when the page element is far from the visible area.

[0010] Optionally, the method further includes: Set differentiated cache expiration times based on the frequency of resource changes; the cache expiration time for static style resources is different from that for dynamic data resources. Establish a cross-page cache sharing mechanism to mark shared resources used by multiple pages; when performing cache cleanup operations, prioritize retaining shared resources marked with the shared tag.

[0011] According to a second aspect of this disclosure, an optimization apparatus for data caching is provided, comprising: The data acquisition unit is used to collect multi-dimensional user behavior data and construct a user behavior model based on the user behavior data; wherein, the user behavior model is used to predict the target resources that the user will visit in the future. The generation unit is used to combine the prediction results of the user behavior model, page resource dependencies and resource priorities to generate a prefetch resource list, and cache the resources in the prefetch resource list in the browser. The calling unit is used to render the page element by preferentially calling the prefetched resources in the browser cache in response to the page element meeting the loading trigger condition; The allocation unit is used to dynamically allocate the number of prefetched resources and the lazy loading trigger advance based on the page loading progress, network status parameters and the user behavior model if the prefetched resources are not hit.

[0012] Optionally, the acquisition unit is further configured to: Based on preset monitoring codes, the system collects user page dwell time, click operation sequence and page scrolling trend data in real time to form a multi-dimensional user behavior dataset. Feature extraction and user behavior pattern recognition are performed on the user behavior dataset to generate the user behavior model, which includes user interest tags and page browsing path prediction results.

[0013] Optionally, the generation unit is further configured to: Based on the preset resource priority division rules, page resources are divided into core resources for the first screen and extended resources for the non-first screen. The core resources for the first screen include the basic page style file, the core script file and the first screen display image, and the prefetching priority of the core resources for the first screen is higher than that of the extended resources for the non-first screen. The server-side pre-rendering technology is used to generate dynamic resources with high access probability predicted by the user behavior model in advance, and the dynamic resources are cached to the content delivery network node through a message queue. Then, a complete list of prefetched resources is generated by combining the dynamic resources with static resources.

[0014] Optionally, the calling unit is further configured to: Establish a cache call priority rule, in which the call priority of prefetched resources in the browser cache is higher than that of historical cached resources.

[0015] Optionally, the allocation unit is further configured to: The CPU utilization and memory usage of the user equipment are obtained, and a weighted scoring algorithm is used to convert the network status parameters into resource allocation coefficients. The threshold for the number of prefetched resources is determined based on the resource allocation coefficients. The network status parameters include bandwidth parameters and network packet loss rate. When it is detected that the current time period is a peak user access period and the page loading progress exceeds the preset threshold, the lazy loading trigger advance will be extended to the time when the page element is far from the visible area.

[0016] Optionally, the device further includes: The setting unit is used to set differentiated cache expiration times based on the frequency of resource changes; the cache expiration time for static style resources is different from that for dynamic data resources. A setup unit is used to establish a cross-page cache sharing mechanism and mark shared resources shared by multiple pages; wherein, when performing cache cleanup operations, shared resources marked with the shared tag are preferentially retained.

[0017] According to a third aspect of this disclosure, an electronic device is provided, comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect above.

[0018] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method described in the first aspect above.

[0019] According to a fifth aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method described in the first aspect above.

[0020] The data caching optimization method, apparatus, electronic device, and storage medium disclosed herein, through this application, can predict the target resources accessed by users in the future by building a model based on multi-dimensional user behavior data, generate a prefetch list that matches actual needs by combining resource dependencies and priorities, and cache it. When the loading conditions are met, cached resources are called first. When a resource is not hit, the number of prefetched resources and the lazy loading advance can be dynamically adjusted according to loading progress, network status, etc., to avoid blind prefetching. Therefore, it can solve the technical problems of existing prefetching technologies, such as mismatch between prefetched resources and actual needs, bandwidth waste, and occupation of critical resource channels, which affect the loading efficiency and interactive smoothness of web applications due to the lack of user behavior modeling. It achieves the technical effects of improving resource loading efficiency, reducing bandwidth waste, ensuring critical resource loading channels, enhancing the interactive smoothness of web applications, and optimizing user experience.

[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0022] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein: Figure 1 A flowchart illustrating an optimization method for data caching provided in an embodiment of this disclosure; Figure 2 A schematic diagram of an optimized data caching architecture provided in an embodiment of this application; Figure 3 A schematic diagram of another optimized data caching architecture provided in an embodiment of this application; Figure 4 A schematic diagram of the structure of a data caching optimization device provided in an embodiment of this disclosure; Figure 5 A schematic diagram of another data caching optimization device provided in an embodiment of this disclosure; Figure 6 A schematic block diagram of an example electronic device provided for embodiments of this disclosure. Detailed Implementation

[0023] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0024] The following description, with reference to the accompanying drawings, outlines an optimization method, apparatus, electronic device, and storage medium for data caching according to embodiments of the present disclosure.

[0025] Figure 1 This is a flowchart illustrating an optimization method for data caching provided in an embodiment of this disclosure.

[0026] like Figure 1 As shown, the method includes the following steps: Step 101: Collect multi-dimensional user behavior data and construct a user behavior model based on the user behavior data; wherein, the user behavior model is used to predict the target resources that the user will visit in the future. In the process of optimizing web front-end performance, to accurately predict users' subsequent resource access, it is necessary to collect multi-dimensional user behavior data and build a user behavior model based on this data. This multi-dimensional user behavior data covers key interaction information during user browsing of web pages, including page dwell time (the time a user spends from entering a web page to leaving it) and click sequence (the order in which users click different elements on the page, such as product cards, links, and category tags). This data comprehensively reflects users' browsing habits and operational preferences.

[0027] Data collection is achieved by embedding monitoring code in the web front-end. This code captures the aforementioned multi-dimensional user behavior data in real time, ensuring data integrity and timeliness, and providing a reliable foundation for subsequent model building. After acquiring the multi-dimensional user behavior data, machine learning algorithms are used for in-depth analysis and processing. The algorithms uncover hidden patterns in user behavior within the data, such as user preferences for specific types of content and differences in browsing behavior at different times. This allows for the construction of a user behavior model that accurately represents user behavior characteristics. The core function of this user behavior model is to predict the target resources that users may access during subsequent web page browsing based on historical user behavior patterns. This provides precise guidance for subsequent resource pre-fetching operations, helping to reduce invalid resource pre-fetching and improve the targeting and efficiency of web front-end resource loading.

[0028] Step 102: Based on the prediction results of the user behavior model, page resource dependencies and resource priorities, generate a prefetch resource list and cache the resources in the prefetch resource list in the browser. In the web front-end resource prefetching process, in order to accurately determine the resources that need to be reserved in advance and complete local storage, it is necessary to generate a prefetched resource list by combining the prediction results of user behavior model, page resource dependencies and resource priorities, and then cache the resources in the list to the browser.

[0029] The predictions from the user behavior model provide a basis for prefetching direction. These results, derived from historical user behavior patterns, clearly identify the types of resources users are likely to access later, avoiding blindly expanding the prefetching scope. Page resource dependencies refer to the associated requirements between different web resources. For example, a product details page depends on specific script files, style sheets, and main image resources. Ignoring this relationship and prefetching only a single resource will result in additional network requests being made during subsequent page loads. Therefore, this relationship needs to be comprehensively analyzed to ensure that prefetched resources can support normal page display and functionality. Resource priority is determined based on the resource's impact on user experience. Core resources on the first screen, such as basic page layout styles and first-screen images, have higher priority than non-first-screen extended resources, such as product thumbnails not displayed in the sidebar. Prioritizing the prefetching of high-priority resources ensures that key content is presented quickly when users access the page.

[0030] Taking into account the above three factors, a prefetch resource list containing resources that users may need is formed through screening and integration. Then, using technologies such as HTTP / 2 server push or the link rel=preload tag, the resources in the list are pushed to the browser cache, so that the resources are stored in the local device in advance. This creates conditions for users to quickly call the resources when they access the corresponding pages, reduces network request latency and improves page response speed.

[0031] Step 103: In response to the page element meeting the loading trigger condition, the page element is rendered by preferentially calling the prefetched resources in the browser cache; During the loading process of web front-end page elements, it is necessary to respond to the situation where the page element meets the loading trigger conditions, and prioritize calling the prefetched resources in the browser cache to render the page element.

[0032] The determination of loading trigger conditions is usually based on the positional relationship between page elements and the browser's visible area. This can be achieved through the Intersection Observer API, which can detect in real time whether page elements have entered the visible area or are within a preset range of the visible area. It does not rely on traditional scroll event listeners, which can reduce the loss of front-end performance and ensure the accuracy and efficiency of trigger condition determination.

[0033] When a page element is detected to meet the loading trigger conditions, the browser cache is first searched to see if a prefetched resource corresponding to that page element exists. Prefetched resources are resources predicted based on user behavior models and pre-stored in the browser cache, covering various static resources required for page element rendering, such as images, scripts, and stylesheets. Prioritizing the use of these prefetched resources for rendering avoids re-initiating network requests, reduces the impact of network latency on page loading speed, and allows page elements to be presented to the user faster, improving the smoothness of the browsing experience. If the corresponding prefetched resource is not found in the browser cache, then the normal process is followed to initiate a network request to obtain the required resource, ensuring that the page element can be loaded and rendered normally, and ensuring that the user's operating experience is not affected.

[0034] Step 104: If the prefetched resources are not found, dynamically allocate the number of prefetched resources and the lazy loading trigger advance based on the page loading progress, network status parameters and the user behavior model.

[0035] During the loading of web front-end resources, when a prefetched resource is not found, the number of prefetched resources and the advance amount for lazy loading should be dynamically allocated based on the page loading progress, network status parameters, and user behavior model.

[0036] A prefetching resource miss occurs when the browser cache does not contain the corresponding prefetched resource for a page element that needs to be loaded. In this case, dynamic adjustments to the loading strategy are necessary to ensure loading efficiency. Page loading progress refers to the proportion of resources already loaded on the current web page out of the total resources required to be loaded, such as the completion status of core resources on the first screen. It reflects the overall loading pace of the current page and provides a basis for resource allocation. Network status parameters include network type, bandwidth, latency, and packet loss rate. Network types include Wi-Fi and mobile data. Bandwidth affects the data transmission capacity per unit time, and latency reflects the time difference between data requests and responses. These parameters directly determine the network environment's carrying capacity for resource loading. The user behavior model is built based on previously collected multi-dimensional user behavior data and can accurately reflect users' access preferences and potential needs.

[0037] In practice, if the page loads quickly and the network conditions are good (high bandwidth, low latency), and the user behavior model predicts that the user may access more resources, the number of prefetched resources can be appropriately increased, while the lazy loading trigger lead time can be shortened, allowing non-first-screen elements to enter the loading process earlier. If the page loads slowly or the network conditions are poor (low bandwidth, high latency), after determining the user's core resource needs based on the user behavior model, the number of prefetched resources can be reduced to avoid occupying limited bandwidth. At the same time, the lazy loading trigger lead time can be extended, and loading can only be started when the element is closer to the visible area. Through such dynamic adjustments, resource allocation and loading efficiency can be balanced in different loading scenarios to ensure a good user browsing experience.

[0038] In some embodiments, collecting multi-dimensional user behavior data and constructing a user behavior model based on the user behavior data includes: Based on preset monitoring codes, the system collects user page dwell time, click operation sequence and page scrolling trend data in real time to form a multi-dimensional user behavior dataset. Feature extraction and user behavior pattern recognition are performed on the user behavior dataset to generate the user behavior model, which includes user interest tags and page browsing path prediction results.

[0039] In the process of building a user behavior model to predict users' subsequent access to target resources, it is necessary to first collect multi-dimensional user behavior data based on preset monitoring code, and then process the data to complete the model construction.

[0040] The pre-installed monitoring code is deployed on the web frontend, enabling continuous and stable real-time capture of user interactions with web pages. This ensures that the collected data accurately and comprehensively reflects actual user behavior. The collected multi-dimensional user behavior data specifically includes page dwell time, click sequence, and page scrolling trend data. Page dwell time refers to the duration from when a user enters a web page to when they leave, directly reflecting their level of attention to the page content. Click sequence refers to the order in which users click different elements on the page, such as product links, category buttons, and details page entrances, clearly reflecting user interaction preferences. Page scrolling trend data records the user's scrolling speed, scrolling direction, and dwell time at different scrolling positions, helping to determine the user's interest in different areas of the page.

[0041] After collecting and forming a multi-dimensional user behavior dataset, feature extraction and user behavior pattern recognition operations need to be performed on the dataset. The feature extraction process selects representative behavioral features from the dataset, such as the types of elements that users frequently click, the average time users spend in specific content areas, and the probability of users scrolling to specific positions on the page. User behavior pattern recognition then conducts in-depth analysis of these extracted features to uncover the hidden patterns behind user behavior, such as users' preferences for certain types of content, differences in user browsing behavior between weekdays and weekends, and typical user operation paths when accessing pages.

[0042] The final product is a user behavior model that includes user interest tags and page browsing path prediction results. User interest tags can intuitively mark the content categories that users are interested in, while page browsing path prediction results can predict the order in which users may visit pages in the future, providing a clear direction for accurately determining the pre-fetched resources.

[0043] In some embodiments, generating a prefetch resource list by combining the prediction results of the user behavior model, page resource dependencies, and resource priorities, and caching the resources in the prefetch resource list in the browser includes: Based on the preset resource priority division rules, page resources are divided into core resources for the first screen and extended resources for the non-first screen. The core resources for the first screen include the basic page style file, the core script file and the first screen display image, and the prefetching priority of the core resources for the first screen is higher than that of the extended resources for the non-first screen. The server-side pre-rendering technology is used to generate dynamic resources with high access probability predicted by the user behavior model in advance, and the dynamic resources are cached to the content delivery network node through a message queue. Then, a complete list of prefetched resources is generated by combining the dynamic resources with static resources.

[0044] During the process of generating the prefetch resource list and caching the resources in the browser, page resources must first be categorized according to a preset resource priority classification rule to clarify the prefetch priority of different resources. This classification rule is based on the degree of impact of resources on the user's initial browsing experience, clearly dividing page resources into core resources for the first screen and extended resources for non-first screens.

[0045] The core resources on the first screen are crucial for ensuring that basic content and functions are quickly presented after the page loads for the first time. These include the basic page style file, which defines the page layout, font colors, and other visual presentation rules; core script files, which support page interaction logic such as button click responses, data loading and processing; and the first-screen display images, which are the images users see immediately upon opening the page without scrolling. Because these core resources directly determine the user's first impression and loading speed, their prefetching priority is significantly higher than that of non-first-screen extended resources. Non-first-screen extended resources are mostly content-related resources that users will encounter after scrolling, such as non-first-screen product images and sidebar auxiliary information.

[0046] After prioritizing resources, server-side pre-rendering technology is used to process dynamic resources with high access probability predicted by the user behavior model. Server-side pre-rendering technology can parse and generate the rendering results of dynamic resources in advance on the server side, avoiding the delay caused by real-time rendering on the client side when users access them. These dynamic resources include personalized recommendation data, limited-time event details, and other content that is highly relevant to individual user needs.

[0047] After dynamic resources are generated, they are efficiently cached on Content Delivery Network (CDN) nodes via a message queue. CDN nodes are widely distributed, significantly shortening resource transmission distances and improving subsequent retrieval speeds. The processed dynamic resources are then integrated with the page's required static resources, such as basic style files and fixed icons, to form a complete prefetch resource list covering potential user access needs. Finally, all resources in this list are pushed to the browser cache, laying the foundation for fast resource retrieval when users access the corresponding page later, reducing network request time.

[0048] In some embodiments, the step of rendering the page element by preferentially invoking prefetched resources in the browser cache in response to the page element meeting the loading trigger condition includes: Establish a cache call priority rule, in which the call priority of prefetched resources in the browser cache is higher than that of historical cached resources.

[0049] In the process of rendering page elements by calling resources when the loading trigger conditions are met, one of the core operations is to establish cache call priority rules, and it must be clearly stated that the priority of calling resources prefetched in the browser cache is higher than that of historical cached resources. The purpose of establishing cache call priority rules is to ensure that, when the browser cache stores various types of resources, resources that are more relevant to the user's current and subsequent access needs are called first, avoiding page loading delays caused by calling irrelevant or low-relevance resources, which would negatively impact the user experience.

[0050] Browser cached resources are mainly divided into two categories: prefetched resources and historical cached resources. Prefetched resources are resources that users are likely to access in the future, predicted by previously built user behavior models. By pushing these resources to the browser cache in advance, they are highly correlated with the user's recent browsing intentions and can directly meet the user's upcoming page element loading needs. Historical cached resources are resources that were temporarily stored in the browser cache when the user previously visited web pages due to the loading needs at that time. These resources may have a lower correlation with the user's current browsing goals, and some resources may even be no longer suitable for displaying the current page due to page content updates.

[0051] Based on the difference in relevance between the two and the user's current needs, when establishing cache call priority rules, the call priority of prefetched resources is set higher than that of historical cached resources. When a page element meets the loading trigger condition, the system will first search the browser cache for prefetched resources. If a prefetched resource matching the page element exists, it will be directly called for rendering, thereby quickly completing the page element loading, ensuring the smoothness of the user's browsing process, and effectively improving the loading response efficiency of the web front end.

[0052] In some embodiments, if the prefetched resources are not found, dynamically allocating the number of prefetched resources and the lazy loading trigger advance based on the page loading progress, network status parameters, and the user behavior model includes: The CPU utilization and memory usage of the user equipment are obtained, and a weighted scoring algorithm is used to convert the network status parameters into resource allocation coefficients. The threshold for the number of prefetched resources is determined based on the resource allocation coefficients. The network status parameters include bandwidth parameters and network packet loss rate. When it is detected that the current time period is a peak user access period and the page loading progress exceeds the preset threshold, the lazy loading trigger advance will be extended to the time when the page element is far from the visible area.

[0053] When a resource prefetch fails, it is necessary to first obtain the CPU utilization and memory usage of the user device. These two parameters directly reflect the current operating load of the device. CPU utilization reflects the device's workload in data processing; excessive utilization means the device is currently handling many tasks, and allocating too many prefetch resources at this time may cause the device to lag. Memory usage reflects the amount of available memory space on the device; high usage indicates that the device has limited remaining memory, which will affect the efficiency of temporary storage and retrieval of resources. Together, they provide a device-level basis for subsequent resource allocation.

[0054] Simultaneously, network status parameters are acquired, including bandwidth and packet loss rate. Bandwidth determines the amount of data the network can transmit per unit time; high bandwidth supports faster resource transmission, while low bandwidth necessitates controlling the transmission volume to avoid congestion. Packet loss rate represents the proportion of data lost during transmission; a high packet loss rate leads to unstable resource transmission, requiring adjustments to resource allocation strategies to ensure transmission reliability. A weighted scoring algorithm is then used to assign corresponding weights based on the impact of different network status parameters on resource allocation. For example, bandwidth, which has a greater impact on resource transmission speed, can be assigned a higher weight. The network status parameters are then converted into specific resource allocation coefficients, and these coefficients are used to determine the threshold for the number of prefetched resources, ensuring that the prefetch quantity is compatible with the network's carrying capacity.

[0055] When it is detected that the current time period is a peak user access period, the overall server and network load is high, and the page loading progress exceeds the preset threshold, indicating that the core content of the page has been basically presented. In order to avoid subsequent loading operations interfering with the current page browsing experience, the lazy loading trigger advance is extended to a specific range between the page elements and the visible area, so that the page elements are closer to the visible area before loading starts. This balances resource loading efficiency and the stability of the current page operation, ensuring that users can have a smooth browsing experience even during peak hours.

[0056] In some embodiments, the method further includes: Set differentiated cache expiration times based on the frequency of resource changes; the cache expiration time for static style resources is different from that for dynamic data resources. Establish a cross-page cache sharing mechanism to mark shared resources used by multiple pages; when performing cache cleanup operations, prioritize retaining shared resources marked with the shared tag.

[0057] In web front-end cache management, to ensure the timeliness and reuse efficiency of cached resources, it is necessary to set differentiated cache expiration times based on the frequency of resource changes, and at the same time establish a cross-page cache sharing mechanism. Setting differentiated cache expiration times based on resource change frequency is because different types of resources have significantly different update frequencies in web applications. Static style resources, such as CSS files defining page layout, font colors, etc., have a longer content update cycle, usually only changing when the overall page style is adjusted; therefore, the cache expiration time for these resources is set to be longer. Dynamic data resources, such as real-time product prices and personalized recommendation lists, have content that is frequently updated according to business needs such as promotional activities and user behavior changes. If the cache expiration time is too long, users may obtain outdated information; therefore, the cache expiration time for these resources is set to be shorter. This differentiated setting ensures that cached resources are neither outdated nor fail to fully utilize their caching function.

[0058] A cross-page cache sharing mechanism is established. Common resources used by multiple pages in a web application, such as general stylesheets and basic interactive scripts, are marked as shared. This ensures that these resources can be accessed when different pages load, avoiding duplicate caching and consuming storage space. When performing cache cleanup operations, the system prioritizes retaining common resources marked with the shared tag because these resources have high reuse rates. Retaining them reduces network requests during subsequent page loads, further improving web front-end performance and ensuring a smooth browsing experience for users.

[0059] The following example illustrates the data caching optimization method provided in the embodiments of this application.

[0060] The Web front-end performance improvement system based on cache prefetching and lazy loading provided by this invention consists of five core modules: a cache prefetching module, a lazy loading module, a cache management module, a collaborative control module, and a network status awareness module. These modules work collaboratively through data interaction. The overall architecture is as follows: Figure 2 As shown, Figure 2 This is a schematic diagram of an optimized data caching architecture provided in an embodiment of this application.

[0061] (II) Functions of Core Modules and Sub-modules Cache prefetch module This module is used for accurately prefetching resources based on user behavior analysis and storing them in the cache. It contains three sub-modules. Please refer to [link / reference]. Figure 3 , Figure 3 A schematic diagram of another optimized data caching architecture provided in this application embodiment: User behavior analysis submodule: Collects user browsing behavior data (page dwell time, click sequence, etc.) by embedding monitoring code, and uses machine learning algorithms to build user behavior models to identify potential user needs; Resource prefetching decision submodule: Combines user behavior model, page resource dependencies (such as scripts and main images that the details page depends on) and resource priority (core resources on the first screen > extended resources on the non-first screen) to generate a list of prefetched resources; Prefetch execution submodule: uses HTTP / 2 server push technology or<linkrel="preload"> Static resources are pushed to the browser cache; dynamic resources (such as personalized recommendation data) are generated and cached on the server before being pushed.

[0062] Lazy loading module It is used for lazy loading of non-critical resources and linked to caching, and contains 2 sub-modules: The visible area monitoring submodule uses the Intersection Observer API to monitor in real time whether page elements enter the visible area, serving as the basis for loading triggers; Loading Timing Optimization Submodule: Combining page loading status, user operations (such as scrolling trends), and monitoring data (bandwidth, latency, etc.) from the network status awareness module, optimize loading timing (e.g., load 500ms earlier on strong networks, and delay until elements are fully visible on weak networks), and prioritize calling prefetched or historical cached resources from the cache management module.

[0063] Cache management module It is used for efficient management of cached resources and contains two sub-modules: Cache update strategy submodule: Update the cache in a timely manner when server resources change through message push or resource version number check; set differentiated expiration time according to the frequency of resource changes (static style resources > dynamic data resources, media resources > script resources). Cache sharing and cleanup submodule: Establishes a cross-page cache sharing mechanism (such as style sheets shared by multiple pages) to achieve reuse of common resources; regularly cleans up caches that have not been used for a long time to free up space.

[0064] Collaborative control module It is used for scheduling and optimizing prefetching and lazy loading strategies, and contains two sub-modules: The collaborative scheduling submodule dynamically allocates tasks based on page loading progress, user behavior models, resource priorities, and network status data (e.g., reducing prefetching and extending lazy loading trigger lead time in weak network conditions; increasing prefetching and shortening trigger lead time in strong network conditions). Feedback and Adjustment Submodule: Collect user feedback (such as loading experience rating) and system metrics (prefetch hit rate, cache reuse rate), and optimize strategy parameters through A / B testing (such as solidifying the "strong network prefetch 5 high-probability resources" template).

[0065] Network Status Awareness Module The system monitors user devices' network type, bandwidth, latency, and packet loss rate in real time and synchronizes these parameters to the collaborative control module, providing environmental data support for policy adjustments.

[0066] (III) Example: Product browsing scenario on an e-commerce platform Taking a user browsing the "Summer Dresses" category page as an example, the system collaboration process is as follows: The network status awareness module detects that the user is on a strong network (8Mbps Wi-Fi) and synchronizes the data to the collaborative control module. Cache prefetching module: The user behavior analysis submodule identifies users' preferences for products tagged "slimming" and predicts, based on historical data, that they are likely to view the 5th product detail and matching recommendations; the resource prefetching decision submodule generates a prefetching list (the product detail image, the detail page script, and the matching recommendation image); the prefetching execution submodule pushes the resources to the cache; Lazy loading module: The visible area monitoring submodule detects that the product card after the 10th item has not entered the visible area; when the user scrolls to within 20% of these cards, the loading timing optimization submodule calls the existing product thumbnail of the 12th item in the cache (which the user viewed yesterday) and renders it directly, and loads the uncached product video of the 15th item 500ms in advance; Cache Management Module: Upon detecting that the price of the 5th product has been adjusted due to a limited-time discount, the Cache Update Strategy Submodule immediately updates the price cache; the Cache Sharing and Cleanup Submodule marks shared stylesheets as shared resources and cleans up winter product images that have not been accessed for 30 days. Collaborative Control Module: The collaborative scheduling submodule commands additionally prefetch two high-probability product resources; the feedback adjustment submodule solidifies the strong network prefetching strategy through A / B testing and automatically activates it during the nighttime active period.

[0067] Corresponding to the data caching optimization method described above, this invention also proposes a data caching optimization apparatus. Since the apparatus embodiments of this invention correspond to the method embodiments described above, details not disclosed in the apparatus embodiments can be referred to in the method embodiments described above, and will not be repeated here.

[0068] Figure 4 A schematic diagram of the structure of an optimization device for data caching provided in an embodiment of this disclosure is shown below. Figure 4 As shown, it includes: The data acquisition unit 21 is used to collect multi-dimensional user behavior data and construct a user behavior model based on the user behavior data; wherein, the user behavior model is used to predict the target resources that the user will visit in the future. The generation unit 22 is used to combine the prediction results of the user behavior model, page resource dependencies and resource priorities to generate a prefetch resource list, and cache the resources in the prefetch resource list in the browser. Calling unit 23 is used to render the page element by preferentially calling the prefetched resources in the browser cache in response to the page element meeting the loading trigger condition; The allocation unit 24 is used to dynamically allocate the number of prefetched resources and the lazy loading trigger advance based on the page loading progress, network status parameters and the user behavior model if the prefetched resources are not hit.

[0069] Furthermore, in one possible implementation of this disclosure, the acquisition unit 21 is further configured to: Based on preset monitoring codes, the system collects user page dwell time, click operation sequence and page scrolling trend data in real time to form a multi-dimensional user behavior dataset. Feature extraction and user behavior pattern recognition are performed on the user behavior dataset to generate the user behavior model, which includes user interest tags and page browsing path prediction results.

[0070] Furthermore, in one possible implementation of this disclosure embodiment, the generation unit 22 is further configured to: Based on the preset resource priority division rules, page resources are divided into core resources for the first screen and extended resources for the non-first screen. The core resources for the first screen include the basic page style file, the core script file and the first screen display image, and the prefetching priority of the core resources for the first screen is higher than that of the extended resources for the non-first screen. The server-side pre-rendering technology is used to generate dynamic resources with high access probability predicted by the user behavior model in advance, and the dynamic resources are cached to the content delivery network node through a message queue. Then, a complete list of prefetched resources is generated by combining the dynamic resources with static resources.

[0071] Furthermore, in one possible implementation of this disclosure, the calling unit 23 is further configured to: Establish a cache call priority rule, in which the call priority of prefetched resources in the browser cache is higher than that of historical cached resources.

[0072] Furthermore, in one possible implementation of this disclosure, the allocation unit 24 is further configured to: The CPU utilization and memory usage of the user equipment are obtained, and a weighted scoring algorithm is used to convert the network status parameters into resource allocation coefficients. The threshold for the number of prefetched resources is determined based on the resource allocation coefficients. The network status parameters include bandwidth parameters and network packet loss rate. When it is detected that the current time period is a peak user access period and the page loading progress exceeds the preset threshold, the lazy loading trigger advance will be extended to the time when the page element is far from the visible area.

[0073] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 5As shown, the device further includes: Setting unit 25 is used to set differentiated cache expiration time according to the frequency of resource changes; wherein, the cache expiration time of static style resources is different from the cache expiration time of dynamic data resources; Establishment unit 26 is used to establish a cross-page cache sharing mechanism to mark shared public resources shared by multiple pages; wherein, when performing cache cleanup operations, public resources with the aforementioned shared mark are preferentially retained.

[0074] It should be noted that the foregoing explanation of the method embodiments also applies to the apparatus of the embodiments of this disclosure, and the principle is the same. Therefore, the embodiments of this disclosure are not limited thereto.

[0075] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0076] Figure 6 A schematic block diagram of an example electronic device 400 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0077] like Figure 6 As shown, device 400 includes a computing unit 401, which can perform various appropriate actions and processes based on a computer program stored in ROM (Read-Only Memory) 402 or a computer program loaded from storage unit 408 into RAM (Random Access Memory) 403. RAM 403 may also store various programs and data required for the operation of device 400. The computing unit 401, ROM 402, and RAM 403 are interconnected via bus 404. I / O (Input / Output) interface 405 is also connected to bus 404.

[0078] Multiple components in device 400 are connected to I / O interface 405, including: input unit 406, such as keyboard, mouse, etc.; output unit 407, such as various types of monitors, speakers, etc.; storage unit 408, such as disk, optical disk, etc.; and communication unit 409, such as network card, modem, wireless transceiver, etc. Communication unit 409 allows device 400 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0079] The computing unit 401 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, CPUs (Central Processing Units), GPUs (Graphics Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSPs (Digital Signal Processors), and any suitable processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above, such as data caching optimization methods. For example, in some embodiments, the data caching optimization methods may be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on device 400 via ROM 402 and / or communication unit 409. When the computer program is loaded into RAM 403 and executed by the computing unit 401, one or more steps of the methods described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the aforementioned data caching optimization method by any other suitable means (e.g., by means of firmware).

[0080] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System-on-Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0081] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0082] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0083] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0084] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include LANs (Local Area Networks), WANs (Wide Area Networks), the Internet, and blockchain networks.

[0085] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.

[0086] It's important to note that artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.

[0087] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0088] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. An optimization method for data caching, characterized in that, include: Collect multi-dimensional user behavior data and construct a user behavior model based on the user behavior data; wherein, the user behavior model is used to predict the target resources that users will visit in the future; Based on the prediction results of the user behavior model, page resource dependencies, and resource priorities, a prefetch resource list is generated, and the resources in the prefetch resource list are cached in the browser. In response to a page element meeting the loading trigger condition, the page element is rendered by first calling the prefetched resources in the browser cache; If the prefetched resources are not found, the number of prefetched resources and the lazy loading trigger advance are dynamically allocated based on the page loading progress, network status parameters, and the user behavior model.

2. The method according to claim 1, characterized in that, The process of collecting multi-dimensional user behavior data and constructing a user behavior model based on the user behavior data includes: Based on preset monitoring codes, the system collects user page dwell time, click operation sequence and page scrolling trend data in real time to form a multi-dimensional user behavior dataset. Feature extraction and user behavior pattern recognition are performed on the user behavior dataset to generate the user behavior model, which includes user interest tags and page browsing path prediction results.

3. The method according to claim 1, characterized in that, The step of generating a prefetch resource list by combining the prediction results of the user behavior model, page resource dependencies, and resource priorities, and caching the resources in the prefetch resource list in the browser includes: Based on the preset resource priority division rules, page resources are divided into core resources for the first screen and extended resources for the non-first screen. The core resources for the first screen include the basic page style file, the core script file and the first screen display image, and the prefetching priority of the core resources for the first screen is higher than that of the extended resources for the non-first screen. The server-side pre-rendering technology is used to generate dynamic resources with high access probability predicted by the user behavior model in advance, and the dynamic resources are cached to the content delivery network node through a message queue. Then, a complete list of prefetched resources is generated by combining the dynamic resources with static resources.

4. The method according to claim 1, characterized in that, The step of rendering the page element by preferentially calling the prefetched resources in the browser cache in response to the page element meeting the loading trigger condition includes: Establish a cache call priority rule, in which the call priority of prefetched resources in the browser cache is higher than that of historical cached resources.

5. The method according to claim 1, characterized in that, If the prefetched resources are not found, the dynamic allocation of the prefetched resource quantity and lazy loading trigger advance based on the page loading progress, network status parameters, and the user behavior model includes: The CPU utilization and memory usage of the user equipment are obtained, and a weighted scoring algorithm is used to convert the network status parameters into resource allocation coefficients. The threshold for the number of prefetched resources is determined based on the resource allocation coefficients. The network status parameters include bandwidth parameters and network packet loss rate. When it is detected that the current time period is a peak user access period and the page loading progress exceeds the preset threshold, the lazy loading trigger advance will be extended to the time when the page element is far from the visible area.

6. The method according to claim 1, characterized in that, The method further includes: Set differentiated cache expiration times based on the frequency of resource changes; the cache expiration time for static style resources is different from that for dynamic data resources. Establish a cross-page cache sharing mechanism to mark shared resources used by multiple pages; when performing cache cleanup operations, prioritize retaining shared resources marked with the shared tag.

7. An optimization device for data caching, characterized in that, include: The data acquisition unit is used to collect multi-dimensional user behavior data and construct a user behavior model based on the user behavior data; wherein, the user behavior model is used to predict the target resources that the user will visit in the future. The generation unit is used to combine the prediction results of the user behavior model, page resource dependencies and resource priorities to generate a prefetch resource list, and cache the resources in the prefetch resource list in the browser. The calling unit is used to render the page element by preferentially calling the prefetched resources in the browser cache in response to the page element meeting the loading trigger condition; The allocation unit is used to dynamically allocate the number of prefetched resources and the lazy loading trigger advance based on the page loading progress, network status parameters and the user behavior model if the prefetched resources are not hit.

8. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.

9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.

10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.