A dynamic cache management method for optimizing real-time search performance
By setting fixed and variable storage amounts in the dynamic cache and optimizing cache management based on the search efficiency curve, the problem of inability to flexibly adjust the retained data amount in the existing technology is solved, and real-time search performance and user experience are improved.
Patent Information
- Application Number
- CN202510207175.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2045-02-25
AI Technical Summary
The existing dynamic cache management methods cannot flexibly adjust the amount of data retained, resulting in poor real-time search performance and affecting user search efficiency.
By setting fixed storage and variable storage in the dynamic cache, cache management is optimized based on the search efficiency curve, and cache content is dynamically adjusted to retain data that users pay attention to.
Improves user search efficiency, ensures that users are not affected by real-time search performance when returning important data, and improves the utilization rate of dynamic cache.
Smart Images

Figure CN120086156B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of dynamic cache technology, and in particular to a dynamic cache management method for optimizing real-time search performance. Background Art
[0002] Dynamic caching is a technology used to store data that changes frequently during user access but does not need to be retrieved from the server every time. This data can be HTML snippets, images, JavaScript files, or other types of resources. With dynamic caching, when a user requests the same or similar content again, the system can read it directly from the cache without having to perform complex calculations or database queries again, thereby greatly improving response speed and user experience.
[0003] Existing methods for dynamic cache management generally analyze multiple channels that use dynamic cache, obtain cache allocation parameters based on the demand for dynamic cache by each channel, and allocate dynamic cache based on the cache allocation parameters when allocating cache to multiple resource channels, so that each resource channel can effectively utilize the dynamic cache. Although this improved method can improve the utilization rate of dynamic cache in multiple resource channels, it can only allocate a fixed dynamic cache to each resource channel based on the cache allocation parameters after multiple resource channels issue a demand for dynamic cache. It cannot retain data that users focus on in the dynamic cache, and it cannot flexibly adjust the amount of data retained in the dynamic cache. As a result, when users browse a large amount of data, the dynamic cache retains a large amount of data, which affects real-time search performance. As a result, when users return to the data they focus on, the real-time search performance is poor, which affects the user's search efficiency. For example, in a patent application with publication number CN118656313A, a multi-channel dynamic cache management method, system, device and medium thereof are disclosed. This solution is to control the allocator to periodically allocate cache resources to each resource processing channel and control the corresponding resource processing channel to work periodically according to cache allocation parameters, resource application scenarios and each channel working relationship index. Other improvements for dynamic cache management are usually improvements in saving resources, but they still cannot retain the data that users focus on in the dynamic cache, and cannot flexibly adjust the amount of data retained in the dynamic cache. As a result, when users browse a large amount of data, the dynamic cache retains more data, which affects the real-time search performance. As a result, when users revisit the data they focus on, the real-time search performance is poor, which affects the user's search efficiency. In view of this, it is necessary to improve the existing dynamic cache management method. Summary of the Invention
[0004] The present invention aims to solve, at least to a certain extent, one of the technical problems in the prior art by proposing a dynamic cache management method for optimizing real-time search performance. The method is used to solve the problem in the existing dynamic cache management method that the data that the user focuses on in the dynamic cache cannot be retained, and the amount of data retained in the dynamic cache cannot be flexibly adjusted. As a result, when the user browses a large amount of data, the dynamic cache retains a large amount of data, which affects the real-time search performance. As a result, when the user revisits the data that the user focuses on, the real-time search performance is poor, which affects the user's search efficiency.
[0005] To achieve the above objectives, the present application provides a dynamic cache management method for optimizing real-time search performance, comprising the following steps:
[0006] Storing resources of different storage amounts in a dynamic cache, and obtaining a search efficiency curve of a real-time search when the dynamic cache contains resources of different storage amounts;
[0007] Obtain memory usage based on the search efficiency curve; set fixed storage capacity and variable storage capacity in the dynamic cache based on the memory usage;
[0008] When searching in real time, fixed cache content is set in the dynamic cache based on the searched content and the fixed storage amount, and variable storage space is set based on the searched content and the variable storage amount.
[0009] Furthermore, when resources with different storage capacities are stored in the dynamic cache, and the search efficiency curve for real-time search is obtained when the dynamic cache contains resources with different storage capacities, the search efficiency curve includes:
[0010] The total amount of resources that can be stored in the dynamic cache is recorded as the total storage capacity; multiple data that can be stored in the dynamic cache are obtained, and based on the size of the resource space occupied by each data, they are recorded in order from small to large as storable data KC1 to storable data KC n , where data KC can be stored n The resource space occupied is less than or equal to the total storage capacity;
[0011] Get storable data KC1 to storable data KC n All combinations that can be stored in the dynamic cache are recorded as storage combinations; the size of the resource space occupied by all storable data KC in each storage combination is recorded as the combined occupied space of the storage combination;
[0012] Based on the size of the combined space occupied by all storage combinations, all storage combinations are recorded from small to large as storage combination CZ1 to storage combination CZ m ;
[0013] The dynamic storage analysis method is used to obtain the storage resource amount corresponding to the combined occupied space of all storage combinations CZ, and the search efficiency curve corresponding to each storage resource amount is obtained.
[0014] Furthermore, the dynamic storage analysis method includes:
[0015] Establish a plane rectangular coordinate system, recorded as the occupancy analysis coordinate system, where the unit of the Y axis of the occupancy analysis coordinate system is byte, and the coordinate points on the X axis from the coordinate origin to the right are filled with storable data KC1 to storable data KC n For any storable data KC, the coordinate point corresponding to X = storable data KC, Y = the size of the resource space occupied by the storable data KC is recorded as the occupied point of the storable data KC;
[0016] Obtain all occupied points corresponding to the storable data KC, and record the curve obtained by fitting all occupied points as the occupancy analysis curve; n The size of the resource space occupied is recorded as Y0, and the vertical coordinate of the point with the largest slope from Y=0 to Y=Y0 / 2 in the occupation analysis curve is marked as Y min .
[0017] Furthermore, the dynamic storage analysis method also includes:
[0018] Sequentially perform the following operations on the storage combination CZ1 to storage combination CZ that do not contain storage resources: m The combined fusion method is used for analysis; the combined fusion method is: the storage combination CZ to be analyzed is recorded as the storage combination CZ c , where c is a positive integer less than or equal to m and greater than or equal to 1; store the combination CZ c The combined space occupied by is recorded as Y1, and [Y1-Y min ,Y1+Y min ] is recorded as storage combination CZ c The fusion interval;
[0019] When removing the storage combination CZ c Any combination of storage combinations other than CZ occupies space in storage combination CZ c When the fusion interval is within the range, the combined space is in the storage combination CZ c Within the fusion range and except for storage combination CZ c Storage combinations other than CZ are recorded as storage combination CZ c The combination to be merged; store the combination CZ c The average of the combined space occupied by the combination of and all the combined spaces to be fused is recorded as the storage combination CZ c With storage combination CZ c The storage resource amount of all combinations to be merged.
[0020] Furthermore, the dynamic storage analysis method also includes:
[0021] When removing the storage combination CZ c All storage combinations other than CZ are not in the storage combination CZ c When the fusion range is within the range, the combination CZ will be stored c The combined space occupied by the storage combination CZ c The amount of storage resources;
[0022] The storage resource amount of all storage combinations CZ is obtained based on the combination fusion method.
[0023] Furthermore, the dynamic storage analysis method also includes:
[0024] For any amount of storage resources, data of the same size as the amount of storage resources is stored in the dynamic cache, and any term is searched using the search engine where the dynamic cache is located; a plane rectangular coordinate system is established, recorded as the search analysis coordinate system, wherein the unit of the X-axis of the search analysis coordinate system is time, and the Y-axis is a constant axis; based on the relationship between the time after searching for any term by the search engine where the dynamic cache is located and the number of resources obtained by the search, a corresponding curve is drawn in the search analysis coordinate system, and recorded as the search efficiency curve of the storage resource amount.
[0025] Furthermore, obtaining a memory usage based on the search efficiency curve; and setting a fixed storage capacity and a variable storage capacity in the dynamic cache based on the memory usage includes:
[0026] Establish a plane rectangular coordinate system, recorded as a multi-curve screening coordinate system, where the X-axis unit of the multi-curve screening coordinate system is time and the Y-axis is a constant axis; place all search efficiency curves in the multi-curve screening coordinate system, and record the point with the maximum slope of all search efficiency curves as the efficient search point of the search efficiency curve;
[0027] The average value of the horizontal coordinates of all efficient search points is recorded as the average efficient time; the straight line obtained by fitting all search efficiency curves is recorded as the comprehensive efficiency straight line; the straight line obtained by fitting each search efficiency curve is recorded as the fitted efficiency straight line of the search efficiency curve;
[0028] Use the occupancy analysis algorithm to obtain the occupancy parameters of each efficient search point. The occupancy analysis algorithm is: , where F is the occupancy parameter, t is the horizontal coordinate of the efficient search point, and t av is the average efficient time, k is the slope of the fitted efficiency line of the search efficiency curve where the efficient search point is located, and k av is the slope of the overall efficiency line.
[0029] Furthermore, obtaining the memory usage based on the search efficiency curve; and setting the fixed storage capacity and the variable storage capacity in the dynamic cache based on the memory usage further includes:
[0030] The efficient search point corresponding to the minimum occupancy parameter is recorded as the memory occupancy point, and the storage resource amount corresponding to the memory occupancy point is recorded as the memory occupancy amount; the average value of all occupancy parameters is recorded as the measurement parameter, and the efficient search point whose occupancy parameter is less than the measurement parameter and is not a memory occupancy point is recorded as an optional occupancy point, and the storage resource amount of the optional occupancy point is recorded as the optional occupancy amount;
[0031] The memory usage and all optional usage are recorded as the fixed storage capacity of the dynamic cache; the value of the total storage capacity minus the memory usage is recorded as the memory variable capacity; the value of the total storage capacity minus all optional usage is recorded as the optional variable capacity; the memory variable capacity and all optional variable capacities are recorded as the variable storage capacity.
[0032] Furthermore, when searching in real time, setting fixed cache content in the dynamic cache based on the searched content and the fixed storage capacity, and setting variable storage space based on the searched content and the variable storage capacity includes:
[0033] The value of memory usage divided by total storage capacity is recorded as memory usage ratio;
[0034] When searching in real time, web pages that are redirected based on the search are obtained in real time, and the number of times each web page is opened is recorded as the web page occupancy count of the web page, and the number of times all web pages are opened is recorded as the total number of jumps; for any web page, when the value of the web page occupancy count divided by the total number of jumps is greater than the memory occupancy ratio, and the number of times the web page is opened is greater than the amount of fixed storage, the web page is recorded as a persistent web page.
[0035] Furthermore, when performing a real-time search, setting fixed cache content in the dynamic cache based on the searched content and the fixed storage capacity, and setting variable storage space based on the searched content and the variable storage capacity also includes:
[0036] When the space occupied by all persistent web pages is less than or equal to the memory usage, all persistent web pages are recorded as fixed cache content, and a memory storage space is created in the dynamic cache to store the fixed cache content, wherein the space occupied by the memory storage space is the memory usage;
[0037] When the space occupied by all persistent web pages is greater than the memory usage and less than or equal to the maximum value of the fixed storage capacity, the fixed storage capacity with the smallest difference between the space occupied by all persistent web pages and the fixed storage capacity is recorded as the variable usage; after the space occupied by the memory storage space is adjusted to the variable usage, all persistent web pages are recorded as fixed cache content and stored in the memory storage space;
[0038] When the space occupied by all stored web pages is greater than the maximum value in the fixed storage, the maximum value in the fixed storage is recorded as G max , the memory storage space is adjusted to G max and storing the latest acquired persistent web pages among all persistent web pages in the memory storage space in sequence. When the memory storage space is full, deleting the persistent web pages that are not stored in the memory storage space;
[0039] The fixed storage amount corresponding to the space occupied by the memory storage space is obtained in real time and recorded as the practical storage amount, and the variable storage amount obtained based on the practical storage amount is recorded as the practical variable amount; a variable storage space is created in the dynamic cache to store the latest acquired web pages, wherein the space occupied by the variable storage space is the practical variable amount, and each time a new web page is opened, the data stored in the variable storage space is updated.
[0040] The beneficial effects of the present invention are as follows: the present application first stores resources of different storage capacities in a dynamic cache, and obtains search efficiency curves for real-time searches when the dynamic cache contains resources of different storage capacities; and then obtains memory usage based on the search efficiency curves. This has the advantage that, by obtaining the corresponding search dynamic curves when the dynamic cache contains resources of different storage capacities and obtaining the memory usage, a more versatile fixed storage space can be set in the dynamic cache when storing different data. This helps to retain data that the user is particularly interested in in the dynamic cache in actual applications, and helps to directly retrieve the retained data when the user revisits the data that the user is particularly interested in, without being affected by poor real-time search performance, thereby improving the user's search efficiency.
[0041] The present application also sets a fixed storage capacity and a variable storage capacity in the dynamic cache based on the memory usage; finally, when searching in real time, a fixed cache content is set in the dynamic cache based on the searched content and the fixed storage capacity, and a variable storage space is set based on the searched content and the variable storage capacity. The advantage of this is that by setting the variable storage capacity and setting the fixed cache content based on the searched content, it helps to flexibly adjust the amount of data retained in the dynamic cache to prevent the user from browsing a large amount of data due to the small fixed storage space in the dynamic cache and being unable to retain the user's concerned data, thereby improving the user's search efficiency when browsing a large amount of data. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 is a flow chart of the steps of the method of the present invention;
[0043] Figure 2 A schematic diagram of the occupancy analysis coordinate system of the present invention;
[0044] Figure 3 A schematic diagram of a multi-curve screening coordinate system of the present invention;
[0045] Figure 4 Schematic diagram of the structure of the electronic device of the present invention. DETAILED DESCRIPTION
[0046] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0047] Example 1, please refer to Figure 1 As shown, the present application provides a dynamic cache management method for optimizing real-time search performance, comprising the following steps:
[0048] Step S1, storing resources of different storage capacities in a dynamic cache, and obtaining a search efficiency curve of a real-time search when the dynamic cache contains resources of different storage capacities;
[0049] Step S1 includes: step S101, recording the total amount of resources that can be stored in the dynamic cache as the total storage capacity; obtaining multiple data that can be stored in the dynamic cache, and recording them in order from small to large as storable data KC1 to storable data KC based on the size of the resource space occupied by each data. n , where data KC can be stored n The resource space occupied is less than or equal to the total storage capacity;
[0050] In a specific implementation, for example, if the total amount of resources that can be stored in the dynamic cache is 2GB during a data processing, the total storage capacity can be set to 2GB. The storable data KC can be set according to the actual available data. For example, the storable data KC can be selected to occupy data of sizes such as 1MB, 10MB, and 20MB. The more storable data KC is, the more accurate the analysis results will be in subsequent analysis and the more consistent they will be with the actual state of the dynamic cache.
[0051] Step S102, obtaining storable data KC1 to storable data KC n All combinations that can be stored in the dynamic cache are recorded as storage combinations; the size of the resource space occupied by all storable data KC in each storage combination is recorded as the combined occupied space of the storage combination;
[0052] Based on the size of the combined space occupied by all storage combinations, all storage combinations are recorded from small to large as storage combination CZ1 to storage combination CZm ;
[0053] In a specific fact process, such as a data processing, the storable data KC obtained includes the storable data KC n1 And can store data KC n2 , and can store data KC n1 KC with storable data n2 The space occupied is 1MB and 10MB, which can store data KC n1 KC with storable data n2 The combined space occupied by the storage combination CZ is 11MB, where n1 and n2 are both positive integers less than or equal to n and greater than or equal to 1;
[0054] Step S103, using a dynamic storage analysis method to obtain the storage resource amounts corresponding to the combined occupied spaces of all storage combinations CZ, and obtaining a search efficiency curve corresponding to each storage resource amount;
[0055] The dynamic storage analysis method includes: establishing a plane rectangular coordinate system, which is recorded as the occupancy analysis coordinate system, wherein the unit of the Y axis of the occupancy analysis coordinate system is byte, and the coordinate points on the X axis from the coordinate origin to the right are filled with storable data KC1 to storable data KC n For any storable data KC, the coordinate point corresponding to X = storable data KC, Y = the size of the resource space occupied by the storable data KC is recorded as the occupied point of the storable data KC;
[0056] In the specific implementation process, for example, during a data analysis, the occupancy analysis coordinate system is obtained as follows Figure 2 As shown, KC1 to KC5 are storable data KC1 to storable data KC n The point where the center of the circle ○ is located is the occupied point, and the curve QQ1 is the occupancy analysis curve obtained based on all occupied points. Based on the analysis, the value of n in the occupancy analysis coordinate system is 5, and the size of the resource space occupied by the storable data KC5 is recorded as 11MB. Then the vertical coordinate of the point with the largest slope in the region between Y=0 and Y=5.5MB in the occupancy analysis curve QQ1 can be used as the value with a smaller value and a larger change in the space occupied by all storable data KC. This helps to fuse the storage combination CZ through this value in subsequent analysis, thereby ensuring that the storage resource amount obtained after fusion can represent the majority of storage combinations CZ while reducing the amount of storage resources, thereby improving the efficiency of subsequent analysis;
[0057] Obtain all occupied points corresponding to the storable data KC, and record the curve obtained by fitting all occupied points as the occupancy analysis curve; nThe size of the resource space occupied is recorded as Y0, and the vertical coordinate of the point with the largest slope from Y=0 to Y=Y0 / 2 in the occupation analysis curve is marked as Y min ;
[0058] Sequentially perform the following operations on the storage combination CZ1 to storage combination CZ that do not contain storage resources: m The combined fusion method is used for analysis; the combined fusion method is: the storage combination CZ to be analyzed is recorded as the storage combination CZ c , where c is a positive integer less than or equal to m and greater than or equal to 1; store the combination CZ c The combined space occupied by is recorded as Y1, and [Y1-Y min ,Y1+Y min ] is recorded as storage combination CZ c The fusion interval;
[0059] In the specific implementation process, for example, during a data processing, the obtained Y min 2MB, storage combination CZ c The combined space occupied by the storage combination CZ is 5MB, the fusion interval can be set to [3MB, 7MB], and the storage combination CZ whose combined space is within [3MB, 7MB] can be recorded as storage combination CZ c The combination to be fused and subsequent analysis;
[0060] When removing the storage combination CZ c Any combination of storage combinations other than CZ occupies space in storage combination CZ c When the fusion interval is within the range, the combined space is in the storage combination CZ c Within the fusion range and except for storage combination CZ c Storage combinations other than CZ are recorded as storage combination CZ c The combination to be merged; store the combination CZ c The average of the combined space occupied by the combination of and all the combined spaces to be fused is recorded as the storage combination CZ c With storage combination CZ c The amount of storage resources of all combinations to be merged;
[0061] When removing the storage combination CZ c All storage combinations other than CZ are not in the storage combination CZ c When the fusion range is within the range, the combination CZ will be stored c The combined space occupied by the storage combination CZ c The amount of storage resources;
[0062] Obtain the storage resource capacity of all storage combinations CZ based on the combination fusion method;
[0063] For any amount of storage resources, data of the same size as the amount of storage resources is stored in the dynamic cache, and any term is searched using the search engine where the dynamic cache is located; a plane rectangular coordinate system is established, recorded as the search analysis coordinate system, wherein the unit of the X-axis of the search analysis coordinate system is time, and the Y-axis is a constant axis; based on the relationship between the time after searching for any term by the search engine where the dynamic cache is located and the number of resources obtained by the search, a corresponding curve is drawn in the search analysis coordinate system, and recorded as the search efficiency curve for the storage resource amount;
[0064] In the specific implementation process, in this embodiment, each storage resource amount corresponds to a search efficiency curve, so there will be multiple search efficiency curves in the analysis process of step S2.
[0065] Step S2, obtaining memory usage based on the search efficiency curve; setting a fixed storage capacity and a variable storage capacity in the dynamic cache based on the memory usage;
[0066] Step S2 includes: Step S201, establishing a plane rectangular coordinate system, recorded as a multi-curve screening coordinate system, wherein the unit of the X-axis of the multi-curve screening coordinate system is time, and the Y-axis is a constant axis; placing all search efficiency curves in the multi-curve screening coordinate system, and recording the point with the maximum slope in all search efficiency curves as the efficient search point of the search efficiency curve;
[0067] In the specific implementation process, for example, in a data analysis, a multi-curve screening coordinate system is obtained. Figure 3 As shown, curves SX1 to SX4 are all search efficiency curves, and straight line SX0 is a comprehensive efficiency straight line obtained based on all search efficiency curves;
[0068] Step S202: record the average value of the horizontal coordinates of all efficient search points as the average efficient time; record the straight line obtained by fitting all search efficiency curves as the comprehensive efficiency line; record the straight line obtained by fitting each search efficiency curve as the fitted efficiency line of the search efficiency curve;
[0069] Step S203: Obtain the occupancy parameters of each efficient search point using an occupancy analysis algorithm. The occupancy analysis algorithm is: , where F is the occupancy parameter, t is the horizontal coordinate of the efficient search point, and t av is the average efficient time, k is the slope of the fitted efficiency line of the search efficiency curve where the efficient search point is located, and k av is the slope of the comprehensive efficiency line;
[0070] In a specific implementation, for example, during a data processing, the coordinates of an efficient search point are obtained as (0.05s, 100), the average efficient time is 0.1s, the slope of the fitted efficiency line of the search efficiency curve where the efficient search point is located is 5, and the slope of the comprehensive efficiency line is 3.5. Then, through data calculation, it can be obtained that the occupancy parameter corresponding to the efficient search point is -1.5. In this embodiment, the smaller the occupancy parameter, the smaller the horizontal coordinate of the efficient search point and the slope of the fitted efficiency line of the search efficiency curve where the efficient search point is located are compared with all efficient search points. Therefore, the efficient search point corresponding to the smallest occupancy parameter can be recorded as the memory occupancy point and used as the preferred object in subsequent analysis.
[0071] Step S204: Record the efficient search point corresponding to the minimum occupancy parameter as the memory occupancy point, and record the storage resource amount corresponding to the memory occupancy point as the memory occupancy amount; record the average value of all occupancy parameters as the measurement parameter, record the efficient search point whose occupancy parameter is less than the measurement parameter and is not a memory occupancy point as an optional occupancy point, and record the storage resource amount of the optional occupancy point as the optional occupancy amount;
[0072] Step S205: record the memory usage and all optional usage as the fixed storage capacity of the dynamic cache; record the value of the total storage capacity minus the memory usage as the memory variable capacity; record the value of the total storage capacity minus all optional usage as the optional variable capacity; record the memory variable capacity and all optional variable capacities as the variable storage capacity;
[0073] In the specific implementation process, for example, the total storage capacity is 1000MB, the memory usage is 100MB, and all optional usages are 50MB, 150MB, 200MB and 210MB respectively. Then 100MB, 50MB, 150MB, 200MB and 210MB can be recorded as fixed storage capacities of the dynamic cache, and 900MB, 950MB, 850MB, 800MB and 790MB can be recorded as variable storage capacities. By obtaining fixed storage capacity and variable storage capacity, it is helpful to set the fixed storage space and variable storage space in the dynamic storage in subsequent analysis to meet the needs of preserving data that users focus on searching, and improve users' search efficiency and search experience.
[0074] Step S3, when searching in real time, setting fixed cache content in the dynamic cache based on the searched content and the fixed storage capacity, and setting variable storage space based on the searched content and the variable storage capacity;
[0075] Step S3 includes: step S301, dividing the memory usage by the total storage capacity and recording the value as the memory usage ratio;
[0076] Step S302: When performing a real-time search, web pages that are redirected based on the search are obtained in real time, and the number of times each web page is opened is recorded as the web page occupancy count of the web page, and the number of times all web pages are opened is recorded as the total number of redirects. For any web page, if the value of the web page occupancy count divided by the total number of redirects is greater than the memory occupancy ratio, and the number of times the web page is opened is greater than the fixed storage capacity, the web page is recorded as a persistently stored web page.
[0077] In a specific implementation process, for example, during a data processing, the memory usage ratio is 0.4 and the total number of jumps is 100 times, then the webpages that have been opened more than 40 times can be set as persistent webpages and subsequently stored;
[0078] Step S303: When the space occupied by all persistent web pages is less than or equal to the memory usage, all persistent web pages are recorded as fixed cache content, and a memory storage space is created in the dynamic cache to store the fixed cache content, wherein the space occupied by the memory storage space is the memory usage;
[0079] Step S304: When the space occupied by all persistent web pages is greater than the memory usage and less than or equal to the maximum value of the fixed storage capacity, the fixed storage capacity with the smallest difference between the space occupied by all persistent web pages and the fixed storage capacity is recorded as the variable usage; after the memory storage space is adjusted to the variable usage, all persistent web pages are recorded as fixed cache content and stored in the memory storage space;
[0080] In a specific implementation, by adjusting the space occupied by the memory storage space, it is helpful to flexibly adjust the amount of data retained in the dynamic cache, so as to prevent the fixed storage space in the dynamic cache from being insufficient when the user browses a large amount of data and being unable to retain the user's interested data, thereby improving the user's search efficiency when browsing a large amount of data;
[0081] Step S305: When the space occupied by all stored web pages is greater than the maximum value in the fixed storage capacity, the maximum value in the fixed storage capacity is recorded as G max , the memory storage space is adjusted to G max and storing the latest stored web pages among all stored web pages in the memory storage space in sequence. When the memory storage space is full, deleting the stored web pages that are not stored in the memory storage space;
[0082] Step S306, obtain in real time the fixed storage amount corresponding to the space occupied by the memory storage space, and record it as the practical storage amount, and record the variable storage amount obtained based on the practical storage amount as the practical variable amount; create a variable storage space in the dynamic cache to store the latest acquired web page, wherein the space occupied by the variable storage space is the practical variable amount, and each time a new web page is opened, the data stored in the variable storage space is updated.
[0083] Example 2, please refer to Figure 4 As shown, Figure 4 A schematic diagram of the structure of an electronic device is provided. The electronic device may include: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus. The memory stores computer-readable instructions, and the processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, the steps of a dynamic cache management method for optimizing real-time search performance are executed to achieve the following functions: first, storing resources of different storage capacities in a dynamic cache and obtaining a search efficiency curve for real-time searches when the dynamic cache contains resources of different storage capacities; then, obtaining memory usage based on the search efficiency curve; setting a fixed storage capacity and a variable storage capacity in the dynamic cache based on the memory usage; and finally, during a real-time search, setting fixed cache content in the dynamic cache based on the searched content and the fixed storage capacity, and setting variable storage space based on the searched content and the variable storage capacity.
[0084] In addition, the logical instructions in the above-mentioned memory can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.
[0085] Example 3. The present application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute a dynamic cache management method for optimizing real-time search performance provided by the above methods, the method including: first, storing resources of different storage amounts in a dynamic cache, and obtaining a search efficiency curve for real-time search when the dynamic cache contains resources of different storage amounts; then obtaining memory usage based on the search efficiency curve; setting a fixed storage amount and a variable storage amount in the dynamic cache based on the memory usage; finally, when performing real-time search, setting fixed cache content in the dynamic cache based on the searched content and the fixed storage amount, and setting variable storage space based on the searched content and the variable storage amount.
[0086] Example 4. The present application also provides a computer-readable storage medium. The present application provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above dynamic cache management method for optimizing real-time search performance are executed to achieve the following functions: first, resources of different storage amounts are stored in the dynamic cache, and a search efficiency curve for real-time search when the dynamic cache contains resources of different storage amounts is obtained; then, the memory occupancy is obtained based on the search efficiency curve; a fixed storage amount and a variable storage amount in the dynamic cache are set based on the memory occupancy; finally, when searching in real time, fixed cache content is set in the dynamic cache based on the searched content and the fixed storage amount, and variable storage space is set based on the searched content and the variable storage amount.
[0087] Through the description of the above embodiments, the embodiments of the present invention can be provided as methods, systems, or computer program products. Based on this understanding, the essence of the above technical solutions or the portion that contributes to the prior art can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for enabling a computer device (such as a personal computer, server, or network device) to execute the methods described in various embodiments or certain portions of the embodiments.
[0088] In the embodiments provided in this application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of systems, modules and units can be electrical, mechanical or other forms.
[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A dynamic cache management method for optimizing real-time search performance, characterized in that: The steps include: Storing resources of different storage amounts in a dynamic cache, and obtaining a search efficiency curve of a real-time search when the dynamic cache contains resources of different storage amounts; Obtain memory usage based on the search efficiency curve; set fixed storage capacity and variable storage capacity in the dynamic cache based on the memory usage; When searching in real time, setting fixed cache content in the dynamic cache based on the searched content and the fixed storage capacity, and setting variable storage space based on the searched content and the variable storage capacity; The search efficiency curves for real-time search when resources with different storage capacities are stored in the dynamic cache and the dynamic cache contains resources with different storage capacities include: The total amount of resources that can be stored in the dynamic cache is recorded as the total storage capacity; multiple data that can be stored in the dynamic cache are obtained, and based on the size of the resource space occupied by each data, they are recorded in order from small to large as storable data KC1 to storable data KC n , where data KC can be stored n The resource space occupied is less than or equal to the total storage capacity; Get storable data KC1 to storable data KC n All combinations that can be stored in the dynamic cache are recorded as storage combinations; the size of the resource space occupied by all storable data KC in each storage combination is recorded as the combined occupied space of the storage combination; Based on the size of the combined space occupied by all storage combinations, all storage combinations are recorded from small to large as storage combination CZ1 to storage combination CZ m ; Use dynamic storage analysis to obtain the storage resource volume corresponding to the combined space occupied by all storage combinations CZ, and obtain the search efficiency curve corresponding to each storage resource volume; Dynamic storage analysis methods include: Establish a plane rectangular coordinate system, recorded as the occupancy analysis coordinate system, where the unit of the Y axis of the occupancy analysis coordinate system is byte, and the coordinate points on the X axis from the coordinate origin to the right are filled with storable data KC1 to storable data KC n For any storable data KC, the coordinate point corresponding to X = storable data KC, Y = the size of the resource space occupied by the storable data KC is recorded as the occupied point of the storable data KC; Obtain all occupied points corresponding to the storable data KC, and record the curve obtained by fitting all occupied points as the occupancy analysis curve; n The size of the resource space occupied is recorded as Y0, and the vertical coordinate of the point with the largest slope from Y=0 to Y=Y0 / 2 in the occupation analysis curve is marked as Y min .
2. A dynamic cache management method for optimizing real-time search performance according to claim 1, characterized in that: Dynamic storage analysis also includes: Sequentially perform the following operations on the storage combination CZ1 to storage combination CZ that do not contain storage resources: m The combined fusion method is used for analysis; the combined fusion method is: the storage combination CZ to be analyzed is recorded as the storage combination CZ c , where c is a positive integer less than or equal to m and greater than or equal to 1; store the combination CZ c The combined space occupied by is recorded as Y1, and [Y1-Y min ,Y1+Y min ] is recorded as storage combination CZ c The fusion interval; When removing the storage combination CZ c Any combination of storage combinations other than CZ occupies space in storage combination CZ c When the fusion interval is within the range, the combined space is in the storage combination CZ c Within the fusion range and except for storage combination CZ c Storage combinations other than CZ are recorded as storage combination CZ c The combination to be merged; store the combination CZ c The average of the combined space occupied by the combination of and all the combined spaces to be fused is recorded as the storage combination CZ c With storage combination CZ c The storage resource amount of all combinations to be merged.
3. A dynamic cache management method for optimizing real-time search performance according to claim 2, characterized in that: Dynamic storage analysis also includes: When removing the storage combination CZ c All storage combinations other than CZ are not in the storage combination CZ c When the fusion range is within the range, the combination CZ will be stored c The combined space occupied by the storage combination CZ c The amount of storage resources; The storage resource amount of all storage combinations CZ is obtained based on the combination fusion method.
4. A dynamic cache management method for optimizing real-time search performance according to claim 3, characterized in that: Dynamic storage analysis also includes: For any amount of storage resources, data of the same size as the amount of storage resources is stored in the dynamic cache, and any term is searched using the search engine where the dynamic cache is located; a plane rectangular coordinate system is established, recorded as the search analysis coordinate system, wherein the unit of the X-axis of the search analysis coordinate system is time, and the Y-axis is a constant axis; based on the relationship between the time after searching for any term by the search engine where the dynamic cache is located and the number of resources obtained by the search, a corresponding curve is drawn in the search analysis coordinate system, and recorded as the search efficiency curve of the storage resource amount.
5. A dynamic cache management method for optimizing real-time search performance according to claim 4, characterized in that: Get memory usage based on the search efficiency curve; Setting the fixed storage amount and variable storage amount in the dynamic cache based on memory usage includes: Establish a plane rectangular coordinate system, recorded as a multi-curve screening coordinate system, where the X-axis unit of the multi-curve screening coordinate system is time and the Y-axis is a constant axis; place all search efficiency curves in the multi-curve screening coordinate system, and record the point with the maximum slope of all search efficiency curves as the efficient search point of the search efficiency curve; The average value of the horizontal coordinates of all efficient search points is recorded as the average efficient time; the straight line obtained by fitting all search efficiency curves is recorded as the comprehensive efficiency straight line; the straight line obtained by fitting each search efficiency curve is recorded as the fitted efficiency straight line of the search efficiency curve; Use the occupancy analysis algorithm to obtain the occupancy parameters of each efficient search point. The occupancy analysis algorithm is: , where F is the occupancy parameter, t is the horizontal coordinate of the efficient search point, and t av is the average efficient time, k is the slope of the fitted efficiency line of the search efficiency curve where the efficient search point is located, and k av is the slope of the overall efficiency line.
6. A dynamic cache management method for optimizing real-time search performance according to claim 4, characterized in that: Get memory usage based on the search efficiency curve; Setting the fixed storage amount and the variable storage amount in the dynamic cache based on memory usage also includes: The efficient search point corresponding to the minimum occupancy parameter is recorded as the memory occupancy point, and the storage resource amount corresponding to the memory occupancy point is recorded as the memory occupancy amount; the average value of all occupancy parameters is recorded as the measurement parameter, and the efficient search point whose occupancy parameter is less than the measurement parameter and is not a memory occupancy point is recorded as an optional occupancy point, and the storage resource amount of the optional occupancy point is recorded as the optional occupancy amount; The memory usage and all optional usage are recorded as the fixed storage capacity of the dynamic cache; the value of the total storage capacity minus the memory usage is recorded as the memory variable capacity; the value of the total storage capacity minus all optional usage is recorded as the optional variable capacity; the memory variable capacity and all optional variable capacities are recorded as the variable storage capacity.
7. A dynamic cache management method for optimizing real-time search performance according to claim 6, characterized in that: When searching in real time, setting fixed cache content in the dynamic cache based on the searched content and the fixed storage capacity, and setting variable storage space based on the searched content and the variable storage capacity include: The value of memory usage divided by total storage capacity is recorded as memory usage ratio; When searching in real time, web pages that are redirected based on the search are obtained in real time, and the number of times each web page is opened is recorded as the web page occupancy count of the web page, and the number of times all web pages are opened is recorded as the total number of jumps; for any web page, when the value of the web page occupancy count divided by the total number of jumps is greater than the memory occupancy ratio, and the number of times the web page is opened is greater than the amount of fixed storage, the web page is recorded as a persistent web page.
8. A dynamic cache management method for optimizing real-time search performance according to claim 7, characterized in that: When searching in real time, setting fixed cache content in the dynamic cache based on the searched content and the fixed storage capacity, and setting variable storage space based on the searched content and the variable storage capacity also includes: When the space occupied by all persistent web pages is less than or equal to the memory usage, all persistent web pages are recorded as fixed cache content, and a memory storage space is created in the dynamic cache to store the fixed cache content, wherein the space occupied by the memory storage space is the memory usage; When the space occupied by all persistent web pages is greater than the memory usage and less than or equal to the maximum value of the fixed storage capacity, the fixed storage capacity with the smallest difference between the space occupied by all persistent web pages and the fixed storage capacity is recorded as the variable usage; after the space occupied by the memory storage space is adjusted to the variable usage, all persistent web pages are recorded as fixed cache content and stored in the memory storage space; When the space occupied by all stored web pages is greater than the maximum value in the fixed storage, the maximum value in the fixed storage is recorded as G max , the memory storage space is adjusted to G max and storing the latest stored web pages among all stored web pages in the memory storage space in sequence. When the memory storage space is full, deleting the stored web pages that are not stored in the memory storage space; The fixed storage amount corresponding to the space occupied by the memory storage space is obtained in real time and recorded as the practical storage amount, and the variable storage amount obtained based on the practical storage amount is recorded as the practical variable amount; a variable storage space is created in the dynamic cache to store the latest acquired web pages, wherein the space occupied by the variable storage space is the practical variable amount, and each time a new web page is opened, the data stored in the variable storage space is updated.
Citation Information
Patent Citations
Multi-channel dynamic cache management method, system, equipment and medium
CN118656313A
Optimization method and optimization system for memory access in multi-core system
CN101719105A
Storage optimization method for dynamic heterogeneous adjustment in industrial data cache
CN118349174A