Design data processing method and device based on hierarchical hash cache, equipment and storage medium
By performing hierarchical hash caching on design data, accurately identifying change nodes and processing only them, the problems of resource waste and long response time in existing technologies are solved, and efficient design data processing is achieved.
Patent Information
- Application Number
- CN202511744003.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-25
- Publication Date
- 2026-02-10
AI Technical Summary
In the workflow of existing AI programming and design tools, design data processing suffers from wasted computing resources and long response times, especially in scenarios with large design documents or high-frequency requests. It fails to effectively identify design changes, resulting in full-processing that leads to resource waste and performance bottlenecks.
A design data processing method based on hierarchical hash caching is adopted. By performing multi-level hash calculations on the design nodes of each design element in the design data, the changed nodes are identified and processed only, generating target protocol data and avoiding repeated processing of unchanged nodes.
It significantly improves data processing efficiency, reduces redundant calculations, optimizes resource utilization, increases response speed, and provides more efficient context support.
Smart Images

Figure CN121502608A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data processing, in particular to a design data processing method and device based on hierarchical hash caching, equipment and storage medium. BACKGROUND
[0002] In the workflow of AI (Artificial Intelligence) programming tools and design tools, the MCP (Model Context Protocol) server plays a bridge role, responsible for obtaining and processing design data and providing it as context to AI tools. When the AI programming tool initiates a design data request, the MCP server will call the API (Application Programming Interface) of the design tool to obtain the complete original design data.
[0003] However, whether the content in the design data changes or not, each request will trigger the complete process. This means that a large number of nodes that have not changed will be repeatedly traversed and processed, performing the same extraction logic. In large design files or high-frequency request scenarios, this indiscriminate full processing causes a huge and unnecessary waste of computing resources, and also results in a long response time, which seriously affects the developer's use experience and workflow efficiency. Moreover, the existing file-level cache granularity is too rough. As a result, not only are computing resources wasted, but a large amount of repeated intermediate processing results also need to be stored in memory, and the network also needs to transmit result sets containing a large amount of unchanged data, causing multi-dimensional resource waste. SUMMARY
[0004] The embodiments of the present application provide a design data processing method and device based on hierarchical hash caching, equipment and storage medium, which can improve data processing efficiency and optimize resource utilization.
[0005] In a first aspect, the embodiments of the present application provide a design data processing method based on hierarchical hash caching, which comprises: Obtaining a design data request triggered by a preset programming tool; Based on the design data request, obtaining the latest design data, wherein the latest design data comprises at least one design element; Hashing the multi-layer information of each design node in each design element to obtain the multi-layer latest hash value of each design node in each design element, wherein the multi-layer information corresponds to the information of the design element in multiple dimensions respectively; According to the multi-layer latest hash values of the design nodes and the multi-layer historical hash values of the design nodes in the design elements cached in the preset cache system, change identification is performed on the latest design data to obtain changed nodes and unchanged nodes of the design elements in the latest design data; According to the model context protocol (MCP) protocol, data of the changed nodes in the latest design data is processed to obtain protocol data of the changed nodes; According to the protocol data of the unchanged nodes cached in the preset cache system and the protocol data of the changed nodes, target protocol data is generated; The target protocol data is returned to the preset programming tool.
[0006] Optionally, the obtaining of the latest design data based on the design data request comprises: Request parameter analysis is performed on the design data request to obtain a design tool type; According to the design tool type, a design tool corresponding to the design tool type is used to obtain the latest design data.
[0007] Optionally, the multi-layer information of the design nodes comprises structure layer information, content layer information, style layer information and dependency layer information; the structure layer information is hierarchical structure information of the design elements in the design nodes, the content layer information is content attribute information of the design elements in the design nodes, the style layer information is style attribute information of the design elements in the design nodes, and the dependency layer information is reference relationship information between the design elements in the design nodes; the multi-layer latest hash values comprise structure layer latest hash values, content layer latest hash values, style layer latest hash values and dependency layer latest hash values; The multi-layer information of the design nodes in the design elements is respectively subjected to hash calculation to obtain the multi-layer latest hash values of the design nodes in the design elements, comprising: The structure layer information, the content layer information, the style layer information and the dependency layer information are respectively subjected to hash calculation to obtain structure layer latest hash values, content layer latest hash values, style layer latest hash values and dependency layer latest hash values of the design elements.
[0008] Optionally, before the change identification on the latest design data according to the multi-layer latest hash values of the design nodes and the multi-layer historical hash values of the design nodes in the design elements cached in the preset cache system, the method further comprises: It is determined whether the preset cache system has a cache area of the design nodes; If the preset caching system has a cache area for each design node, then determine whether the cache area of each design node is valid for a certain period of time. If the time of the cache of each design node is valid, then the multi-level historical hash value of each design node is obtained from the cache of each design node.
[0009] Optionally, after determining whether the preset caching system has the cache area of each design node, the method further includes: If the preset caching system does not have a cache area for the target design node, then a cache area for the target design node is created in the preset caching system, and the latest hash values of the target design node at multiple levels are cached in the cache area of the target design node. According to the MCP protocol, the data of the target design node in the latest design data is processed to obtain the protocol data of the target design node; The protocol data of the target design node is cached in the cache area of the target design node.
[0010] Optionally, the method further includes: The protocol data of the changed node is cached in the cache area of the changed node in the preset cache system.
[0011] Optionally, the method further includes: The target protocol data is hashed to obtain protocol hash data; The protocol hash data is cached in the preset cache system, and the design data cache status of each design element is updated.
[0012] Secondly, embodiments of the present invention also provide a data processing apparatus based on hierarchical hash caching, the apparatus comprising: The request module is used to obtain design data requests triggered by a preset programming tool; The acquisition module is used to acquire the latest design data based on the design data request, wherein the latest design data includes at least one design element; The calculation module is used to perform hash calculations on the multi-layer information of each design node in each design element to obtain the latest multi-layer hash value of each design node in each design element, wherein the multi-layer information corresponds to the information of the design element in multiple dimensions. The identification module is used to identify changes in the latest design data based on the latest multi-layer hash values of each design node and the historical multi-layer hash values of each design node in each design element cached in the preset cache system, so as to obtain the changed nodes and unchanged nodes of the design elements in the latest design data. The processing module is used to process the data of the change node in the latest design data according to the Model Context Protocol (MCP) to obtain the protocol data of the change node. The synthesis module is used to generate target protocol data based on the protocol data of the unchanged node cached in the preset caching system and the protocol data of the changed node. The output module is used to return the target protocol data to the preset programming tool.
[0013] Thirdly, embodiments of the present invention also provide a computer device, including: a processor, a memory, and a bus, wherein the memory stores program instructions executable by the processor, and when the computer device is running, the processor communicates with the memory via the bus, and the processor executes the program instructions to perform the steps of the design data processing method based on hierarchical hash caching as described in any of the first aspects.
[0014] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the design data processing method based on hierarchical hash caching as described in any of the first aspects.
[0015] This invention provides a design data processing method, apparatus, device, and storage medium based on hierarchical hash caching. Upon receiving a design data request triggered by a preset programming tool, the latest design data is acquired. Hash calculations are performed on the design nodes corresponding to each design element in the acquired latest design data to obtain the latest multi-level hash values for each design node. These latest multi-level hash values are then compared with the historical multi-level hash values of each design node in the preset cache system to identify changes in the latest design data, identifying changed nodes and unchanged nodes. Subsequently, only the data of the changed nodes needs to be processed, while the protocol data of the unchanged nodes is reused, ultimately generating the target protocol data and returning it to the preset programming tool. By performing hash calculations on each design node corresponding to each design element in the design data, accurate change identification is achieved. Processing is only performed on changed nodes, significantly improving data processing efficiency, reducing redundant calculations, optimizing resource utilization, and increasing response speed, thereby providing more efficient context support for the programming tool. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart illustrating a data processing method based on hierarchical hash caching provided by this invention; Figure 2 This invention provides a schematic diagram of the process for obtaining design data in design data processing based on hierarchical hash caching. Figure 3 This invention provides a schematic diagram of the data caching process in data processing based on a hierarchical hash cache design. Figure 4 This invention provides a schematic diagram of another data caching process in data processing based on hierarchical hash caching. Figure 5 This invention provides a schematic diagram of another data caching process in data processing based on hierarchical hash caching. Figure 6 A schematic diagram of a data processing device based on a hierarchical hash cache provided by the present invention; Figure 7 This is a schematic diagram of a computer device provided by the present invention.
[0018] Icons: 1000, Request module; 2000, Acquisition module; 3000, Calculation module; 4000, Recognition module; 5000, Processing module; 6000, Synthesis module; 7000, Output module; 10, Computer device; 11, Processor; 12, Memory; 13, Bus. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0020] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0021] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0022] Before providing a detailed explanation of the present invention, its application scenarios will be introduced first.
[0023] In modern data-driven product development, efficient interaction between design data and AI programming tools is crucial for improving development efficiency. Current technologies commonly employ a complete data simplification process to handle each request; this involves acquiring raw data using design tools and then performing uniform data simplification across all nodes. Additionally, some solutions introduce file-based caching mechanisms to reduce redundant computations. However, these methods generally rely on full-processing logic and lack fine-grained identification capabilities for design changes. Especially in scenarios with large design files or frequent requests, system performance is significantly limited, making it difficult to meet the demands of high-concurrency, low-latency applications.
[0024] Based on this, the present invention proposes a design data processing method, apparatus, device and storage medium based on hierarchical hash caching. By performing hash calculations on each design node corresponding to each design element in the design data, accurate change identification is achieved. The processing flow is executed only on the changed nodes, thereby significantly improving data processing efficiency, reducing redundant calculations, optimizing resource utilization, improving response speed, and providing more efficient context support for programming tools.
[0025] The following explanation, in conjunction with the accompanying drawings, uses several embodiments to illustrate the concepts. Figure 1 This invention provides a flowchart illustrating a data processing method based on hierarchical hash caching, as shown below. Figure 1 As shown, this data processing method based on hierarchical hash caching includes: S101, Obtain design data request triggered by preset programming tool.
[0026] Among them, the preset programming tools refer to AI-assisted programming tools (such as Cursor, GitHub Copilot, etc.). AI-assisted programming tools are usually used for code generation tasks and need to obtain designs from design tools.
[0027] The data is used to understand the user's design intent and generate corresponding code. In this application, the method is applied to an MCP server. Specifically, a design data request refers to a request sent by a pre-defined programming tool to the MCP server, requesting to obtain the design context information of the current design file or a specific node. For example, when a developer is writing code using Cursor, if the developer clicks on a design element, Cursor will automatically send a request to the MCP server to obtain the detailed structure and style information of that design element.
[0028] In practice, the pre-defined programming tool may establish a connection with the MCP server via HTTP (Hypertext Transfer Protocol), WebSocket, or other communication methods, and initiate a design data request each time design data is needed. This mechanism ensures that the pre-defined programming tool can obtain the latest design information in real time, thereby improving development efficiency and accuracy.
[0029] S102, based on the design data request, obtain the latest design data, wherein the latest design data includes at least one design element.
[0030] The latest design data is the current version of the design data obtained from the design tool's API. This latest design data contains multiple design elements, each of which can be a UI (User Interface) element such as a graphic component, text box, button, or icon. Design elements, as the basic units constituting a design file, possess their own attributes and hierarchical relationships. For example, in Figma, a button component may include multiple sub-design elements such as background fill, border, and text content.
[0031] In actual implementation, after the MCP server receives a design data request from the upstream pre-programmed tool, the adapter module calls the API interface to obtain the complete and latest design data.
[0032] S103, perform hash calculations on the multi-layer information of each design node in each design element to obtain the latest multi-layer hash value of each design node in each design element. The multi-layer information corresponds to the information of the design element in multiple dimensions.
[0033] In the data structure of design tools, design elements are organized in a tree structure, with each element corresponding to a design node. Multi-level information refers to the multiple layers of attribute information contained within any design node, which can be deconstructed and described from different dimensions. For example, the multi-level information of a button design element's corresponding design node could include: structural information, style information, text information, etc.
[0034] Hash calculations can map input data of arbitrary length to a fixed-length, unique string (i.e., a hash value). The latest hash value refers to the hash value calculated based on the latest design data. In this application, the SHA-256 algorithm is used as the preferred hash algorithm to perform hash calculations on the information at each layer.
[0035] Specifically, each design node in the design element is split along multiple dimensions to obtain multi-layered information. Then, a hash calculation is performed independently on the hash of each of the split dimensions. For example, the style information (such as color) of the design node is converted into a standard format string and input into the SHA-256 algorithm to obtain a latest hash value representing the current style of the design node. This process is repeated for other dimensions to obtain the latest hash values of the design node across multiple layers.
[0036] In practice, the MCP server uses a hierarchical hash caching engine to perform hash calculations on each design node sequentially, covering the structure layer, content layer, style layer, and dependency layer, generating corresponding hash values. These hash values are used for subsequent change identification and cache management, thus avoiding redundant processing of unchanged nodes.
[0037] S104. Based on the latest hash values of each design node and the historical hash values of each design node in each design element cached in the preset cache system, change identification is performed on the latest design data to obtain the changed nodes and unchanged nodes of the design elements in the latest design data.
[0038] Change identification refers to determining which nodes have changed by comparing the latest hash values of each design node across multiple layers with the historical hash values across multiple layers. If the hash value of a specific layer changes, it indicates that the node corresponding to that layer has changed at that layer. For example, if the content layer hash value of a specific node changes, it means that a certain dimension (text content or position) of that specific node has changed.
[0039] The pre-set caching system is a data management system that stores multi-layered historical hash values and processing results. It supports rapid data retrieval and update operations to reduce redundant calculations. The results generated during the change identification process include changed nodes and unchanged nodes. Changed nodes are used for subsequent incremental processing, while unchanged nodes are reused in the cache.
[0040] In practice, the MCP server compares the latest hash value and the historical hash value of each node across all levels. If all hash values match, the node is considered unchanged and is thus an unchanged node; otherwise, the node is marked as a changed node and awaits further processing.
[0041] S105, based on the Model Context Protocol (MCP), processes the data of the changed nodes in the latest design data to obtain the protocol data of the changed nodes.
[0042] The Model Context Protocol (MCP) is a standardized protocol used to convert design data into a format that can be understood and processed by pre-defined programming tools. Based on the MCP protocol, design data can be abstracted into the context information required for code generation models. Using the MCP protocol ensures the consistency and compatibility of output data, facilitating efficient parsing and application by pre-defined programming tools, thereby improving the efficiency and accuracy of cross-platform development.
[0043] The protocol data of the change node refers to the data generated after processing according to the MCP protocol. The protocol data of the change node contains all the key information of the change node so that the preset programming tools can accurately understand the design intent and generate the corresponding code.
[0044] In practice, the MCP server only processes data on changed nodes, generating protocol data that conforms to the Model Context Protocol (MCP) standard. By simplifying and optimizing data processing only on changed nodes, redundant processing of unchanged nodes is avoided, thus significantly improving processing efficiency.
[0045] S106. Generate target protocol data based on the protocol data of unchanged nodes cached in the preset caching system and the protocol data of changed nodes.
[0046] The target protocol data is the final design data format output to the preset programming tool. It is synthesized by the system from cached protocol data of unchanged nodes and newly processed protocol data of changed nodes. The target protocol data conforms to the Model Context Protocol (MCP) standard, and the preset programming tool can directly parse and use it.
[0047] S107, return the target protocol data to the preset programming tool.
[0048] In practice, the MCP server merges the protocol data from the changed nodes with the cached protocol data from the unchanged nodes to construct complete target protocol data. Then, it returns the target protocol data to the pre-defined programming tool via a communication interface, completing the entire design data processing flow.
[0049] In this embodiment, by performing hash calculations on each design node corresponding to each design element in the design data, accurate change identification is achieved. The processing flow is only executed on the changed nodes, thereby significantly improving data processing efficiency, reducing redundant calculations, optimizing resource utilization, and improving response speed, thus providing more efficient context support for programming tools.
[0050] In the above Figure 1Based on the corresponding embodiments, in order to more clearly demonstrate the process of obtaining the latest design data, the present invention also provides a possible implementation method for obtaining design data in design data processing based on hierarchical hash caching. Figure 2 This invention provides a schematic diagram of the design data acquisition process in design data processing based on hierarchical hash caching. For example... Figure 2 As shown, in S102 above, obtaining the latest design data based on the design data request includes: S201, parse the request parameters of the design data request to obtain the design tool type.
[0051] Specifically, as described in the above embodiments, upon receiving a design data request from an upstream preset programming tool, the request parameters of the design data need to be parsed. The design data request typically includes key parameters such as the identifier of the target design tool, the design file ID, and the node ID. By extracting the parameters from the design data request and identifying the specific type of the target design tool used, such as Figma, Sketch, or Adobe XD, the corresponding design tool API interface can be called, and a data processing method adapted to the design tool can be adopted to ensure the correctness and compatibility of subsequent design data acquisition and processing.
[0052] In practice, by parsing the parameters in the design data request to identify the design tool type, customized processing flows for different design tools can be achieved, thereby improving the system's compatibility and processing efficiency.
[0053] S202, Based on the design tool type, use the design tool corresponding to the design tool type to obtain the latest design data.
[0054] The type of design tool determines which design tool's API the adapter will call to retrieve the latest design data. For example, when the design data request is detected as coming from Figma, the system will call the Figma API; when it's from Sketch, it will call the Sketch API. Each design tool has its own specific data format and access method, so the appropriate adapter module must be selected based on the design tool type to ensure the correct acquisition and standardized processing of design data.
[0055] In practice, by calling the corresponding API based on the design tool type to obtain the latest design data, the accuracy and timeliness of the design data can be ensured, thereby improving the ability of the preset programming tool to understand the design intent, which can enhance development efficiency and user experience.
[0056] In this embodiment, after receiving a design data request, the corresponding design tool type is parsed out. Based on the identified design tool type, a matching API interface is selected to obtain the latest design data, ensuring the flexibility, compatibility, and efficiency of the design data acquisition process. Ultimately, this enables the preset programming tool to accurately understand and respond to the user's design intent.
[0057] In the above Figure 1 Based on the corresponding embodiments, in S103 above, hash calculations are performed on the multi-layer information of each design node in each design element to obtain the latest multi-layer hash value of each design node in each design element, including: The multi-layer information of each design node includes: structural layer information, content layer information, style layer information, and dependency layer information. The structural layer information is the hierarchical structure information of the design elements in each design node; the content layer information is the content attribute information of the design elements in each design node; the style layer information is the style attribute information of the design elements in each design node; and the dependency layer information is the reference relationship information between the design elements in each design node. The latest hash values of each layer include: the latest hash value of the structural layer, the latest hash value of the content layer, the latest hash value of the style layer, and the latest hash value of the dependency layer.
[0058] S301, perform hash calculations on the structure layer information, the content layer information, the style layer information, and the dependency layer information respectively to obtain the latest hash value of the structure layer, the latest hash value of the content layer, the latest hash value of the style layer, and the latest hash value of the dependency layer of the design element.
[0059] Specifically, structural layer information refers to the hierarchical structure information of design elements at various design nodes, including node ID, parent node ID, child node ID, node type, and node name. Structural layer information describes the hierarchical relationship between design elements and is a key basis for identifying node locations and organization methods. For example, in Figma, a component may contain multiple child components, each with its own ID and parent reference. The ID and parent reference of each child component form the basis of the structural layer.
[0060] Content layer information refers to the content attributes of design elements at various design nodes, including text content, visibility status, lock status, transparency, bounding box coordinates, and size. Content attribute information reflects the actual content and basic layout characteristics of a design node and serves as a core indicator for determining whether the content of a design node has changed. When a text box is modified, such as when the text content changes, this modification directly causes a change in the hash value of the content layer information.
[0061] Style layer information refers to the style attributes of design elements at various design nodes, including visual effects such as fill, stroke, shadow, and blur. Style layer information determines the appearance of a node and is a crucial basis for determining whether a node's style has changed. For example, when the background color or font size of a button changes, the style layer information will change, thus affecting the hash value corresponding to that style layer information.
[0062] Dependency layer information refers to the reference relationships between design elements across various design nodes, including the association between component instances and the main component, style library references, and resource file usage. This information describes the logical dependencies between nodes and helps identify design changes caused by changes in external references. For example, if a resource referenced by an icon is replaced, the reference relationships between design elements across design nodes will change, and the system will trigger reprocessing based on this change.
[0063] By performing hash calculations on the structural layer information, content layer information, style layer information, and dependency layer information respectively, the latest hash values of the structural layer, content layer, style layer, and dependency layer of the design element can be obtained, thereby accurately identifying the specific changes in the design data.
[0064] In this embodiment, fine-grained change detection can be achieved by performing hash calculations on the structural layer information, content layer information, style layer information, and dependency layer information respectively. This allows for accurate identification of which design nodes have changed and which nodes can reuse cached results, significantly reducing unnecessary repetitive calculations, improving data processing efficiency, and ultimately optimizing the response speed of the preset programming tools and the overall system performance.
[0065] In the above Figure 1 Based on the corresponding embodiments, in order to more clearly demonstrate the caching process of the preset caching system, the present invention also provides a possible implementation method for the data caching process in the design data processing based on hierarchical hash caching. Figure 3 This invention provides a schematic diagram of the data retrieval cache process in data processing based on a hierarchical hash cache design. For example... Figure 3 As shown, in S104 above, before performing change identification on the latest design data based on the latest hash values of each design node and the historical hash values of each design node in each design element cached in the preset cache system, the process includes: S401, determine whether the preset cache system has a cache area for each design node.
[0066] The cache area is a data storage space reserved for specific design nodes in the pre-defined caching system. It is used to store multi-level hash values and the corresponding processing data for each node. By checking whether a cache area exists, unnecessary processing can be avoided for design nodes that are not cached.
[0067] In practice, by pre-checking the existence of the cache, invalid operations can be avoided, thereby improving processing efficiency and reducing resource waste.
[0068] S402, if the preset cache system has a cache area for each design node, then determine whether the cache area of each design node is valid for time.
[0069] In this context, "time validity" refers to the state where the multi-level historical hash values of each design node cached in the preset caching system are still considered usable within a specified time. Since the multi-level historical hash values of each design node may change over time, a reasonable time validity period (e.g., 30 minutes) needs to be set. If the difference between the current time and the timestamp recorded in the cache exceeds the set time validity period, the cache is considered invalid. The validity of the cache in the preset caching system is determined by comparing the current time with the timestamp in the cache record.
[0070] In practice, introducing a time validity judgment mechanism can ensure that only the latest cached data is used, thereby improving the accuracy of change detection and preventing erroneous results caused by using expired cached data.
[0071] S403, if the time of the cache of each design node is valid, then obtain the multi-level historical hash value of each design node from the cache of each design node.
[0072] If the time in the cache of each design node is valid, the previously stored multi-level hash values are directly retrieved from the cache and used for subsequent change identification. In one possible implementation, if the time in the cache of a certain design node is invalid, change identification is not performed, but a complete multi-level hash value calculation and data processing are directly triggered. The latest hash values of all levels are recalculated for that node to obtain the corresponding protocol data. At the same time, the preset cache system is updated with the latest hash values, the corresponding protocol, and the current system time.
[0073] In actual implementation, by effectively judging the cache area corresponding to each design node and the time of the cache area, the accuracy and efficiency of subsequent change identification are ensured, while avoiding unnecessary computational consumption.
[0074] In one possible implementation, after returning the target protocol data to the preset programming tool, there is also a performance optimization method. Specifically, the time validity window of the cache corresponding to each design node can be counted, the current overall cache hit rate can be calculated, and the frequently accessed cache and the cache that has not been accessed for a long time can be identified. The time validity period of the frequently accessed cache can be extended, and the time validity period of the cache that has not been accessed for a long time can be shortened to reduce memory usage.
[0075] In this embodiment, before performing change identification, cache existence detection and time validity judgment are added to avoid the use of invalid cache data, while improving processing efficiency, reducing the consumption of computing resources, and improving the user's interactive experience.
[0076] In the above Figure 3 Based on the corresponding embodiments, in order to more clearly demonstrate the caching process of the preset caching system, the present invention also provides another possible implementation of the data caching process in data processing based on hierarchical hash caching. Figure 4 This invention provides a schematic diagram of a data caching process in data processing based on a hierarchical hash cache design. For example... Figure 4 As shown, in S401 above, after determining whether the preset cache system has a cache area for each design node, the following steps are included: S4011 If the preset cache system does not have a cache area for the target design node, then create a cache area for the target design node in the preset cache system, and cache the latest hash value of the target design node in the target design node's cache area.
[0077] The target design node refers to the design node corresponding to the design element that needs to be processed. In practice, when it is detected that the target design node has not yet been cached, a new independent cache area will be created for the target design node in the preset cache system, and the calculated latest hash value of the target design node will be stored in this cache area.
[0078] In practice, this method ensures that subsequent change identification and data processing can quickly access the hash value of the target design node, thereby improving the overall system's response speed and resource utilization.
[0079] S4012, based on the MCP protocol, processes the data of the target design node in the latest design data to obtain the protocol data of the target design node.
[0080] In this embodiment, the target design data is converted into a structured data format recognizable by a preset programming tool according to the MCP protocol. Specifically, the data of the target design nodes undergoes processing steps such as extraction, simplification, and structural reorganization to generate protocol data that conforms to the MCP standard.
[0081] S4013, cache the protocol data of the target design node into the cache area of the target design node.
[0082] Cache the protocol data in the cache of the target design node, which means that the existing protocol data in the cache can be reused directly in the future. Especially when facing frequent requests or large design files, it can effectively reduce server load and speed up response.
[0083] In one possible implementation, the protocol data of the target design node, the protocol data of the changed node, and the protocol data of the unchanged node can be combined to generate target protocol data and returned to the preset programming tool.
[0084] In this embodiment, when it is detected that the preset caching system does not have a cache for the target design node, a cache for the target design node is created, and the latest hash values of the target design node at multiple levels and the protocol data are stored in this cache. This avoids recalculating the hash value of the target design node and re-executing the MCP protocol processing flow with each request, thereby reducing unnecessary computational overhead and network transmission burden.
[0085] In the above Figure 1 Based on the corresponding embodiments, the above method further includes: S501 caches the protocol data of the changed node in the cache area of the changed node in the preset cache system.
[0086] The protocol data of the changed nodes is closely related to the change identification phase in the aforementioned scheme. During the change identification phase, multi-level hash calculations are used to compare the latest hash values and historical hash values of each design node to determine which nodes have changed. Once a node is confirmed as a changed node, this step is executed, caching its corresponding protocol data to the corresponding cache area in the preset caching system. This allows for direct reuse of cached data subsequently, significantly improving processing efficiency.
[0087] In one possible implementation, suppose that in a design project, the designer modifies the color attributes of multiple layers. A hash algorithm is then used to detect the nodes corresponding to these layers as changed nodes. Subsequently, the protocol data of the changed nodes is cached in the corresponding cache area of a preset caching system. When design data is subsequently returned to the preset programming tool, the protocol data of the changed nodes can be read directly from the cache area of the preset caching system without having to re-execute the entire processing flow.
[0088] In this embodiment, by caching the protocol data of the changed node to the corresponding cache area in the preset cache system, the repeated processing of the same data can be avoided, thereby reducing the consumption of computing resources.
[0089] In the above Figure 1 Based on the corresponding embodiments, in order to more clearly demonstrate the caching process of the preset caching system, the present invention also provides another possible implementation of the data caching process in data processing based on hierarchical hash caching. Figure 5 This invention provides a schematic diagram of a data caching process in data processing based on a hierarchical hash cache design. For example... Figure 5 As shown above, in the above Figure 1 Based on steps S101-S107, the method further includes: S601 performs a hash calculation on the target protocol data to obtain the protocol hash data.
[0090] The target protocol data, generated from the protocol data of the unchanged nodes and the protocol data of the changed nodes, is hashed to obtain the protocol hash data. This protocol hash data identifies the entire design state of the data processing and can be used later for rapid comparison of differences between different versions.
[0091] S602 caches the protocol hash data to the preset cache system and updates the design data cache status of each design element.
[0092] The protocol hash data is cached in a preset cache system to facilitate the identification of subsequent changes.
[0093] Meanwhile, the design data cache status records information such as the cache time for each design element's corresponding design node. By updating the design data cache status of design elements, intelligent cache management and efficient reuse are achieved.
[0094] In one possible implementation, for nodes that have not changed, their cache state (cache timestamp) is updated to extend their validity period; for nodes that have changed, not only is the cache state updated, but their corresponding processing data and multi-level hash values are also updated.
[0095] In this embodiment, by performing hash calculation on the target protocol data to generate protocol hash data, and caching the protocol hash data in a preset cache system, the system updates the cache status of the design data corresponding to the design elements. This can reduce subsequent redundant calculations, optimize resource utilization, improve system response speed, and enable the system to provide more efficient context support for AI programming tools.
[0096] In another possible implementation, if multiple front-end developers simultaneously request the same updated design file data, an efficient concurrent processing flow will be initiated. Specifically, multiple requests for the same design file data are first identified. The first request triggers a complete data processing flow (including calculating multiple layers of the latest hash values for change identification, and finally processing the data to obtain the target protocol data and the corresponding protocol hash data). This process completes cache preheating, and subsequent requests are directly guided to the preheated latest cache to skip redundant calculations. The existing hash values are used for comparison to ensure the consistency of the distributed data, distributing the cost of a single data processing task across the entire team, thus significantly improving team collaboration efficiency.
[0097] The following describes the surface detection device and computer equipment for mining areas based on UAV aerial photography provided in this application, and the specific implementation process and technical effects are described above, and will not be repeated below.
[0098] Figure 6 A schematic diagram of a data processing device based on a hierarchical hash cache provided by the present invention is shown below. Figure 6 As shown, the data processing device based on hierarchical hash caching includes: Request module 1000 is used to obtain design data requests triggered by a preset programming tool.
[0099] The acquisition module 2000 is used to acquire the latest design data based on the design data request, wherein the latest design data includes at least one design element.
[0100] The calculation module 3000 is used to perform hash calculations on the multi-layer information of each design node in each design element to obtain the latest multi-layer hash value of each design node in each design element. The multi-layer information corresponds to the information of the design element in multiple dimensions.
[0101] The identification module 4000 is used to identify changes in the latest design data based on the latest multi-layer hash values of each design node and the multi-layer historical hash values of each design node in each design element cached in the preset cache system, so as to obtain the changed nodes and unchanged nodes of the design elements in the latest design data.
[0102] The processing module 5000 is used to process the data of the changed nodes in the latest design data according to the Model Context Protocol (MCP) to obtain the protocol data of the changed nodes.
[0103] The synthesis module 6000 is used to generate target protocol data based on the protocol data of the unchanged node cached in the preset caching system and the protocol data of the changed node. The output module 7000 is used to return the target protocol data to the preset programming tool.
[0104] Optionally, module 2000 is also used to parse the request parameters of the design data request to obtain the design tool type; and according to the design tool type, to use the design tool corresponding to the design tool type to obtain the latest design data.
[0105] Optionally, the multi-layer information of each design node includes: structural layer information, content layer information, style layer information, and dependency layer information; the structural layer information is the hierarchical structure information of the design elements in each design node, the content layer information is the content attribute information of the design elements in each design node, the style layer information is the style attribute information of the design elements in each design node, and the dependency layer information is the reference relationship information between the design elements in each design node; the latest hash value of each layer includes: the latest hash value of the structural layer, the latest hash value of the content layer, the latest hash value of the style layer, and the latest hash value of the dependency layer.
[0106] Optionally, the calculation module 3000 is further configured to perform hash calculations on the structure layer information, the content layer information, the style layer information, and the dependency layer information respectively, to obtain the latest hash value of the structure layer, the latest hash value of the content layer, the latest hash value of the style layer, and the latest hash value of the dependency layer of the design element.
[0107] Optionally, the identification module 4000 is also used to determine whether the preset cache system has a cache area for each design node; if the preset cache system has a cache area for each design node, then determine whether the cache area for each design node is valid in time; if the cache area for each design node is valid in time, then obtain the multi-level historical hash value of each design node from the cache area of each design node.
[0108] Optionally, the identification module 4000 is also used to create a cache area for the target design node in the preset cache system if the preset cache system does not have a cache area for the target design node, and cache the latest hash value of the target design node in the cache area for the target design node.
[0109] Optionally, the processing module 5000 is also used to process the data of the target design node in the latest design data according to the MCP protocol to obtain the protocol data of the target design node.
[0110] Optionally, the design data processing device based on hierarchical hash caching further includes a caching module 8000 for caching the protocol data of the target design node into the cache area of the target design node.
[0111] Optionally, the cache module 8000 is also used to cache the protocol data of the changed node to the cache area of the changed node in the preset cache system.
[0112] Optionally, the calculation module 3000 is also used to perform hash calculations on the target protocol data to obtain protocol hash data.
[0113] Optionally, the cache module 8000 is also used to cache protocol hash data to a preset cache system and update the design data cache status of each design element.
[0114] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more digital signal processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).
[0115] Figure 7 This is a schematic diagram of a computer device provided by the present invention. The device may be a computing device or a server with computing processing capabilities.
[0116] This application does not limit the product form of the computer device 10. When the computer device 10 integrates a design data processing program based on hierarchical hash caching, it can be used as a design data processing device to process design data.
[0117] The computer device 10 includes a processor 11, a storage medium 12, and a bus 13. The storage medium 12 stores program instructions executable by the processor 11. When the computer device 10 is executed, the processor 11 communicates with the storage medium 12 via the bus 13, and the processor 11 executes the program instructions to perform the above-described method embodiment. The specific implementation and technical effects are similar and will not be described in detail here.
[0118] Optionally, the present invention also provides a program product, such as a computer-readable storage medium, including a program that, when executed by a processor, is used to perform the above-described method embodiments.
[0119] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0120] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0121] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0122] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0123] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A data processing method based on hierarchical hash caching, characterized in that, The method includes: Retrieve design data requests triggered by preset programming tools; Based on the design data request, obtain the latest design data, wherein the latest design data includes at least one design element; For each design node in each design element, perform hash calculations on the multi-layer information to obtain the latest multi-layer hash value of each design node in each design element, wherein the multi-layer information corresponds to the information of the design element in multiple dimensions. Based on the latest hash values of each design node and the historical hash values of each design node in each design element cached in the preset caching system, change identification is performed on the latest design data to obtain the changed nodes and unchanged nodes of the design elements in the latest design data. Based on the Model Context Protocol (MCP), the data of the change node in the latest design data is processed to obtain the protocol data of the change node; Based on the protocol data of the unchanged node cached in the preset caching system and the protocol data of the changed node, target protocol data is generated; The target protocol data is returned to the preset programming tool.
2. The method according to claim 1, characterized in that, The step of obtaining the latest design data based on the design data request includes: The design data request is parsed to obtain the design tool type; Based on the design tool type, the latest design data is obtained using the design tool corresponding to the design tool type.
3. The method according to claim 1, characterized in that, The multi-layer information of each design node includes: structural layer information, content layer information, style layer information, and dependency layer information; wherein, the structural layer information is the hierarchical structure information of the design element in each design node, the content layer information is the content attribute information of the design element in each design node, the style layer information is the style attribute information of the design element in each design node, and the dependency layer information is the reference relationship information of the design element between each design node; the latest hash value of each layer includes: the latest hash value of the structural layer, the latest hash value of the content layer, the latest hash value of the style layer, and the latest hash value of the dependency layer; The process of performing hash calculations on the multi-layer information of each design node in each design element to obtain the latest multi-layer hash value of each design node in each design element includes: Hash calculations are performed on the structure layer information, content layer information, style layer information, and dependency layer information respectively to obtain the latest hash values of the structure layer, content layer, style layer, and dependency layer of the design element.
4. The method according to claim 1, characterized in that, Before performing change identification on the latest design data based on the latest hash values of each design node and the historical hash values of each design node in each design element cached in the preset caching system, the method further includes: Determine whether the preset caching system has a cache area for each of the design nodes; If the preset caching system has a cache area for each design node, then determine whether the cache area of each design node is valid for a certain period of time. If the time of the cache of each design node is valid, then the multi-level historical hash value of each design node is obtained from the cache of each design node.
5. The method according to claim 4, characterized in that, After determining whether the preset caching system has the cache area for each design node, the method further includes: If the preset caching system does not have a cache area for the target design node, then a cache area for the target design node is created in the preset caching system, and the latest hash values of the target design node at multiple levels are cached in the cache area of the target design node. According to the MCP protocol, the data of the target design node in the latest design data is processed to obtain the protocol data of the target design node; The protocol data of the target design node is cached in the cache area of the target design node.
6. The method according to claim 1, characterized in that, The method further includes: The protocol data of the changed node is cached in the cache area of the changed node in the preset cache system.
7. The method according to claim 1, characterized in that, The method further includes: The target protocol data is hashed to obtain protocol hash data; The protocol hash data is cached in the preset cache system, and the design data cache status of each design element is updated.
8. A data processing device based on hierarchical hash caching, characterized in that, The device includes: The request module is used to obtain design data requests triggered by a preset programming tool; The acquisition module is used to acquire the latest design data based on the design data request, wherein the latest design data includes at least one design element; The calculation module is used to perform hash calculations on the multi-layer information of each design node in each design element to obtain the latest multi-layer hash value of each design node in each design element, wherein the multi-layer information corresponds to the information of the design element in multiple dimensions. The identification module is used to identify changes in the latest design data based on the latest multi-layer hash values of each design node and the historical multi-layer hash values of each design node in each design element cached in the preset cache system, so as to obtain the changed nodes and unchanged nodes of the design elements in the latest design data. The processing module is used to process the data of the change node in the latest design data according to the Model Context Protocol (MCP) to obtain the protocol data of the change node. The synthesis module is used to generate target protocol data based on the protocol data of the unchanged node cached in the preset caching system and the protocol data of the changed node. The output module is used to return the target protocol data to the preset programming tool.
9. A computer device, characterized in that, include: The computer device includes a processor, a memory, and a bus. The memory stores program instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. The processor executes the program instructions to perform the steps of the data processing method based on hierarchical hash caching as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which is executed by a processor to perform the data processing method based on hierarchical hash caching as described in any one of claims 1-7.