Cache replacement method, equipment, medium and product

By constructing a dynamic cache topology and quantifying cache conflicts, the problem of improper cache management in AI image retouching was solved, achieving efficient and adaptive cache replacement, and improving the smoothness of the image retouching process and cache efficiency.

CN121860841APending Publication Date: 2026-04-14CHINA MOBILE INTERNET CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-31
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In the current AI image retouching process, improper cache data management leads to excessive memory consumption, affecting application performance. Furthermore, the lack of correlation analysis between multi-step operations makes it unable to adapt to diverse user behavior patterns, resulting in low caching efficiency.

Method used

A dynamic cache topology is constructed. By quantifying cache conflicts and dependencies, a high-conflict cache subgraph is formed. The cache value weight is dynamically adjusted in combination with user behavior. Priority scores are calculated based on multi-dimensional indicators to generate a candidate replacement queue. A mirror topology is constructed in parallel to perform adaptive cache replacement.

Benefits of technology

It improves cache space utilization efficiency, reduces unnecessary computational overhead, ensures the smoothness of the image editing process and the consistency of editing intent, and optimizes cache efficiency to adapt to various user scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121860841A_ABST
    Figure CN121860841A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and particularly provides a cache replacement method and device, a medium and a product. The method comprises the following steps: acquiring an operation sequence generated by a user in a picture retouching process and intermediate state cache data generated by the operation sequence; determining an association relationship between different operations in the operation sequence; and when cache replacement needs to be executed, selecting to-be-replaced cache data from the intermediate-state cache data for replacement based on the association relationship. According to the method, the cache data with high conflict risk is preferentially replaced by analyzing the incidence relation between the graph retouching operations, and the cache data of the key operation and the cache data with high semantic coherence are reserved, so that the utilization efficiency of the cache space is remarkably improved, the unnecessary recalculation overhead is reduced, and the method has the advantages of being simple in structure and convenient to operate. And the smoothness of the picture retouching process and the continuity of the editing intention are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to cache replacement methods, apparatus, media, and products. Background Technology

[0002] With the widespread application of AI photo editing technology on mobile devices, users have placed higher demands on the smoothness and responsiveness of real-time photo editing experiences. Since AI photo editing typically involves multiple steps such as skin smoothing, blurring, and color correction, each step generates intermediate cached data. If this cached data is not managed properly, it will consume a large amount of device memory, leading to excessive memory usage, significantly increasing operation latency, and even affecting the overall performance of the application. Summary of the Invention

[0003] In view of this, exemplary embodiments of the present disclosure provide a cache replacement method, apparatus, medium, and product to address at least one problem existing in the related art.

[0004] One aspect of an exemplary embodiment of this disclosure provides a cache replacement method, the method comprising: Obtain the operation sequence generated by the user during the image editing process and the intermediate state cache data generated by the operation sequence; Determine the relationships between different operations in the operation sequence; When cache replacement is required, the cache data to be replaced is selected from the intermediate cache data based on the association relationship.

[0005] In another aspect of exemplary embodiments of this disclosure, a computer device is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the methods described in exemplary embodiments of this disclosure.

[0006] In another aspect of exemplary embodiments of this disclosure, a computer-readable storage medium is provided having a computer program / instructions stored thereon that, when executed by a processor, implements the methods described in exemplary embodiments of this disclosure.

[0007] In another aspect of exemplary embodiments of this disclosure, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the methods described in exemplary embodiments of this disclosure.

[0008] As will be described in detail below, a cache replacement method according to an embodiment of this disclosure involves acquiring the operation sequence generated by the user during image editing and the intermediate cache data generated by the operation sequence; determining the correlation between different operations in the operation sequence; and when cache replacement is required, selecting cache data to be replaced from the intermediate cache data based on the correlation. This cache replacement method analyzes the correlation between image editing operations, prioritizing the replacement of cache data with high conflict risk, while retaining cache data for critical operations and cache data with high semantic coherence. This not only improves the utilization efficiency of cache space and reduces unnecessary computational overhead, but also ensures the smoothness of the image editing process and the coherence of the editing intent. Attached Figure Description

[0009] The above and other objects, features, and advantages of this disclosure will become more apparent from the more detailed description of the embodiments thereof in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this disclosure and form part of the specification. They are used together with the embodiments of this disclosure to explain the disclosure and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.

[0010] Figure 1 A flowchart illustrating the cache replacement method provided in this embodiment of the disclosure; Figure 2 This is a schematic diagram illustrating the process of constructing a dynamic cache topology provided in an embodiment of this disclosure; Figure 3 This is a flowchart illustrating the process of adjusting the dynamic cache topology based on user operations, provided in an embodiment of this disclosure. Figure 4 A schematic diagram of the process for calculating priority scores provided in an embodiment of this disclosure; Figure 5 A schematic diagram illustrating the process of constructing a mirror topology and a target replacement strategy provided in this embodiment of the disclosure; Figure 6 A schematic block diagram of the functional modules of the cache replacement device provided in the embodiments of this disclosure; Figure 7 A structural block diagram of an electronic device provided in an embodiment of this disclosure; Figure 8 A schematic diagram of a computer program product provided in an embodiment of this disclosure. Detailed Implementation

[0011] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0012] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0013] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc., used in this disclosure are only used to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.

[0014] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0015] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0016] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0017] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.

[0018] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device. It is understood that the above notification and user authorization process is merely illustrative and does not constitute a limitation on the implementation of this disclosure; other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0019] With the widespread application of AI photo editing technology on mobile devices, users have placed higher demands on the smoothness and responsiveness of real-time photo editing experiences. Since AI photo editing typically involves multiple steps such as skin smoothing, blurring, and color correction, each step generates intermediate cached data. If this cached data is not managed properly, it will consume a large amount of device memory, leading to excessive memory usage, significantly increased operation latency, and even impacting the overall performance of the application.

[0020] In related technologies, cache management often employs methods such as LRU (Least Recently Used) algorithms or manual cache management. However, these technologies lack analysis of the correlation between multiple operations and fail to capture the dynamic logical dependencies that exist in the multi-step image editing process. They make decisions based solely on a single dimension such as access time or frequency, ignoring the sequential order and semantic relationships between cache blocks. As a result, once the intermediate data in the preceding sequence is evicted, subsequent operations need to re-execute the entire calculation, causing unnecessary performance loss.

[0021] Secondly, when users repeatedly fine-tune parameters, the relevant technologies cannot quantitatively identify and process cache conflicts, which easily leads to a large number of cache singularities with similar parameters but low value density, resulting in a large amount of redundant data accumulating in memory and causing inefficient use of storage resources.

[0022] Finally, the caching replacement strategies of related technologies are too simplistic and cannot adapt to the diverse behavioral patterns of users in AI photo editing scenarios, resulting in the inability to achieve systematic optimization of caching efficiency in multiple typical use cases.

[0023] Therefore, to address the aforementioned issues, this exemplary embodiment provides a cache replacement method. First, a dynamic cache topology is constructed, modeling the user's AI image editing operation sequence as a dynamic cache topology. High-conflict cache subgraphs are formed by quantifying cache conflicts and dependencies, and cache value weights are dynamically adjusted based on user behavior. Next, a hypersurface diffusion priority score is calculated based on multi-dimensional metrics to generate a candidate replacement queue. When memory is insufficient, a mirror topology is constructed in parallel, and its stability is evaluated through hierarchical stress testing. Finally, a hierarchical replacement strategy is executed based on the weighted score, achieving efficient and adaptive cache replacement.

[0024] For example, Figure 1 This is a flowchart illustrating the cache replacement method provided in an embodiment of the present disclosure, as shown below. Figure 1 As shown, the specific steps may include: Step S110: Obtain the operation sequence generated by the user during the image editing process and the intermediate state cache data generated by the operation sequence.

[0025] In this embodiment, user interaction behavior in the AI ​​image editing function can be acquired, and all image editing operations performed can be recorded in chronological order to form an operation sequence. The operation sequence includes intermediate cache data generated for each operation, which represents the intermediate results of the image editing process.

[0026] Step S120: Determine the relationships between different operations in the operation sequence.

[0027] In this embodiment, the relationships can include temporal dependencies, parameter logical relationships, and parameter conflict relationships. Temporal dependencies refer to subsequent retouching operations depending on the result of preceding retouching operations. Parameter logical relationships refer to semantic connections between different retouching operations in the parameter space. Parameter conflict relationships refer to redundant states between two retouching operations due to similar parameter operations.

[0028] Step S130: When cache replacement is required, select the cache data to be replaced from the intermediate cache data based on the association relationship.

[0029] In this embodiment, parameter conflict relationships reflect the conflict risk of image retouching operations. The higher the conflict risk, the higher the priority for replacing the intermediate cache data generated by the image retouching operation. Temporal dependencies reflect the importance of the image retouching operation in the entire operation sequence. Higher importance indicates that the operation may be at the end of a critical image retouching path or a critical operation on which multiple subsequent operations depend. Directly removing the intermediate cache data corresponding to this operation may lead to large-scale recalculation; therefore, its replacement priority needs to be reduced. Parameter logical relationships reflect the semantic value of the contextual logic between image retouching operations. To maintain editing continuity, the intermediate cache data generated by the image retouching operation needs to have its replacement priority reduced.

[0030] Based on this, by analyzing the relationships between image editing operations, cached data with high conflict risk is replaced first, while cached data for critical operations and cached data with high semantic coherence are retained. This not only significantly improves the utilization efficiency of cache space and reduces unnecessary recalculation overhead, but also ensures the smoothness of the image editing process and the coherence of editing intent.

[0031] Based on the above embodiments, in another embodiment provided in this disclosure, determining the association relationship between different operations in the operation sequence may include: Construct a dynamic cache topology, which is used to represent the relationships between different operations in an operation sequence; The construction of a dynamic cache topology includes: Obtain predefined image retouching operation types and assign corresponding parameter subspaces to each image retouching operation type; The intermediate cache data generated by the image retouching operation is mapped to nodes in the dynamic cache topology; where nodes include the parameter vector, timestamp, and hypersurface singularity index of the corresponding image retouching operation. Based on the temporal dependencies between image editing operations, weighted operation dependency edges are constructed between nodes; Based on the parameter conflict relationship of nodes, a weighted conflict detection edge is constructed between nodes; A dynamic cache topology is constructed based on nodes, operation dependency edges, and conflict detection edges.

[0032] In this embodiment, a dynamic cache topology is constructed based on the operation sequence generated by the user during image editing. The dynamic cache topology is used to represent the relationship between different operations in the operation sequence. The specific construction process may include: Client predefined N The core AI-based image editing operations include tasks such as skin smoothing, blurring, and background removal. Each type of image editing operation corresponds to a parameter subspace. The parameter subspace is used to store all parameters for this type of image retouching operation. The system maps each retouching result cache block to a node in DCTS. Node attributes include: parameter vector Hypersurface singularity metric used to measure cache conflict severity And a timestamp recording the last operation time. , where the parameter vector This can include skin abrasion intensity k and virtualization intensity M .

[0033] For each type of image retouching operation, a corresponding parameter vector needs to be defined. Taking skin smoothing as an example, the parameter vector corresponding to skin smoothing is: ,in The strength coefficient, For the region mask matrix, This is a smoothing factor.

[0034] Next, orthogonalization can be used to isolate the parameters of different operations into their respective independent subspaces, ensuring that the intersection of the parameter subspaces of any two different types of operations is empty. This avoids cross-interference between parameters, among which 、 The parameter represents any two types of operations.

[0035] When a new type of AI photo editing operation is added, the system automatically expands the parameters. The dimensions of space, and the allocation of new subspaces for new operations. .

[0036] Each time a user performs an operation, the parameters are mapped to the corresponding subspace. middle.

[0037] Each image retouching result cache block It is a container for intermediate data generated from a single user operation. The image retouching result cache block encapsulates five parts of information, including: information from the corresponding parameter subspace. The parameter vector extracted from this image retouching operation. Image pixel matrix and image snapshot read from the database after image retouching is completed. Dependency pointers pointing to parent nodes based on operation dependencies Hypersurface Singularity Index and timestamp .

[0038] For example, AI image editing operation context dependency edges can be constructed based on the temporal dependencies between image editing operations. Operation dependency edges are a type of directed edge, used... The dependency edge represents the temporal dependency between each operation.

[0039] If cache block Based on cache blocks The direct modification result, such as performing a skin smoothing operation first and then adjusting the skin smoothing intensity, will be displayed at the node. and Establish a dependency edge between them .

[0040] In this embodiment, conflict detection edges for AI image retouching operations can be constructed based on the parameter conflict relationships of nodes. These conflict detection edges are a type of undirected edge. This indicates that it is specifically used to mark overlapping regions with high collision rates in the parameter space. The construction steps for collision detection edges may specifically include: When two AI photo editing operations are of the same type ( ), and their parameter vectors differ At that time, at the corresponding node and Establish an undirected conflict detection edge between them .

[0041] Finally, a dynamic cache topology is constructed based on the nodes and the operation dependency edges and conflict detection edges associated with the nodes.

[0042] For example, Figure 2 This is a schematic diagram illustrating the process of constructing a dynamic cache topology structure according to an embodiment of this disclosure.

[0043] Based on this, by mapping each type of AI image retouching operation to an independent parameter subspace and performing orthogonalization, the parameter features of different operation types can be accurately distinguished, avoiding cross-interference between parameters. Furthermore, by constructing context dependency edges and context conflict detection edges for AI image retouching operations, and building a dynamic cache topology based on these edges, the problems of related caching algorithms being unable to represent dynamic dependencies between operations and unable to quantify cache conflict topologies are solved.

[0044] Based on the above embodiments, in another embodiment provided in this disclosure, the above method may further include: Obtain multiple neighbor nodes of the target node; Calculate the difference between the target node and multiple neighboring nodes in the parameter subspace; Based on the difference degree, the hypersurface singularity index of the target node is calculated.

[0045] In the embodiment, the hypersurface singularity index It can be calculated by nodes Its neighboring nodes Obtained from local density differences in the parameter space. Hypersurface singularity index. It can be obtained through the following steps: First, obtain the node. of k -hop neighbor nodes (default k =1).

[0046] Furthermore, for each neighbor node compute nodes with neighbors Local parameter differences This calculation step uses a type-matching indicator function. Implement conditional judgment: Only when the AI ​​image retouching operation types corresponding to two nodes are the same, will the Euclidean distance between their parameter vectors be calculated. If the types are different, then the difference value .

[0047] Finally, the index is normalized to obtain the calculated value of the hypersurface singularity index. , obtain 1-hop neighbor set For all of Calculate the arithmetic mean, and the final result is limited to... The larger the hypersurface singularity index value, the more severe the parameter conflict in the region where the cache node is located. For example, a dynamic threshold can be set. When the indicator value exceeds the dynamic threshold, the node is marked as a high-conflict node, triggering the subsequent weight downgrade mechanism.

[0048] Based on this, the hypersurface singularity index is calculated based on the local density difference between nodes and their neighboring nodes in the parameter space. This can effectively identify data clusters with high conflict and low reuse value formed by repeated parameter fine-tuning by users, enabling a quantifiable assessment of cache conflicts and thus accurately identifying the source of memory waste.

[0049] Based on the above embodiments, in another embodiment provided in this disclosure, the construction of a dynamic cache topology structure based on nodes, operation-dependent edges, and conflict detection edges may include: The dynamic cache topology is defined as a weighted directed acyclic graph structure; where all nodes in the graph structure constitute a node set, and the edges in the graph structure consist of operation-dependent edges and conflict detection edges. The weight value of the operation-dependent edge is determined based on the similarity of the parameters of the nodes at both ends of the operation-dependent edge. The weight value of the conflict detection edge is determined based on the sum of the hypersurface singularity indices of the nodes at both ends of the conflict detection edge.

[0050] In the embodiments, DCTS can be defined as a weighted directed acyclic graph. , Among them, node set It encapsulates three types of attributes: parameter vector Specific parameter configuration for storage operations, hypersurface singularity index Record conflict assessment results, timestamp Accuracy down to the millisecond level to support LRU policy.

[0051] in, For operation-dependent edges, For conflict detection edges.

[0052] Wherein, the weight function is: , This manages the weight allocation for the two types of edges separately. For operation-dependent edges... Directly using parameter similarity As weight; conflict detection edge The system uses superimposed values ​​of hypersurface singularity indices to ensure that high-conflict regions have higher weights in the topology. The system updates all edge weights with decay every 10 operations to prevent excessive accumulation of historical data.

[0053] The weight of the operation-dependent edge is: During calculation, first obtain... and Euclidean distance Then divide by the parameter subspace Maximum distance in Normalization is performed, and finally passed This is converted into similarity weights. The closer the weight value is to 1, the more similar the operational parameters and the stronger the dependency. If the relationship is weak, no dependency edge is established.

[0054] To maintain the timeliness of the topology, the system will perform decay processing on dependent edges that have not been activated for a long time.

[0055] Specifically, if the target node timestamp of a certain edge Satisfy: Current time Then the weight of that edge will be calculated according to... Exponential decay occurs, where This is a time decay coefficient, which gradually weakens outdated dependencies.

[0056] For example, the weight of a conflict detection edge is set to the sum of the hypersurface singularity indices of the two nodes. Therefore, the weight of the conflict detection edge intuitively reflects the conflict intensity of the overlapping area of ​​this parameter.

[0057] For example, threshold It can be dynamically adjusted based on the operation type, such as the threshold for skin smoothing operations. It can be set to 0.3, the threshold for background removal. It can be set to 0.5.

[0058] In addition, the system dynamically maintains conflict detection edges; if a node... or Hypersurface singularity index If the value drops below the business-defined threshold x, the corresponding conflict detection edge is removed.

[0059] Based on this, by constructing context dependency edges and context conflict detection edges for AI image editing operations, and building a dynamic cache topology based on the dependency edges and conflict detection edges, the problems of related caching algorithms being unable to represent the dynamic dependencies between operations and being unable to quantify cache conflict topologies are solved.

[0060] Based on the above embodiments, in another embodiment provided in this disclosure, the above method may further include: Traverse the dynamic cache topology and mark nodes whose hypersurface singularity index exceeds a preset threshold as high-conflict nodes; A high-conflict cache subgraph is formed based on high-conflict nodes and the conflict detection edges connected to them.

[0061] In this embodiment, each time a user adds an AI image editing operation, the client dynamically updates the DCTS node and edge relationships and periodically scans the topology to identify hypersurface singularity indicators. Nodes are marked as high-collision nodes, forming a high-collision cache subgraph. Building a dynamic cache topology based on dependency edges and conflict detection edges can specifically include: First, collect hypersurface singularity metrics. Node set Nodes in the node set are identified as high-conflict nodes.

[0062] Subsequently, using the node set Based on this, automatic merging and Conflict detection edges connecting the nodes in the middle form an independent subgraph structure within the global topology. This subgraph structure visually represents the region in the current parameter space where conflicts are most concentrated and redundancy is most significant.

[0063] Finally, to further quantify the degree of disorder in high-conflict regions, the subgraph structure can be calculated. Entropy value: .

[0064] During the calculation, it is necessary to first calculate the hypersurface singularity index of all nodes within the subgraph. Perform normalization, let ( The normalized hypersurface singularity index is transformed into a probability distribution, and the information entropy is calculated based on this distribution. The higher the entropy value, the more dispersed and disordered the conflict degree distribution of the nodes in the subgraph.

[0065] For example, an entropy threshold can be preset. When the entropy value exceeds the entropy threshold, the high-conflict subgraph is determined to be in a severely chaotic state and requires urgent optimization. At this time, the system will automatically trigger a global weight rebalancing process to centrally adjust the weights of the relevant nodes, thereby resolving conflicts and optimizing the cache layout.

[0066] Based on the above embodiments, in another embodiment provided in this disclosure, the above method may further include: The hypersurface value weights of each node in the dynamic cache topology are dynamically adjusted based on the user's real-time operation sequence. Based on the adjusted hypersurface value weights of each node, update the hypersurface singularity index of each node. Based on the updated hypersurface singularity index of each node, update the high-conflict cache subgraph.

[0067] In this embodiment, the hypersurface value weight of each node is dynamically adjusted based on the user's real-time operational behavior. The user's real-time operational behavior may include switching operation types, repeatedly fine-tuning parameters, and performing undo operations.

[0068] In the embodiment, the above weights are... Results and corresponding hypersurface singularity indices for cache block nodes Perform collaborative update operations to update the hypersurface singularity index. The value of the high-conflict cache subgraph is then recalculated. .

[0069] For example, when a user continuously modifies the background blur intensity of an image, the system reduces the weight of older cached blocks and updates their conflict metrics, ultimately retaining only the latest valid version and discarding redundant old data. When a user performs an undo operation, the system enhances the weight of nodes on the rollback path and adjusts their conflict metrics accordingly to ensure that the relevant cache is effectively preserved, thus supporting rapid rollback.

[0070] To support the aforementioned weight calculation and policy execution, this embodiment defines two pieces of data: cache block group. and path Cache block cluster This refers to the user's most recentk This is an associated set of all cache blocks generated by AI image retouching operations of the same type. It includes the corresponding operation paths. The construction may include the following steps: From the node representing the current operation Start along the operation-dependent edges Backtracking k Step 1: Extract the path The requirement is that the operation type of all nodes on the path must be consistent with the current operation type, i.e., satisfying the condition... ( ).

[0071] Among them, cache block group Integrated Time Decay Hypersurface Weights Used for quantizing paths The timeliness and conflict avoidance needs are represented by the following data:

[0072] This formula applies to paths. Each node Calculate the product of the two factors, including the exponentially decaying term. Based on node timestamps The difference from the current time t This reduces the weight contribution of historical nodes, with older nodes experiencing greater weight decay. (Conflict suppression term) Singularity index of hypersurface Nodes are penalized with zero weight.

[0073] Based on this, the synergistic effect of the two factors ensures that the final calculated path weight can simultaneously reflect the timeliness and low conflict characteristics of the nodes.

[0074] Based on path weights, the system can also implement differentiated dynamic weight adjustments according to different user behavior patterns. Specific steps may include: For example, the weight is increased when the operation type is switched. Specifically, when a user switches the type of photo editing operation, such as from skin smoothing to blurring, the path corresponding to the new operation type will be promoted. Below, cache block group The cache value weight of nodes of the same type as the current operation. The calculation formula is:

[0075] Among them, indicator function Used to filter Nodes with the same operation type as the current operation; learning rate Control the magnitude of incremental updates. The weight adjustment mechanism when switching operation types ensures that weight increases only apply to nodes of the target operation type, effectively avoiding interference between cross-type operations.

[0076] For example, when parameters are repeatedly fine-tuned, weights are suppressed. Specifically, when a user repeatedly adjusts the same image editing parameters, it can easily lead to high conflict and redundancy; therefore, it can be based on... of The coefficient reduces the corresponding weight of the corresponding node. The calculation formula is: The formula first calculates the normalized singularity index entropy value of nodes within a high-conflict subgraph, and then uses the sensitivity coefficient... Control the magnitude of weight decay. A higher entropy value indicates greater disorder, and a more significant node weight decay, thereby effectively suppressing the cache resource consumption of highly redundant areas.

[0077] For example, the weight is restored when an undo operation is performed. Specifically, when a user performs an undo operation, the path corresponding to the operation before undoing is restored. The weight of the cache block group nodes. The calculation formula is:

[0078] This formula locates the previous operation path. The nodes in the time decay factor Restore its weights (where γ >1), when the time difference The smaller the value, the greater the recovery strength. ), and simultaneously through indicator functions By constraining that only nodes on specific paths participate in the calculation, we ensure that only nodes on that specific path participate in the calculation, thus achieving precise rollback weight boosting.

[0079] Based on this, by identifying user behavior in real time and adjusting cache weights accordingly, the system can simultaneously optimize caching efficiency for multiple user scenarios. Furthermore, by establishing a closed-loop system for the coordinated update of weights and conflict indicators, dynamic adjustment of conflict states is achieved, resolving the issues of poor adaptability and inability to distinguish operational intentions in AI image editing scenarios.

[0080] Based on the above embodiments, in another embodiment provided in this disclosure, the above-mentioned dynamic adjustment of the hypersurface value weight of each node in the dynamic cache topology based on the user's real-time operation sequence may include: Based on the similarity between real-time operation sequences and historical operation sequences, the associated cache block groups are determined; When a user switches the type of image editing operation, increase the hypersurface value weight of the node in the cache block group corresponding to the new image editing operation type. When a user repeatedly adjusts the same image editing parameters, reduce the hypersurface value weight of the corresponding node in the high-conflict cache subgraph; When a user performs an undo operation, the hypersurface value weight of the node in the cache block group associated with the operation before undoing is increased.

[0081] In this embodiment, based on the constructed dynamic cache topology, the cloud disk client quantifies the value weight of each cache block group in real time through dynamic weight adjustment and hypersurface topology retrieval, thereby achieving more refined cache management.

[0082] Among them, the associated cache block groups are determined based on the similarity between the current image editing operation in the real-time operation sequence and the historical image editing operation in the historical operation sequence.

[0083] Specifically, whenever a user performs the next AI photo editing operation, the client synchronously retrieves the most recent... Paths with the same operation This forms a cache block group. Calculate the combined time decay hypersurface weights of the cache block cluster. Simultaneously, search for high-conflict subgraphs. The degree of redundancy and disorder in a region is quantitatively assessed by calculating its entropy value.

[0084] Based on the results of the above real-time calculations, the system will implement a dynamic weight adjustment strategy according to the user's current behavior pattern, thereby optimizing the distribution of cached value. Specific steps may include: When a user switches to a different photo editing operation type, the path to the new operation will be improved. cache block group The corresponding weights of the middle nodes This ensures that system resources can be quickly allocated to the user's current active operating context.

[0085] When a user is repeatedly fine-tuning the same image editing parameters, the system will use the high-conflict sub-image as the basis for the adjustment. The entropy value reduces the hypersurface value weight of the corresponding node within the subgraph. This proactively suppresses the disorderly growth of redundant caches and frees up memory space.

[0086] If the user performs an undo operation, then elevate the previous operation's similar path. The corresponding weights of nodes in the cache block group below This enhances the effectiveness of caching on the rollback path, ensures a smooth experience during undo operations, and enables rapid state recovery.

[0087] For example, Figure 3This is a schematic diagram illustrating the process of adjusting the dynamic cache topology based on user operations, provided in an embodiment of this disclosure.

[0088] Based on this, by identifying user behavior in real time and adjusting cache weights accordingly, the system can simultaneously optimize caching efficiency for multiple user scenarios. Furthermore, by establishing a closed-loop system for the coordinated update of weights and conflict indicators, dynamic adjustment of conflict states is achieved, resolving the issues of poor adaptability and inability to distinguish operational intentions in AI image editing scenarios.

[0089] Based on the above embodiments, in another embodiment provided in this disclosure, updating the hypersurface singularity index of each node based on the adjusted hypersurface value weight of each node may include: The difference between the hypersurface value weight of each node and the global average weight is calculated. Based on the discrepancy results, update the hypersurface singularity index of each node.

[0090] In the embodiment, the above weights are... The results and the hypersurface singularity index of the corresponding cache block node Perform collaborative update operations to update the hypersurface singularity index. The value of the high-conflict cache subgraph is then recalculated. The calculation formula is as follows:

[0091] Here, the node weights are compared. Compared with the global mean Maximum value The relative differences, through the modulating factor control The adjustment range. Nodes with weights higher than the mean have their weights reduced. Conversely, it improves, forming an adaptive conflict adjustment mechanism.

[0092] Based on the above embodiments, in another embodiment provided in this disclosure, the above method may further include: Based on the updated hypersurface value weights of each node, the weights of the operation dependency edges and conflict detection edges associated with the nodes are calculated respectively. Nodes whose hypersurface value weight is lower than the first threshold and whose hypersurface singularity index is lower than the second threshold are identified as isolated nodes and removed from the dynamic cache topology.

[0093] In this embodiment, each time a user performs a new AI image editing operation, it is necessary to update the dynamic cache topology DCTS and the hypersurface singularity index of each node. High-conflict cache subgraph Real-time updates can specifically include: based on the updated Re-extract For dependent edges and conflict sides weight According to the new weights Recalculate. Remove. and The isolated nodes are cleaned up to clear the topology and release the memory resources they occupy.

[0094] Based on the above embodiments, in another embodiment provided in this disclosure, the determination of associated cache block groups based on the similarity between real-time operation sequences and historical operation sequences may include: Starting from the node corresponding to the real-time operation sequence, backtrack along the operation dependency edge by a preset number of steps to form the operation path; Merge the cache blocks corresponding to all nodes in the operation path that have the same image editing operation type as the real-time operation sequence into a cache block group; If a high-conflict node is detected during the backtracking process, the preset number of steps for reverse backtracking is shortened.

[0095] In this embodiment, two data items are defined: cache block group. and path Cache block cluster This refers to the user's most recent k This is an associated set of all cache blocks generated by AI image retouching operations of the same type. It includes the corresponding operation paths. The construction may include the following steps: From the node representing the current operation Start along the operation-dependent edges Backtracking k Step 1: Extract the path The requirement is that the operation type of all nodes on the path must be consistent with the current operation type, i.e., satisfying the condition... ( ).

[0096] If the operation path contains For high-conflict nodes, shorten the backtracking step size to To avoid conflict zones.

[0097] For example, the process can be represented as:

[0098] Among them, the system backtracks along the dependency edges. k Step nodes, filter out all those related to the current operation Cache blocks of the same type And merge them into a unified set. .

[0099] Based on this, the above process uses a hash table to achieve fast node type retrieval, ensuring a time complexity of O(n log n). It can automatically exclude operations with incorrect types. Interference nodes.

[0100] Based on the above embodiments, in another embodiment provided in this disclosure, the selection of cache data to be replaced from intermediate cache data based on association relationships may include: Based on the updated hypersurface singularity index and high-conflict cache subgraph, the priority score of each node in the dynamic cache topology is determined, and a candidate replacement queue is generated based on the priority score. A mirror topology is constructed based on the candidate replacement queue, and a stability score is obtained by stress testing the mirror topology. Determine the target mirror topology and target replacement strategy based on stability scores; Based on the target replacement strategy, the target mirror topology is applied to the dynamic cache topology to update the intermediate cache data.

[0101] In this embodiment, a priority score is calculated for each node based on the updated hypersurface singularity index and the high-conflict cache subgraph. The priority score can be evaluated from four dimensions: conflict propagation assessment, temporal chaotic mapping, intra-group singularity covariance, and non-uniform topological embedding, and is obtained using a geometric mean algorithm. Finally, all nodes are sorted according to their scores, and a candidate replacement queue is generated.

[0102] When insufficient memory triggers cache replacement, multiple mirror topologies employing different node removal and edge reconstruction rules can be constructed in parallel based on a candidate replacement queue. Subsequently, each mirror is subjected to tiered stress testing to obtain a stability score. This stability score is used to quantitatively evaluate the potential impact of different replacement strategies. Finally, a target replacement strategy is determined from a predetermined strategy set based on the stability score.

[0103] Specifically, based on the weighted stability score of each type of mirror topology. As a result, based on the hierarchical decision table in Table 1 below, the corresponding cache replacement strategy is executed: Table 1 Hierarchical Decision Table

[0104] As shown in Table 1, when Replace the original topology directly. Prune and graft high-priority nodes when necessary; otherwise, downgrade and replace some low-priority nodes.

[0105] Based on the target replacement strategy, the original dynamic cache topology is fused with the target image topology to obtain an updated dynamic cache topology, and intermediate cache data in the subsequent AI image retouching process is managed according to the updated dynamic cache topology.

[0106] Based on this, the introduction of a hypersurface singularity index enables precise quantification and topological identification of cache singularities, resolving the technical problem of the inability to quantify cache conflicts. Secondly, by dynamically adjusting the hypersurface value weights of each node in the dynamic cache topology based on real-time user behavior, the caching strategy transforms from static rules into an adaptive process driven by user behavior, addressing the technical issues of lacking parameter correlation analysis and adaptive capabilities. Furthermore, by generating a candidate replacement queue through multi-dimensional scoring and then selecting a target replacement strategy through parallel image construction and stress testing, the technical problem of a single replacement strategy is resolved.

[0107] Based on the above embodiments, in another embodiment provided in this disclosure, determining the priority score of each node in the dynamic cache topology may include: Calculate the hypersurface singularity diffusion evaluation score, timestamp chaotic mapping score, intra-group singularity covariance score, and non-uniform degree embedding score of the node respectively; Priority scores for each node are generated by fusing hypersurface singularity diffusion evaluation scores, timestamp chaotic mapping scores, intra-group singularity covariance scores, and non-uniform degree embedding scores using a geometric mean algorithm.

[0108] In this embodiment, the cloud disk client is based on the hypersurface singularity index. High-conflict cache subgraph These parameters trigger a multi-layered, cross-dimensional coupled computation process. The core objective of this process is to transform all cache block nodes in the Dynamic Cache Topology (DCTS) into a globally sortable priority queue, which serves as the basis for adaptive cache replacement decisions when the terminal is experiencing insufficient memory or resource constraints.

[0109] To achieve the above goals, a hypersurface diffusion priority score needs to be calculated for each cache block node. The score is calculated by fusing four dynamic sub-indicators, which can include: conflict diffusion assessment, temporal chaotic mapping, intra-group singularity covariance, and non-uniform topological embedding.

[0110] Specifically, we first calculate the sub-scores for each of these four dimensions for each node, including: hypersurface singularity diffusion evaluation score. Timestamp Chaotic Mapping Score Singularity covariance score within the group Non-uniform degree embedding score .

[0111] Subsequently, the sub-scores of the four dimensions can be fused using nonlinear transformation and geometric averaging to ultimately generate the hypersurface diffusion priority score. .

[0112] Specifically, by combining the above four-dimensional sub-scores and fusing them through geometric mean, the hypersurface diffusion priority score is obtained. :

[0113] This formula achieves non-linear coupling of multi-dimensional scoring. Taking the fourth root of the product of the four-dimensional scores ensures that a low score in any one dimension significantly lowers the overall score, making the fusion method more penalizing than the arithmetic mean. This design mandates that candidate replacement nodes perform well across all four dimensions—conflict, timing, local fluctuations, and topological connectivity—effectively avoiding misjudgments caused by a node's advantage in a single dimension, and significantly improving the overall robustness of cache replacement decisions.

[0114] For example, Figure 4 This is a schematic diagram of the process for calculating priority scores provided in an embodiment of this disclosure.

[0115] Based on the above embodiments, in another embodiment provided in this disclosure, the above-mentioned calculation of the hypersurface singularity diffusion evaluation score, timestamp chaotic mapping score, intra-group singularity covariance score, and non-uniformity degree embedding score of the node may include: The hypersurface singularity spread evaluation score of a node is calculated based on the hypersurface singularity index of its neighboring nodes in the high-conflict cache subgraph. Based on the timestamps of nodes and neighboring nodes, the timestamp chaotic mapping score of nodes is calculated using a chaotic mapping function. The node's intra-cluster singularity covariance score is calculated based on the sliding window covariance of the node's hypersurface singularity index within the cache block cluster and the node's hypersurface value weight. The non-uniform degree embedding score of a node is calculated based on its weighted degree in the dynamic cache topology.

[0116] In this embodiment, in order to comprehensively evaluate the replacement priority of each cache node, the nodes can be quantitatively scored from four dimensions to generate a priority score for each node.

[0117] First, the hypersurface singularity diffusion assessment score reflects the degree of local influence and risk diffusion of a node in a high-conflict region. The hypersurface singularity diffusion assessment score is calculated based on the hypersurface singularity index of the node's neighboring nodes in the high-conflict cache subgraph. It is generated by analyzing the difference in singularity gradient between the node and its surrounding high-conflict nodes, combined with the node's own cache value weight, and then through nonlinear mapping.

[0118] Secondly, timestamp-based chaotic mapping scores are used to break the linear dependence on time series and enhance the ability to perceive irregular operation intervals. The timestamp-based chaotic mapping score is based on the node's own timestamp and the timestamps of its direct predecessor and successor nodes. It is transformed into a chaotic value using a chaotic mapping function such as an improved Fibonacci hash, then the difference between this value and the current chaotic value is calculated, and finally obtained through an exponential decay mapping. This calculation method ensures that recently visited nodes receive higher scores, while the scores of historical nodes decrease exponentially with the chaotic time difference, thus more accurately assessing timeliness.

[0119] Secondly, the intra-group singularity covariance score is used to evaluate the parameter adjustment stability and value weight of a node within its respective cache block group. This score measures the drastic fluctuations in the local parameter space by calculating the sliding window covariance of the node's hypersurface singularity index within the cache block group, and then normalizes and compresses it by combining it with the node's own hypersurface value weight. The calculation method of the intra-group singularity covariance score ensures that high-value nodes are not mistakenly replaced in regions of active parameter adjustment.

[0120] Finally, the non-uniform degree embedding score is used to evaluate the importance of nodes from the perspective of topological connectivity. The non-uniform degree embedding score is calculated based on the weighted degree of a node in the dynamic cache topology, which combines the similarity weights of all its operation-dependent edges and the conflict weights of conflict-detection edges. By performing a non-linear transformation and global normalization on the weighted degree, the centrality advantage of height-numbered nodes is reflected while preventing excessive score saturation, resulting in a balanced distribution of topological dimension scores.

[0121] Based on this, priority scores for nodes are generated by calculating the hypersurface singularity diffusion evaluation score, timestamp chaotic mapping score, intra-group singularity covariance score, and non-uniform degree embedding score of nodes. This solves the technical problem in related technologies where the replacement strategy rules are simple and static, making it difficult to adapt to changing user operation modes.

[0122] Based on the above embodiments, in another embodiment provided in this disclosure, the calculation of the hypersurface singularity diffusion evaluation score of a node based on the hypersurface singularity index of its neighboring nodes in the high-conflict cache subgraph may include: Determine the set of neighboring nodes of a node within a specific topological distance in a high-conflict cache subgraph; Calculate the gradient of the hypersurface singularity index between the node and each node in the set of neighboring nodes, and obtain the singularity gradient value; Based on the node-based hypersurface value weights and hypersurface singularity indices, the singularity gradient values ​​are nonlinearly mapped and compressed to obtain the hypersurface singularity diffusion evaluation score.

[0123] First, construct the conflict-spreading neighbor set. In the high-conflict subgraph... In the process of locating the target node of -hop neighbors (default) k =2), forming a set of conflict propagation nodes, which can be defined as:

[0124] in, x This indicates the relationship between nodes in the dynamic cache topology. All nodes whose topological distance is ≤2. From the above formula, it can be seen that the first step is to locate the nodes in DCTS. Topologically adjacent nodes, including predecessors successor and other nodes within 2 steps of the topological distance. Then, from this set of adjacent nodes, the hypersurface singularity index is selected. High-conflict nodes with a conflict value >0.5 eventually form a conflict propagation set. .

[0125] Next, the singularity gradient of the neighboring nodes is calculated. The singularity gradient is the gradient of the node. The singularity index difference between it and its conflicting neighbors, i.e., the singularity gradient. The calculation formula can be:

[0126] Singularity gradient quantization of nodes The difference in conflict states between it and its highly conflicting neighbors is determined by traversing the set. Each neighbor node in Calculate its singularity index Singularity index of target node The absolute difference is calculated, and the arithmetic mean of all differences is taken to obtain the gradient value. The larger this value, the more significant the difference in the degree of conflict between the target node and its surrounding nodes.

[0127] Finally, the singularity gradient Weighted by the cache value of this node The mixture is fused and the final product is generated through nonlinear mapping. Score. The calculation formula is:

[0128] This implements a non-linear mapping for conflict scoring, first by calculating the gradient. With node weights The product of, then divided by (Minimum truncation value of 0.1 to prevent division by zero), finally compressed using the Sigmoid function to... Interval.

[0129] Based on the above embodiments, in another embodiment provided in this disclosure, the above-mentioned calculation of the node's timestamp chaotic mapping score using a chaotic mapping function based on the node's timestamp and the timestamps of neighboring nodes may include: Extract the timestamps corresponding to the node, its predecessor node, and its successor node; Based on the timestamps of the predecessor and successor nodes, chaotic mapping values ​​are generated through bitwise operations and modular multiplication. The difference between the chaotic mapping value of the node and the chaotic mapping value at the current time is calculated, and the difference is mapped to a timestamp chaotic mapping score through an exponential decay function.

[0130] In the embodiment, the timestamp chaotic mapping score The calculation aims to enhance the perception of irregular operation intervals through chaotic mapping, thereby quantifying the timeliness of nodes. The specific calculation process may include: First, extract the target cache block node. and its direct temporal neighbors timestamp .

[0131] Furthermore, the Fibonacci hashing method is used to transform the time-series data into a chaotic sequence:

[0132] Here, time-series data is transformed into chaotic values, and during execution, adjacent timestamps are... and Perform bitwise XOR ( ), multiplied by the golden ratio Modulo normalization is then performed. This process is implemented through bitwise operations and modular multiplication. The pseudo-random mapping with varying complexity effectively breaks the linear characteristics of the original time series, thereby enhancing the ability to capture irregular intervals of user operations.

[0133] Finally, timestamp chaotic mapping scores are calculated based on the generated chaotic sequences. :

[0134] This formula quantifies the timeliness of nodes. First, the current time is calculated. and target time Improved Fibonacci hashing for generating chaotic sequences Then calculate their absolute difference and divide by the scaling factor. Finally, a decay score is generated using an exponential function. This design makes the score of the nearest node approach 1 (…). The scores of historical nodes decrease with the chaotic time difference exponent, thus accurately reflecting the priority in the time dimension.

[0135] Based on the above embodiments, in another embodiment provided in this disclosure, the calculation of the node's intra-group singularity covariance score based on the sliding window covariance of the hypersurface singularity index within the cache block group where the node resides and the node's hypersurface value weight may include: Within the cache block group, with nodes as the center, calculate the covariance of the hypersurface singularity index of the node within the sliding window; Multiply the hypersurface value weight and covariance of the node, and then normalize it using the global maximum covariance value. The normalization result is compressed using the hyperbolic tangent function to obtain the covariance score of singularities within the group.

[0136] In the example, the covariance score of singularities within the group is calculated. This aims to evaluate the parameter adjustment volatility of nodes within a locally associative cache block group and to provide a comprehensive score based on their weight values. The specific calculation process may include: First, in the cache block group where the target node is located X Internally, calculate the singularity index of the hypersurface. Sliding window covariance, setting the window size L =3, the formula for calculating covariance is:

[0137] The covariance calculation formula analyzes the volatility of the singularity index within the sliding window. Specifically, in the cache block group... X In the middle, take Calculate the singularity index of each consecutive node. mean Then sum the variances. The larger the covariance value, the more drastic the parameter adjustment in that local region. Therefore, it is necessary to increase the replacement priority of the nodes in that region to maintain the overall stability of the caching system.

[0138] Subsequently, the cache value weight of this node was combined. Normalization is performed to generate the final intra-group singularity covariance score. :

[0139] This formula achieves a dynamic fusion scoring of weights and volatility dimensions. First, the weight of the current node is calculated. Covariance of the singularity in its local region The product of these factors is then normalized by dividing by the global maximum covariance value, and finally normalized using the hyperbolic tangent function. The results are compressed to the (0,1) interval. This allows the score to simultaneously reflect the node's own weight value and the degree of fluctuation in local parameters, when the node weight... The value is relatively high, and the parameters in the region are adjusted drastically (i.e., When the value is large, the node can obtain a high score close to 1, thus ensuring that high-value cache blocks in the active adjustment area are not erroneously replaced, effectively protecting critical intermediate state data.

[0140] Based on the above embodiments, in another embodiment provided in this disclosure, the calculation of the non-uniform degree embedding score of a node based on its weighted degree in the dynamic cache topology may include: The weighted degree of a node is obtained by summing the weights of all edges on which its operations depend and the weights of all edges on which collisions are detected. The weighted degree is processed by hyperbolic tangent transformation to obtain the non-uniform degree embedding score.

[0141] In the embodiment, the non-uniformity embedding score is calculated. This method aims to comprehensively evaluate the connectivity importance of nodes in a Dynamic Cache Topology (DCTS) while avoiding excessive dominance of height-numbered nodes in the scoring. Specific calculation steps may include: First, compute nodes The weighted degree, which combines the weight information of the two types of edges of the node, is calculated using the following formula:

[0142] The weighted degree is calculated by accumulating the nodes separately. All operations depend on edges. Similarity weight and all conflict detection edges Conflict weights This yields a weighted value that comprehensively considers topological connectivity strength and conflict correlation.

[0143] Next, the weighted degree is processed by hyperbolic tangent transform to generate a normalized non-uniform degree embedding score. :

[0144] Here we first calculate the weighted degree of all nodes. conduct Transformation, where Normalization is achieved by controlling the curvature of the transformation and then dividing by the global maximum value. This process retains the advantages of high-number nodes while also utilizing... Function saturation prevents it from completely dominating the scoring, allowing topological dimension scoring to take precedence. Evenly distributed in Within the range.

[0145] Based on the above embodiments, in another embodiment provided in this disclosure, the above-mentioned generation of a candidate replacement queue based on priority scores may include: Sort the priority scores of all nodes. The number of nodes in the candidate replacement queue is dynamically determined based on the current memory usage pressure. Based on priority scores, nodes with the same number of nodes are selected to form a candidate replacement queue.

[0146] In the embodiment, based on the calculated hypersurface diffusion priority score Sort all cache block nodes in descending order and select the top M nodes to generate an adaptive-sized candidate replacement queue. The queue size M is not fixed, but dynamically adjusted adaptively based on real-time memory pressure. The adjustment formula is as follows:

[0147] By monitoring the percentage of memory used in real time The candidate set size M is expanded linearly. When memory pressure is low, the base size is maintained. As memory pressure increases, it can be expanded to a maximum of [number missing]. By using the floor function By ensuring that M is an integer, this mechanism achieves a good balance between memory utilization and the computational overhead of replacement decisions, avoiding the problems of insufficient resource utilization or system overload that may be caused by a fixed queue size.

[0148] In this embodiment, to ensure the real-time performance and accuracy of the replacement queue, the system triggers a recalculation of the priority scores of all nodes after each weight adjustment. Based on this, a new candidate replacement queue is generated. .

[0149] Based on this, by using an adaptive-scale queue generation mechanism, the replacement decision is deeply bound to the real-time system resource status, which solves the problem of poor adaptability of fixed strategies in resource fluctuation scenarios and the technical problem of cache replacement algorithms having a single decision dimension and being unable to balance complex influencing factors.

[0150] Based on the above embodiments, in another embodiment provided in this disclosure, the mirror topology structure includes: a global topology mirror structure, a local topology mirror structure, and an incremental topology mirror structure; the above-mentioned construction of the mirror topology structure based on the candidate replacement queue includes: Atomic removal is performed on nodes that meet the removal conditions in the candidate replacement queue, and the operation dependency edges and conflict detection edges of the surviving nodes are reconstructed to generate a global topology mirror structure. Based on the time-series preservation weight, nodes in the candidate replacement queue are selectively pruned, and the conflict detection edges of the surviving nodes are reconstructed to generate a local topological mirror structure. Calculate the neighbor-aware decay weights of nodes in the candidate replacement queue, reconstruct the bidirectional shadow edges of the nodes, and generate an incremental topological mirror structure.

[0151] In this embodiment, the candidate replacement queue is equivalent to a priority queue.

[0152] In this example, during AI image editing, a user triggers a cache data replacement request due to insufficient memory resources. At this time, the client uses a priority queue. A parallel pipeline architecture is used to construct three types of differentiated mirror topologies, namely, a global topology mirror structure. Local topological mirror structure Incremental topology mirror structure The specific construction process is as follows: Among them, constructing a global topology mirror structure The steps may include: First, a full copy of the original DCTS is created as the base image. Then, for priority queues... Each node in Perform the following sequence of operations: Traversal For satisfying For each node, first calculate its corresponding topological influence index:

[0153] The topological influence index combines the degree percentage of nodes with their hypersurface singularity index. When When a node is identified as a critical node, its connection information needs to be additionally recorded during removal; when If the value is 1, the node is considered very important and will not be removed; it will be retained directly.

[0154] Furthermore, for the parameter vector θ of the removed node... i The sliding window differential compression algorithm is used for processing:

[0155] With nodes The mean of the sliding window of the parameters in the first three steps is used as the baseline for differencing. If there are data gaps within the window (such as...), i If <4), then the forward fill strategy should be used instead:

[0156] The compressed data is based on its topological influence index. Sort and store the data according to weights.

[0157] Finally, the original edge relationships are adaptively adjusted. For edges where both ends of the node are alive... Adjust its weight to That is, based on the influence index of the removed node. The weight of associated edges is proportionally decayed. Then, in nodes that have been removed... Two nearest neighbors Establish a proxy edge between them, and calculate its weight as follows:

[0158] That is, the proxy edge weight is determined by 50% of the maximum edge weight in the entire network and the standardized value of the degree of the neighboring node, in order to maintain the connectivity of the topology.

[0159] Furthermore, a local topological mirror structure is constructed. Perform selective node pruning on the original DCTS replica: First, select the hypersurface diffusion priority score. The nodes are used as the initial selection set. Then, nodes that simultaneously satisfy the weight are excluded from this set. And hypersurface singularity index Nodes with a value less than 0.4 are selected to prevent the accidental deletion of high-value, low-conflict nodes. The final set of selected nodes is denoted as... .

[0160] For nodes retained in the mirror Calculate time-series weights:

[0161] This formula uses the Sigmoid function to weight the nodes. Mapping to the (0,1) interval, while utilizing indicator functions I For the most recent The preference offset value is increased by 0.1 for each node visited within a minute. For the time-sensitive window. If the calculated If the value is less than 0.4, the node still needs to be removed.

[0162] For collision detection edges that retain nodes, perform weight adjustment:

[0163] in, It directly reflects the exponential strength of the conflicting hypersurface singularity of the node pair.

[0164] Finally, construct an incremental topology mirror structure. The incremental topology mirroring structure adopts a progressive strategy, preserving... The nodes in the process reduce their influence. Specific steps may include: right Each node in Calculate the neighbor perception attenuation weight:

[0165] As can be seen from the above formula, first obtain Minimum cache weight of all neighboring nodes The new weights are a mixture of 20% of the original weights and 80% of the smallest neighbor weights. If after decay... If the value is less than 0.1, the node is downgraded to a shadow node.

[0166] Furthermore, for each decayed node Find the shortest side weight distance with it. The three nearest neighbors are identified, and bidirectional shadow edges are established. The weights of the shadow edges are calculated using a geometric mean correction formula:

[0167] This formula compresses the weight difference between two nodes through square root operation, and also... This is used to punish cases where the difference in singularity exponents of hypersurfaces is too large.

[0168] Finally, calculate the balance factor of the mirror image:

[0169] The above formula, after excluding isolated nodes, obtains the ratio of the minimum node degree to the average degree, and the proportion of quantized shadow edges to the total number of edges. Then, the 10% of nodes with the lowest degree are supplemented with connections. A node is the node with the highest weight in the current topology, used to enhance the connectivity and balance of the topology.

[0170] For example, Figure 5 This is a schematic diagram illustrating the process of constructing a mirror topology and a target replacement strategy provided in an embodiment of this disclosure.

[0171] Based on this, by constructing three different strategy-oriented mirror structures based on the same original topology, the system can fully simulate the potential impact of different replacement strategies in a virtual environment before actually executing the replacement.

[0172] Based on the above embodiments, in another embodiment provided in this disclosure, the stability score obtained by stress testing the above-mentioned mirror topology may include: Perform tiered stress tests on each mirror topology; the tiered stress tests include basic replay tests, parameter perturbation injection tests, and extreme rollback tests. Based on the results of the graded stress test, multiple stability evaluation indicators were obtained. The stability score of the mirror topology is obtained by weighted summation of multiple stability evaluation indicators.

[0173] In this embodiment, after constructing the three types of differentiated mirror topologies, hierarchical playback tests are performed to calculate weighted stability scores. This is to quantitatively evaluate the performance and robustness of each mirror structure under simulated real loads.

[0174] The tiered replay test includes: basic replay test, parameter perturbation injection, and extreme rollback.

[0175] In this embodiment, the basic replay test is used to evaluate the caching support capability of the mirror topology for recent and historical operations. A basic replay operation needs to be performed for each type of mirror topology. The basic replay test may specifically include the following steps: First, construct a test sequence of 8 operations. The test sequence consists of two parts: the 5 most recently executed operations. And from a historical time window arrive Three operations randomly selected from within If the number of actual operations within a historical time window is less than three, then linear interpolation is used to generate virtual operations to make up the difference. The interpolation formula is as follows:

[0176] The above formula first detects to The actual number of operations within the time window, when the number of effective operations... At that time, based on the two most recent valid operations and parameter vector , Three virtual operations are generated through linear interpolation. 、 、 .

[0177] Then, the above test sequence is executed sequentially, and the cache hit status is monitored in real time. Strict matching is applied to recent operations. That is, traversing all nodes in the current topology. Calculate its parameters With operation parameters The Euclidean distance, when there exists The system returns 1 if a node is found, indicating a match; otherwise, it returns 0, indicating a miss. Fuzzy matching is used for historical operations.

[0178] Finally, by combining the results of strict matching and fuzzy matching, the test hit rate of the image is calculated:

[0179] The formula calculates the hit rate of the most recent 5 operations, while also evaluating the hit rate of 3 randomly selected historical operations, and assigns a low weight of 0.2 to the historical hit rate to balance the impact of new and old data in the evaluation.

[0180] In this embodiment, the parameter perturbation injection test is used to evaluate the robustness of the mirror topology when the input parameters are noisy or fluctuating. The parameter perturbation injection test may specifically include the following steps: First, the parameter vector for each retouching operation in the test sequence. Apply a uniformly distributed random perturbation:

[0181] The formula is for Each dimension is applied independently Uniformly distributed perturbations within the range. An additional ±10% systematic offset is applied to key parameters to simulate more extreme user adjustments.

[0182] Furthermore, based on the parameters before and after the disturbance, the topological robustness of the mirror image is calculated:

[0183] The relative difference between the original parameters and the perturbation parameters calculated in the molecular model can be normalized by dividing by the maximum of their absolute values ​​to avoid the influence of dimensions. The average of the five tests is then inverted to obtain the stability score.

[0184] In this embodiment, the extreme rollback test is used to evaluate the performance of the mirrored topology when supporting users to perform undo / rollback operations. The extreme rollback test may specifically include the following steps: First, the image retouching operation is performed to simulate a rollback. The rollback path is found using an improved Dijkstra algorithm to find the minimum weight rollback path:

[0185] This model transforms rollback path planning into a weighted graph search problem, with edge weights (1...). W ( e This causes the algorithm to prioritize high-confidence paths, where... The time cost approaches 0.

[0186] Then, simulate the execution of the above rollback path and estimate its time cost:

[0187] The above formula first obtains the hardware-related baseline time through benchmark testing. (Typically 10-50ms), rollback path Topological influence index of all nodes It will add extra latency with a weight of 0.5.

[0188] Based on the results of the three tests above, a final weighted stability score is calculated for each type of mirror topology. Its formula is:

[0189] The various indicators and their weightings are as follows: Cache topology hit rate (Weight 0.25) is used to measure the hit performance in the basic replay test; Topology delay efficiency (Weight 0.2) is used to measure the efficiency of rollback operations. Maximum allowable delay; Topological balance (Weight 0.15) is used to measure the connectivity uniformity of the mirror topology; Cache replacement cold start rate (Weight 0.1) is used to quantify the proportion of cache invalidation caused by replacement; Topological disturbance resistance (Weight 0.1) is used to measure the robustness of the system to parameter disturbances; Storage bloat rate (Weight 0.1) is used to measure the increase in storage overhead of the mirrored topology relative to the original topology; Conflict suppression coefficient (Weight 0.1) is used to evaluate the effect of mirroring on suppressing highly conflicting nodes.

[0190] Based on this, a three-level stress test was conducted on each image from three key dimensions: operational continuity, system robustness, and state recoverability. This multi-dimensional evaluation of the image topology was performed. Through image construction and stress testing, two major technical problems in cache replacement schemes were solved: poor robustness of replacement decisions and lack of consequence assessment; and the difficulty in achieving a balance between memory release and performance maintenance.

[0191] Based on the above embodiments, in another embodiment provided in this disclosure, applying the target mirror topology structure to the dynamic cache topology structure based on the target replacement strategy may include: When the target replacement strategy is a direct replacement strategy, the global topology mirror structure that meets the preset high score conditions is determined as the target mirror topology structure; The target image topology is switched to the currently working dynamic cache topology through a double-buffering mechanism; The parameter vectors of the nodes to be replaced are sorted by topological influence index and then compressed and stored. Trigger the global cache preheating mechanism to prioritize loading intermediate cache data related to the most recent image editing operation.

[0192] In this embodiment, the direct replacement strategy is applicable to global mirror structures that perform well in stress testing. Therefore, when the target replacement strategy is the direct replacement strategy, the global topology mirror structure that meets the preset high score conditions is determined as the target mirror topology structure.

[0193] During execution, the system first freezes write operations on the original DCTS to ensure state consistency. Then, a double-buffering mechanism is used to mirror the global image. Seamlessly switch to the production environment.

[0194] Next, the system completely copies the attributes of all nodes in the image. And ensure data integrity through hash value verification.

[0195] Then, strictly following the topology of the global mirror, all operation-dependent edges and conflict detection edges are restored, with the operation-dependent edges maintaining their original weights. The conflict detection edge will reset its weight to For the set of nodes removed from the topology parameters The system is based on its topological influence index Γ i After sorting, use The Packing algorithm performs efficient compressed storage while simultaneously... i Record to a separate index file.

[0196] After the replacement is completed, the system releases the memory occupied by the original DCTS and immediately triggers global cache preheating, prioritizing the loading of node data most closely related to the 5 most recent user operations in order to quickly restore performance.

[0197] Based on this, the direct replacement strategy enables fast and lossless switching of high-performance images.

[0198] Based on the above embodiments, in another embodiment provided in this disclosure, applying the target mirror topology structure to the dynamic cache topology structure based on the target replacement strategy may include: When the target replacement strategy is the pruning and grafting strategy, the mirror topology that meets the preset qualification conditions is determined as the target mirror topology. From the target image topology, extract nodes with high cache value weights as the set of nodes to be grafted; Calculate the grafting fit of the node to be grafted and determine the grafting position in the original dynamic cache topology; Construct cross-topology edges at the grafting location and perform local edge rebalancing operations on nodes with excessively high connectivity after grafting.

[0199] In this embodiment, the pruning and grafting strategy is applicable to local mirror images that perform satisfactorily in the test. Therefore, when the target replacement strategy is the pruning and grafting strategy, the mirror topology that meets the preset passing conditions is determined as the target mirror topology. The execution process may include: First, extracting a set of high-value nodes from the mirror image:

[0200] Calculate the grafting fit of each candidate node. .

[0201] Subsequently, in the original DCTS, for each Find the optimal grafting location. Using the Approximate Nearest Neighbor (ANN) algorithm, locate the location that satisfies... and target node and in and Establish cross-topology edges The weights are initialized to .

[0202] Finally, a balance check is performed on the new topology after grafting. If any node's degree exceeds the limit... If this occurs, a local rebalancing mechanism is triggered, randomly disconnecting 10% of the connecting edges of the node with the highest degree and redistributing them to nodes with lower degree.

[0203] Based on this, the pruning and grafting strategy optimizes the structure while preserving core data assets through precise transplantation of high-value nodes and topology rebalancing.

[0204] Based on the above embodiments, in another embodiment provided in this disclosure, applying the target mirror topology structure to the dynamic cache topology structure based on the target replacement strategy may include: When the target replacement strategy is a hybrid degradation strategy, the number of nodes to be removed is calculated based on the real-time memory pressure, and the corresponding number of nodes are removed according to priority. Based on priority ranking, the retained nodes are subject to gradual weight decay and conflict index enhancement. The high-weight dependency edges of the removed nodes are retained, and an emergency cache warm-up thread based on operation sequence prediction is started.

[0205] In this embodiment, the hybrid degradation strategy is suitable for situations where memory pressure is high and image scores are generally low. The system dynamically calculates the actual replacement volume based on real-time memory pressure. .

[0206] Then, strictly follow the priority queue Sort by removing hypersurface diffusion priority scores. The lowest M′ nodes.

[0207] For the remaining nodes in the queue, the system applies a progressive penalty weight decay: And simultaneously increase its conflict flag: .

[0208] To maximize system availability, the nearest dependency edge (i.e., weight) of the removed node will be retained during the degradation process. W ( e (Edges with a value greater than 0.6). Simultaneously, an emergency cache warm-up thread is initiated, using a Markov chain prediction model based on user operation sequences to asynchronously load historical node data that may be accessed in the future.

[0209] Based on this, the hybrid degradation strategy achieves manageable degradation under stringent resource conditions through a gradual penalty and preheating compensation mechanism. Secondly, mechanisms such as double-buffered switching, dependency edge retention, and preheating loading effectively mask the latency and jitter caused by the replacement operation, ensuring the continuity of the user's perception when performing AI image editing.

[0210] One or more technical solutions provided in the exemplary embodiments of this disclosure achieve accurate quantification and topological identification of cache singularities by introducing hypersurface singularity indices, thus solving the technical problem of being unable to quantify cache conflicts.

[0211] Secondly, by dynamically adjusting the hypersurface value weights of each node in the dynamic cache topology based on real-time user behavior, the caching strategy is transformed from a static rule into an adaptive process driven by user behavior, thus solving the technical problem of lacking parameter correlation analysis and adaptive capabilities.

[0212] Furthermore, by generating a candidate replacement queue through multi-dimensional scoring and then selecting a target replacement strategy through parallel image construction and stress testing, the technical problem of a single replacement strategy is solved.

[0213] The foregoing primarily describes the solutions provided by exemplary embodiments of this disclosure. It is understood that, in order to achieve the above functions, the electronic device includes corresponding hardware structures and / or software modules for performing each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.

[0214] The exemplary embodiments of this disclosure can divide the electronic device into functional units according to the above method examples. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into a single processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in the exemplary embodiments of this disclosure is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.

[0215] In the case of dividing each functional module according to its corresponding functions, an exemplary embodiment of this disclosure provides a cache replacement device, which can be a server or a chip applied to a server. Figure 6 This is a schematic block diagram illustrating the functional modules of the cache replacement device provided in an embodiment of this disclosure. Figure 6 As shown, the cache replacement device 600 includes: The data acquisition module 610 is used to acquire the operation sequence generated by the user during the image editing process and the intermediate state cache data generated by the operation sequence; Data processing module 620 is used to determine the correlation between different operations in the operation sequence; The data processing module 620 is also used to select cache data to be replaced from the intermediate cache data based on the association relationship when cache replacement needs to be performed.

[0216] In another embodiment provided in this disclosure, the data acquisition module 610 is further configured to construct a dynamic cache topology, which is used to characterize the association between different operations in the operation sequence; wherein, constructing the dynamic cache topology includes: acquiring predefined image editing operation types and allocating corresponding parameter subspaces for each image editing operation type; mapping intermediate cache data generated by the image editing operations to nodes in the dynamic cache topology; wherein, the nodes include parameter vectors, timestamps, and hypersurface singularity indices corresponding to the image editing operations; constructing weighted operation dependency edges between nodes based on the temporal dependencies between image editing operations; constructing weighted conflict detection edges between nodes based on the parameter conflict relationships between nodes; and constructing the dynamic cache topology based on the nodes, the operation dependency edges, and the conflict detection edges.

[0217] In another embodiment provided in this disclosure, the data acquisition module 610 is further configured to acquire multiple neighboring nodes of the target node; calculate the difference between the target node and the multiple neighboring nodes in the parameter subspace; and calculate the hypersurface singularity index of the target node based on the difference.

[0218] In another embodiment provided in this disclosure, the data acquisition module 610 is further configured to define the dynamic cache topology as a weighted directed acyclic graph structure; wherein, all nodes in the graph structure constitute a node set, and the edges in the graph structure are composed of the operation-dependent edges and the conflict detection edges; the weight value of the operation-dependent edge is determined based on the similarity of the parameters of the nodes at both ends of the operation-dependent edge; and the weight value of the conflict detection edge is determined based on the sum of the hypersurface singularity indices of the nodes at both ends of the conflict detection edge.

[0219] In another embodiment provided in this disclosure, the data acquisition module 610 is further configured to traverse the dynamic cache topology, mark nodes whose hypersurface singularity index exceeds a preset threshold as high-conflict nodes, and form a high-conflict cache subgraph based on the high-conflict nodes and the conflict detection edges connected to them.

[0220] In another embodiment provided in this disclosure, the data processing module 620 is further configured to dynamically adjust the hypersurface value weight of each node in the dynamic cache topology based on the user's real-time operation sequence; update the hypersurface singularity index of each node based on the adjusted hypersurface value weight of each node; and update the high-conflict cache subgraph based on the updated hypersurface singularity index of each node.

[0221] In another embodiment provided in this disclosure, the data processing module 620 is further configured to determine associated cache block groups based on the similarity between real-time operation sequences and historical operation sequences; increase the hypersurface value weight of nodes in the cache block group corresponding to the new image editing operation type when the user switches the image editing operation type; decrease the hypersurface value weight of corresponding nodes in the high-conflict cache subgraph when the user repeatedly adjusts the same image editing parameters; and increase the hypersurface value weight of nodes in the cache block group associated with the operation before undoing when the user performs an undo operation.

[0222] In another embodiment provided in this disclosure, the data processing module 620 is further configured to calculate the difference between the hypersurface value weight of each node and the global average weight; and update the hypersurface singularity index of each node based on the difference.

[0223] In another embodiment provided in this disclosure, the data processing module 620 is further configured to calculate the weights of the operation dependency edges and conflict detection edges associated with the nodes based on the updated hypersurface value weights of each node; determine the nodes whose hypersurface value weights are lower than a first threshold and whose hypersurface singularity indexes are lower than a second threshold as isolated nodes, and remove the isolated nodes from the dynamic cache topology.

[0224] In another embodiment provided in this disclosure, the data processing module 620 is further configured to start from the node of the corresponding real-time operation sequence, backtrack along the operation dependency edge for a preset number of steps to form an operation path; merge the cache blocks corresponding to all nodes in the operation path that are the same as the image editing operation type of the real-time operation sequence into the cache block group; and shorten the preset number of backtracking steps if a high conflict node is detected during the backtracking process.

[0225] In another embodiment provided in this disclosure, the data processing module 620 is further configured to: determine the priority score of each node in the dynamic cache topology based on the updated hypersurface singularity index and high-conflict cache subgraph; generate a candidate replacement queue based on the priority score; construct a mirror topology based on the candidate replacement queue; perform stress testing on the mirror topology to obtain a stability score; determine a target mirror topology and a target replacement strategy based on the stability score; and apply the target mirror topology to the dynamic cache topology based on the target replacement strategy to update the intermediate cache data.

[0226] In another embodiment provided in this disclosure, the data processing module 620 is further configured to calculate the hypersurface singularity diffusion evaluation score, timestamp chaotic mapping score, intra-group singularity covariance score, and non-uniformity degree embedding score of the node respectively; and to generate the priority score of each node by fusing the hypersurface singularity diffusion evaluation score, timestamp chaotic mapping score, intra-group singularity covariance score, and non-uniformity degree embedding score through a geometric mean algorithm.

[0227] In another embodiment provided in this disclosure, the data processing module 620 is further configured to: calculate the hypersurface singularity diffusion evaluation score of the node based on the hypersurface singularity index of the node's neighboring nodes in the high-conflict cache subgraph; calculate the timestamp chaotic mapping score of the node based on the timestamp of the node and the timestamps of its neighboring nodes using a chaotic mapping function; calculate the intra-cluster singularity covariance score of the node based on the sliding window covariance of the hypersurface singularity index of the node within the cache block group and the hypersurface value weight of the node; and calculate the non-uniform degree embedding score of the node based on the weighted degree of the node in the dynamic cache topology.

[0228] In another embodiment provided in this disclosure, the data processing module 620 is further configured to determine the set of neighboring nodes of the node within a specific topological distance in the high-conflict cache subgraph; calculate the gradient of the hypersurface singularity index between the node and each node in the set of neighboring nodes to obtain the singularity gradient value; and perform nonlinear mapping and compression on the singularity gradient value based on the hypersurface value weight and the hypersurface singularity index of the node to obtain the hypersurface singularity diffusion evaluation score.

[0229] In another embodiment provided in this disclosure, the data processing module 620 is further configured to extract the timestamps corresponding to the node, the predecessor node, and the successor node respectively; generate chaotic mapping values ​​based on the timestamps of the predecessor node and the successor node through bitwise operations and modular multiplication operations; calculate the difference between the chaotic mapping value of the node and the chaotic mapping value of the current time, and map the difference to the timestamp chaotic mapping score through an exponential decay function.

[0230] In another embodiment provided in this disclosure, the data processing module 620 is further configured to calculate the covariance of the hypersurface singularity index of the node within the sliding window, with the node as the center, within the cache block group; multiply the hypersurface value weight of the node by the covariance, and normalize it using the global maximum covariance value; and compress the normalization result using the hyperbolic tangent function to obtain the singularity covariance score within the group.

[0231] In another embodiment provided in this disclosure, the data processing module 620 is further configured to calculate the sum of the weights of all operation-dependent edges of the node and the sum of the weights of all conflict detection edges to obtain the weighted degree of the node; and to perform hyperbolic tangent transformation on the weighted degree to obtain the non-uniform degree embedding score.

[0232] In another embodiment provided in this disclosure, the data processing module 620 is further configured to sort the priority scores of all nodes; dynamically determine the number of nodes in the candidate replacement queue based on the current memory usage pressure; and select nodes with the same number of nodes as the priority score sorting to form the candidate replacement queue.

[0233] In another embodiment provided in this disclosure, the mirrored topology structure includes: a global topology mirror structure, a local topology mirror structure, and an incremental topology mirror structure. The data processing module 620 is further configured to perform atomic removal processing on nodes in the candidate replacement queue that meet the removal conditions, and reconstruct the operation dependency edges and conflict detection edges of the surviving nodes to generate the global topology mirror structure; selectively prune the nodes in the candidate replacement queue based on the temporal retention weight, and reconstruct the conflict detection edges of the surviving nodes to generate the local topology mirror structure; calculate the neighbor perception decay weight of the nodes in the candidate replacement queue, and reconstruct the bidirectional shadow edges of the nodes to generate the incremental topology mirror structure.

[0234] In another embodiment provided in this disclosure, the data processing module 620 is further configured to perform a hierarchical stress test on each of the mirror topologies; the hierarchical stress test includes a basic replay test, a parameter disturbance injection test, and a limit rollback test; based on the results of the hierarchical stress test, multiple stability evaluation indicators are obtained; and the multiple stability evaluation indicators are weighted and summed to obtain the stability score of the mirror topology.

[0235] In another embodiment provided in this disclosure, the data processing module 620 is further configured to determine the target replacement strategy from the candidate strategies based on the stability score; the candidate strategies include: direct replacement strategy, pruning and grafting strategy and hybrid degradation strategy; based on the target replacement strategy, the corresponding mirror topology is applied to the dynamic cache topology to complete the update of nodes and edges.

[0236] In another embodiment provided in this disclosure, the data processing module 620 is further configured to, when the target replacement strategy is a direct replacement strategy, determine the global topology mirror structure that meets the preset high score conditions as the target mirror topology structure; the target mirror topology structure is switched to the currently working dynamic cache topology structure through a double buffering mechanism; the parameter vector of the node to be replaced is sorted according to the topology influence index and then compressed and stored; a global cache preheating mechanism is triggered to prioritize loading intermediate cache data related to the most recent image editing operation.

[0237] In another embodiment provided in this disclosure, the data processing module 620 is further configured to: determine the mirror topology structure that meets the preset qualification conditions as the target mirror topology structure when the target replacement strategy is a pruning and grafting strategy; extract high cache value weight nodes from the target mirror topology structure as a set of nodes to be grafted; calculate the grafting fit of the nodes to be grafted and determine the grafting position in the original dynamic cache topology structure; construct cross-topology edges at the grafting positions and perform local edge rebalancing operations on nodes with excessively high connectivity after grafting.

[0238] In another embodiment provided in this disclosure, the data processing module 620 is further configured to, when the target replacement strategy is a hybrid degradation strategy, calculate the number of nodes to be removed based on real-time memory pressure, and remove the corresponding number of nodes according to priority; perform progressive weight decay and conflict index enhancement processing on the retained nodes based on priority ranking; retain the high-weight dependency edges of the removed nodes, and start an emergency cache warm-up thread based on operation sequence prediction.

[0239] Exemplary embodiments of this disclosure also provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to cause the electronic device to perform a method according to an embodiment of this disclosure.

[0240] Exemplary embodiments of this disclosure also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a computer's processor, is used to cause the computer to perform a method according to embodiments of this disclosure.

[0241] Figure 7The structural block diagram of the electronic device provided in the embodiments of this disclosure will now be described as follows: An electronic device 700 that can serve as a server or client of this disclosure is an example of a hardware device that can be applied to various aspects of this disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can 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 examples and are not intended to limit the implementation of the disclosure described and / or claimed herein.

[0242] like Figure 7 As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. The RAM 703 may also store various programs and data required for the operation of the electronic device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0243] Multiple components in electronic device 700 are connected to I / O interface 705, including: input unit 706, output unit 707, storage unit 708, and communication unit 709. Input unit 706 can be any type of device capable of inputting information to electronic device 700. Input unit 706 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device. Output unit 707 can be any type of device capable of presenting information and may include, but is not limited to, a display, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 708 may include, but is not limited to, disk and optical disk. Communication unit 709 allows electronic device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and / or chipsets, such as Bluetooth™ devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.

[0244] The computing unit 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above. The various methods described above can all be implemented as computer software programs, which are tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 700 via ROM 702 and / or communication unit 709.

[0245] Figure 8 The schematic diagram is for a computer program product provided in an embodiment of the present disclosure. An exemplary embodiment of the present disclosure also provides a computer program product 800, including a computer program 801, wherein the computer program 801, when executed by a computer's processor, is used to cause the computer to perform a method according to an embodiment of the present disclosure.

[0246] 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.

[0247] 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, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0248] As used in this disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or apparatus (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0249] 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).

[0250] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user 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., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0251] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.

[0252] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this disclosure are performed, in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a terminal, a user equipment, or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center integrating one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video disc (DVD); or it can be a semiconductor medium, such as a solid-state drive (SSD).

[0253] Although this disclosure has been described in conjunction with specific features and embodiments, it will be apparent that various modifications and combinations can be made therein without departing from the spirit and scope of this disclosure. Accordingly, this specification and drawings are merely exemplary illustrations of the disclosure as defined by the appended claims and are to be considered as covering any and all modifications, variations, combinations, or equivalents within the scope of this disclosure. It is obvious that those skilled in the art can make various alterations and modifications to this disclosure without departing from its spirit and scope. Thus, this disclosure is also intended to include any such modifications and modifications that fall within the scope of the claims of this disclosure and their equivalents.

Claims

1. A cache replacement method, characterized in that, The method includes: Obtain the operation sequence generated by the user during the image editing process and the intermediate state cache data generated by the operation sequence; Determine the relationships between different operations in the operation sequence; When cache replacement is required, the cache data to be replaced is selected from the intermediate cache data based on the association relationship.

2. The method according to claim 1, characterized in that, Determining the association between different operations in the operation sequence includes: Construct a dynamic cache topology, which is used to characterize the association between different operations in the operation sequence; The construction of the dynamic cache topology includes: Obtain predefined image retouching operation types and assign corresponding parameter subspaces to each image retouching operation type; The intermediate cache data generated by the image retouching operation is mapped to nodes in the dynamic cache topology; wherein, the nodes include the parameter vector, timestamp, and hypersurface singularity index corresponding to the image retouching operation; Based on the temporal dependencies between image editing operations, weighted operation dependency edges are constructed between nodes; Based on the parameter conflict relationship of nodes, a weighted conflict detection edge is constructed between nodes; The dynamic cache topology is constructed based on the nodes, the operation dependency edges, and the conflict detection edges.

3. The method according to claim 2, characterized in that, The method further includes: Obtain multiple neighbor nodes of the target node; Calculate the difference between the target node and each of the multiple neighboring nodes in the parameter subspace; Based on the difference, the hypersurface singularity index of the target node is calculated.

4. The method according to claim 2, characterized in that, The construction of the dynamic cache topology based on the nodes, the operation-dependent edges, and the conflict detection edges includes: The dynamic cache topology is defined as a weighted directed acyclic graph structure; wherein all nodes in the graph structure constitute a node set, and the edges in the graph structure are composed of the operation-dependent edges and the conflict detection edges; The weight value of the operation-dependent edge is determined based on the similarity of the node parameters at both ends of the operation-dependent edge. The weight value of the conflict detection edge is determined based on the sum of the hypersurface singularity indices of the nodes at both ends of the conflict detection edge.

5. The method according to claim 2, characterized in that, The method further includes: Traverse the dynamic cache topology and mark nodes whose hypersurface singularity index exceeds a preset threshold as high-conflict nodes; A high-conflict cache subgraph is formed based on the high-conflict nodes and the conflict detection edges connected to them.

6. The method according to claim 2, characterized in that, The method further includes: The hypersurface value weights of each node in the dynamic cache topology are dynamically adjusted based on the user's real-time operation sequence. Based on the adjusted hypersurface value weights of each node, update the hypersurface singularity index of each node. Based on the updated hypersurface singularity index of each node, update the high-conflict cache subgraph.

7. The method according to claim 6, characterized in that, The dynamic adjustment of the hypersurface value weights of each node in the dynamic cache topology based on the user's real-time operation sequence includes: Based on the similarity between real-time operation sequences and historical operation sequences, the associated cache block groups are determined; When a user switches the type of image editing operation, increase the hypersurface value weight of the node in the cache block group corresponding to the new image editing operation type. When a user repeatedly adjusts the same image editing parameters, reduce the hypersurface value weight of the corresponding node in the high-conflict cache subgraph; When a user performs an undo operation, the hypersurface value weight of the node in the cache block group associated with the operation before undoing is increased.

8. The method according to claim 7, characterized in that, The process of updating the hypersurface singularity index of each node based on the adjusted hypersurface value weights includes: The difference between the hypersurface value weight of each node and the global average weight is calculated. Based on the discrepancy results, update the hypersurface singularity index of each node.

9. The method according to claim 8, characterized in that, The method further includes: Based on the updated hypersurface value weights of each node, the weights of the operation dependency edges and conflict detection edges associated with the nodes are calculated respectively. Nodes whose hypersurface value weight is lower than the first threshold and whose hypersurface singularity index is lower than the second threshold are identified as isolated nodes, and the isolated nodes are removed from the dynamic cache topology.

10. The method according to claim 7, characterized in that, The determination of associated cache block groups based on the similarity between real-time operation sequences and historical operation sequences includes: Starting from the node corresponding to the real-time operation sequence, backtrack along the operation dependency edge by a preset number of steps to form the operation path; The cache blocks corresponding to all nodes in the operation path that have the same image editing operation type as the real-time operation sequence are merged into the cache block group; If a high-conflict node is detected during the backtracking process, the preset number of steps for reverse backtracking is shortened.

11. The method according to claim 6, characterized in that, The step of selecting cache data to be replaced from the intermediate cache data based on the association relationship includes: Based on the updated hypersurface singularity index and high-conflict cache subgraph, the priority score of each node in the dynamic cache topology is determined, and a candidate replacement queue is generated based on the priority score. A mirror topology is constructed based on the candidate replacement queue, and a stability score is obtained by stress testing the mirror topology. The target mirror topology and target replacement strategy are determined based on the stability score. Based on the target replacement strategy, the target mirror topology is applied to the dynamic cache topology to update the intermediate cache data.

12. The method according to claim 11, characterized in that, The determination of the priority score of each node in the dynamic cache topology includes: Calculate the hypersurface singularity diffusion evaluation score, timestamp chaotic mapping score, intra-group singularity covariance score, and non-uniform degree embedding score of the node respectively; Priority scores for each node are generated by fusing the hypersurface singularity diffusion evaluation score, timestamp chaotic mapping score, intra-group singularity covariance score, and non-uniform degree embedding score using a geometric mean algorithm.

13. The method according to claim 12, characterized in that, The calculation of the hypersurface singularity diffusion evaluation score, timestamp chaotic mapping score, intra-group singularity covariance score, and non-uniform degree embedding score of the nodes includes: Based on the hypersurface singularity index of the node's neighboring nodes in the high-conflict cache subgraph, the hypersurface singularity diffusion evaluation score of the node is calculated. Based on the timestamp of the node and the timestamps of the adjacent nodes, the timestamp chaotic mapping score of the node is calculated using a chaotic mapping function. The node's in-group singularity covariance score is calculated based on the sliding window covariance of the node's hypersurface singularity index within the cache block group and the node's hypersurface value weight. The non-uniform degree embedding score of the node is calculated based on the weighted degree of the node in the dynamic cache topology.

14. The method according to claim 13, characterized in that, The calculation of the hypersurface singularity diffusion evaluation score of the node based on the hypersurface singularity index of the node's neighboring nodes in the high-conflict cache subgraph includes: Determine the set of neighboring nodes of the node within a specific topological distance in the high-conflict cache subgraph; Calculate the gradient of the hypersurface singularity index between the node and each node in the set of neighboring nodes to obtain the singularity gradient value; Based on the hypersurface value weight and hypersurface singularity index of the node, the singularity gradient value is nonlinearly mapped and compressed to obtain the hypersurface singularity diffusion evaluation score.

15. The method according to claim 13, characterized in that, The calculation of the node's timestamp chaotic mapping score using a chaotic mapping function, based on the node's timestamp and the timestamps of neighboring nodes, includes: Extract the timestamps corresponding to the node, the predecessor node, and the successor node respectively; Based on the timestamps of the predecessor and successor nodes, chaotic mapping values ​​are generated through bitwise operations and modular multiplication operations. Calculate the difference between the chaotic mapping value of the node and the chaotic mapping value of the current time, and map the difference to the timestamp chaotic mapping score using an exponential decay function.

16. The method according to claim 13, characterized in that, The calculation of the node's in-group singularity covariance score based on the sliding window covariance of the hypersurface singularity index within the cache block group to which the node belongs and the node's hypersurface value weight includes: Within the cache block group, with the node as the center, calculate the covariance of the hypersurface singularity index of the node within the sliding window; Multiply the hypersurface value weight of the node by the covariance, and then normalize it using the global maximum covariance value. The normalization result is compressed using the hyperbolic tangent function to obtain the singularity covariance score within the group.

17. The method according to claim 13, characterized in that, The calculation of the non-uniform degree embedding score of a node based on its weighted degree in the dynamic cache topology includes: The weighted degree of the node is obtained by summing the weights of all operation-dependent edges and summing the weights of all conflict-detecting edges. The weighted degree is subjected to hyperbolic tangent transformation to obtain the non-uniform degree embedding score.

18. The method according to claim 11, characterized in that, The process of generating a candidate replacement queue based on the priority score includes: Sort the priority scores of all nodes. The number of nodes in the candidate replacement queue is dynamically determined based on the current memory usage pressure. Based on priority scores, nodes with the same number of nodes are selected to form the candidate replacement queue.

19. The method according to claim 11, characterized in that, The mirror topology structure includes: a global topology mirror structure, a local topology mirror structure, and an incremental topology mirror structure; the construction of the mirror topology structure based on the candidate replacement queue includes: Atomic removal processing is performed on nodes that meet the removal conditions in the candidate replacement queue, and the operation dependency edges and conflict detection edges of the surviving nodes are reconstructed to generate the global topology mirror structure; Based on the time-series preservation weight, nodes in the candidate replacement queue are selectively pruned, and the conflict detection edges of the surviving nodes are reconstructed to generate the local topology mirror structure. Calculate the neighbor perception decay weight of the nodes in the candidate replacement queue, reconstruct the bidirectional shadow edges of the nodes, and generate the incremental topology mirror structure.

20. The method according to claim 19, characterized in that, The process of stress testing the mirrored topology to obtain a stability score includes: Perform tiered stress tests on each of the mirror topologies; the tiered stress tests include basic replay tests, parameter perturbation injection tests, and extreme rollback tests. Based on the results of the graded stress test, multiple stability evaluation indicators are obtained. The stability score of the mirror topology is obtained by weighted summation of the multiple stability evaluation indicators.

21. The method according to claim 19, characterized in that, The step of applying the target mirror topology to the dynamic cache topology based on the target replacement strategy includes: When the target replacement strategy is a direct replacement strategy, the global topology mirror structure that meets the preset high score conditions is determined as the target mirror topology structure; The target mirror topology is switched to the currently working dynamic cache topology through a double buffering mechanism; The parameter vectors of the nodes to be replaced are sorted by topological influence index and then compressed and stored. Trigger the global cache preheating mechanism to prioritize loading intermediate cache data related to the most recent image editing operation.

22. The method according to claim 19, characterized in that, The step of applying the target mirror topology to the dynamic cache topology based on the target replacement strategy includes: When the target replacement strategy is a pruning and grafting strategy, the mirror topology that meets the preset qualification conditions is determined as the target mirror topology. From the target mirror topology, extract nodes with high cache value weights as the set of nodes to be grafted; Calculate the grafting fit of the node to be grafted and determine the grafting position in the original dynamic cache topology; A cross-topology edge is constructed at the grafting location, and a local edge rebalancing operation is performed on nodes with excessively high connectivity after grafting.

23. The method according to claim 19, characterized in that, The step of applying the target mirror topology to the dynamic cache topology based on the target replacement strategy includes: When the target replacement strategy is a hybrid degradation strategy, the number of nodes to be removed is calculated based on the real-time memory pressure, and the corresponding number of nodes are removed according to priority. Based on priority ranking, the retained nodes are subject to gradual weight decay and conflict index enhancement. The high-weight dependency edges of the removed nodes are retained, and an emergency cache warm-up thread based on operation sequence prediction is started.

24. A computer device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method of claim 1.

25. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instruction is executed by the processor, it implements the method of claim 1.

26. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the method of claim 1.