A CAD drawing loading method and system combined with cache optimization
By dynamically allocating and monitoring the block data of CAD drawings to memory and disk cache, and optimizing cache management in conjunction with user interaction operations, the problem of low loading efficiency of traditional CAD drawings is solved, thereby improving loading speed and user experience.
Patent Information
- Application Number
- CN202510796345.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-16
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2045-06-16
AI Technical Summary
Traditional CAD drawing loading processes lack effective cache management, resulting in long loading times, sluggish drawing display, poor user experience, inefficient resource utilization, and impact on system performance.
By identifying block data in CAD drawings, the data is dynamically allocated to memory cache and disk cache. The memory cache is monitored in real time, cache parameters are generated, and asynchronous loading is triggered based on user interaction to optimize cache management.
It achieves efficient cache management for CAD drawing loading, reduces waiting time, improves the smoothness of drawing display and user interaction experience, and optimizes resource utilization.
Smart Images

Figure CN120315779B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of graphic cache optimization, and particularly relates to a CAD drawing loading method and system combined with cache optimization. BACKGROUND
[0002] In a traditional CAD drawing loading process, due to the lack of an effective cache management mechanism, a large amount of data needs to be repeatedly read from a disk each time a drawing is loaded, resulting in long loading waiting time and low efficiency. When a complex drawing is processed or frequent interactive operations are performed, data is frequently exchanged between the memory and the disk, and a lag phenomenon is prone to occur, thereby affecting the smoothness of drawing display and the user interactive experience. Meanwhile, the memory and disk resources are not reasonably utilized, resources are wasted, and the performance of the CAD system is limited.
[0003] The prior art has the technical problem of low cache management efficiency of CAD drawing loading, resulting in long loading waiting time, lagging and unsmooth drawing display, and poor user interactive experience. SUMMARY
[0004] The application provides a CAD drawing loading method and system combined with cache optimization, which is used to solve the technical problem of low cache management efficiency of CAD drawing loading in the prior art, resulting in long loading waiting time, lagging and unsmooth drawing display, and poor user interactive experience.
[0005] In view of the above problems, the application provides a CAD drawing loading method and system combined with cache optimization.
[0006] In a first aspect, the application provides a CAD drawing loading method combined with cache optimization, which comprises the following steps:
[0007] The target CAD drawing is read and identified, and the block data associated with the entity is extracted according to the identification result; the block data is dynamically allocated to a plurality of cache areas, the plurality of cache areas include a memory cache area and a disk cache area; the block data in the memory cache area is monitored in real time to generate a first monitoring data set, the cache is adjusted according to the first monitoring data set to generate a first cache parameter; the first cache parameter is unloaded to the disk cache area according to the first monitoring data set to generate a second cache parameter; the first cache parameter is combined to load the drawing in the memory cache area according to the user's interactive operation on the drawing, and the second cache parameter is triggered to perform asynchronous loading in the disk cache area according to the loading result.
[0008] In a second aspect, the application provides a CAD drawing loading system combined with cache optimization, which comprises the following steps:
[0009] The drawing recognition module is used for reading a target CAD drawing for recognition, and extracting drawing block data associated with entities according to a recognition result; the data allocation module is used for dynamically allocating the drawing block data to a plurality of cache areas, the plurality of cache areas including a memory cache area and a disk cache area; the first cache parameter generation module is used for monitoring the drawing block data of the memory cache area in real time, generating a first monitoring data set, adjusting the cache according to the first monitoring data set, and generating a first cache parameter; the second cache parameter generation module is used for performing data offloading of the first cache parameter to the disk cache area according to the first monitoring data set, and generating a second cache parameter; and the drawing loading module is used for loading the drawing of the memory cache area according to a user's interactive operation on the drawing, combining the first cache parameter, triggering the second cache parameter to perform asynchronous loading of the disk cache area according to a loading result.
[0010] The one or more technical solutions provided in the application have at least the following technical effects or advantages:
[0011] The target CAD drawing is read for recognition, and drawing block data associated with entities is extracted according to a recognition result; the drawing block data is dynamically allocated to a plurality of cache areas; the drawing block data of the memory cache area is monitored in real time, a first monitoring data set is generated, the cache is adjusted, and a first cache parameter is generated; the first cache parameter is subjected to data offloading to the disk cache area according to the first monitoring data set, and a second cache parameter is generated; the drawing of the memory cache area is loaded in combination with the first cache parameter, and the second cache parameter is triggered to perform asynchronous loading of the disk cache area according to a loading result. The technical effect of efficient cache management of CAD drawing loading is achieved, the loading waiting time is effectively reduced, and the drawing display fluency and user interactive experience are improved. BRIEF DESCRIPTION OF DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0013] Figure 1 A CAD drawing loading method flow diagram combined with cache optimization is provided for the embodiments of the present application.
[0014] Figure 2 A CAD drawing loading system structure diagram combined with cache optimization is provided for the embodiments of the present application.
[0015] Explanation of reference signs: drawing identification module 10, data distribution module 20, first cache parameter generation module 30, second cache parameter generation module 40, drawing loading module 50. DETAILED DESCRIPTION
[0016] The present application provides a CAD drawing loading method and system combined with cache optimization, which is used to solve the technical problems of low cache management efficiency, long loading waiting time, unsmooth drawing display, and poor user interaction experience in the prior art.
[0017] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.
[0018] In one embodiment, as shown in the drawings, Figure 1 The present application provides a CAD drawing loading method combined with cache optimization, which comprises:
[0019] Step S100: reading a target CAD drawing for identification, and extracting entity-associated tile data according to the identification result.
[0020] Specifically, with the help of CAD drawing parsing tools, the target CAD drawing is read in a way that adapts to multiple common drawing formats such as DWG and DXF. The reading process uses recognition algorithms to accurately identify the model space and database block table in the drawing by deeply analyzing the structure of the drawing file and matching the characteristics of the graphical elements. For the model space, a traversal program is started to deeply inspect each drawing block reference entity. Based on specific association rules such as spatial position relationships between entities and attribute dependency relationships, the first drawing block data closely associated with them is extracted. At the same time, a data access heat analysis algorithm is used to evaluate the extracted first drawing block data and mark the candidate labels that may be frequently accessed. In terms of the database block table, a recursive traversal method is used to gradually delve into the sub-drawing block reference entities. Based on the internal organization structure and data association logic of the database block table, second drawing block data is extracted, and through analyzing its frequency of use and degree of association in historical operation records, low-frequency access candidate labels are marked. Finally, the first drawing block data and the second drawing block data with different access characteristic labels (high-frequency and low-frequency access candidate labels) are integrated. This integrated drawing block data set not only retains the key information of various entities in the drawing, but also carries access characteristic identifiers closely related to subsequent cache allocation and loading optimization, providing a data foundation for subsequent steps such as dynamically allocating drawing block data to different cache areas based on access characteristics and intelligently adjusting the cache based on access monitoring.
[0021] Step S200: dynamically allocating the drawing block data to a plurality of cache areas, the plurality of cache areas including a memory cache area and a disk cache area.
[0022] Specifically, first, the high-frequency access candidate labels are matched with the drawing block data to filter out the first drawing block data. Considering the fast reading speed of the memory cache area, this part of data is allocated to the first level of the memory cache area to ensure that the frequently used drawing block data can be quickly accessed during the subsequent drawing loading process, improving the loading efficiency. Next, the system matches the low-frequency access candidate labels with the drawing block data to extract the second drawing block data. For this part of low-frequency access data, the system further evaluates factors such as data size and frequency of use. If the data size is small and there is still a certain access possibility, it will be allocated to the second level of the memory cache area; if the data size is large or the access frequency is very low, to avoid occupying too much memory resource and affecting system performance, the system will allocate it to the disk cache area. Such a dynamic allocation strategy fully utilizes the advantages of the memory cache area and the disk cache area, realizes the reasonable layout of the drawing block data in different cache areas, and provides strong support for subsequent efficient cache management and drawing loading.
[0023] Step S300: Real-time monitoring of the tile data in the memory cache area is performed to generate a first monitoring data set, and a first cache parameter is generated based on the first monitoring data set.
[0024] Specifically, real-time monitoring of the tile data in the memory cache area is performed by means of a memory monitoring program. The monitoring program continuously collects access state information of the tile data, including the number of accesses, access timestamps, and memory consumption per access. These data are aggregated according to the tile identifier, and information reflecting the timing characteristics of the tile data access is generated and added to the first monitoring data set. After the first monitoring data set is obtained, the number of accesses of the tile data is extracted based on the data set, the access frequency of the tile data is accurately obtained through time decay weighting calculation, and memory occupancy calculation is performed to obtain the memory occupancy rate of the tile data. Based on these data, the determination of the cache adjustment strategy is started. If the access frequency of the tile data shows high-frequency access, but the current cache level is at a low priority, the tile data is promoted to a high-priority level in the memory cache area, and such data is marked as reserved candidate data; if the access frequency of the tile data belongs to low-frequency access, and the memory occupancy rate exceeds a preset threshold, the cache level weight of the tile data is reduced, and the tile data is determined as a candidate data to be unloaded. Finally, the first cache parameter is constructed according to the reserved candidate data and the candidate data to be unloaded, which provides a key control basis for subsequent management, migration, and collaborative work of the tile data in the memory cache area and the disk cache area, helps to optimize memory usage, and improves the CAD drawing loading performance.
[0025] Step S400: Data unloading of the first cache parameter to the disk cache area is performed based on the first monitoring data set to generate a second cache parameter.
[0026] Specifically, according to the access frequency and memory occupancy of the tile data in the first monitoring data set, the candidate data to be unloaded involved by the first cache parameter is integrated, and the data meeting the unloading condition is arranged into a to-be-unloaded tile list. In order to ensure the efficient use of the disk cache area, the to-be-unloaded tile list is sorted for cache replacement, and the target unloaded tile is determined by comprehensively considering the access frequency, memory occupancy and storage location of the tile data on the disk and other factors. Subsequently, the target unloaded tile is migrated from the memory cache area to the disk cache area, and the storage path of the target unloaded tile on the disk is recorded in detail to facilitate subsequent quick retrieval. After completing the data migration, the state information of the unloaded memory cache area is extracted, including the remaining available memory space, the usage of each level cache and the like. In combination with these information and the related data of the target unloaded tile, the second cache parameter is generated. This parameter not only records the storage location and state of the tile data in the disk cache area, but also contains the adjustment information for the subsequent operation of the memory cache area, which provides an important basis for subsequent asynchronous loading of the disk cache area and data update and preloading strategy adjustment of the memory cache area according to the user operation, realizes the dynamic balance and efficient cooperation between the memory cache area and the disk cache area, and further optimizes the CAD drawing loading performance.
[0027] Step S500: according to the interactive operation of the user on the drawing, the drawing loading of the memory cache area is performed in combination with the first cache parameter, and the second cache parameter is triggered according to the loading result to perform the asynchronous loading of the disk cache area.
[0028] Specifically, the operation behavior of the user on the CAD drawing is monitored, and as soon as the user input interaction instruction such as zooming, panning or rotating is captured, analysis is immediately performed. By calculating the view transformation matrix, in combination with the relevant attributes of the tile data, the boundary coordinates and the zoom level of the tile data are determined, and then the geometric coverage range parameters are generated, which are then mapped to the tile space index to accurately locate the target view area. Based on the target view area, the tile data associated therewith is extracted from the memory cache area according to the first cache parameter for real-time loading. During the loading process, a hit loading result (the required tile data is successfully obtained from the memory cache area) and / or a miss loading result (the required tile data does not exist in the memory cache area) will be generated. If the hit loading result and the miss loading result occur, or only the miss loading result exists, a disk loading request is generated. The request triggers the second cache parameter, and then an asynchronous loading task of the disk cache area is started. During the asynchronous loading process, the required tile data is quickly retrieved and read from the disk cache area according to the disk storage path information. After the loading is completed, the tile data of the memory cache area is updated according to the execution result of the asynchronous loading task, the newly obtained data is stored in the appropriate level of the memory cache area, and the preloading strategy in the second cache parameter is adjusted, so as to optimize the loading task for the next user operation, thereby ensuring the smooth loading and display of the CAD drawing during the user interactive operation.
[0029] In one possible implementation manner, the step S100 further includes:
[0030] Step S110: reading a target CAD drawing, identifying based on the target CAD drawing, obtaining an identification result, the identification result containing a model space and a database block table.
[0031] Step S120: performing correlation analysis on the tile reference entities of the model space, extracting first tile data according to a first correlation relationship, marking the first tile data, and determining high-frequency access candidate labels.
[0032] Step S130: recursively traversing the sub-tile reference entities in the database block table, extracting second tile data according to a second correlation relationship, marking the second tile data, and determining low-frequency access candidate labels.
[0033] Step S140: adding the high-frequency access candidate labels and the low-frequency access candidate labels to the tile data.
[0034] Specifically, the file format parsing algorithm is used to open and read the target CAD drawing file according to the specific file header structure and coding rules of common CAD file formats (such as DWG, DXF), and to convert binary data into processable text or data structure. Then, the data preprocessing algorithm is executed to remove redundant information and annotations in the file, and to preliminarily clean and format the data. Subsequently, the feature matching algorithm is used for recognition. For the model space, all graphic elements and related data in the model space are located and extracted by matching keywords and the coordinate range and attribute features of graphic elements. For the database block table, the location and content of the database block table are searched and identified in the preprocessed data according to the feature identification of the block table (such as the start marker of the block definition, the block name, etc.). At the same time, the structure analysis algorithm is used to further analyze the identified model space and database block table to determine their internal structure, hierarchical relationship and data association, so as to ensure that the graphic information in the model space and the block definition, attribute and other information in the database block table can be accurately obtained. Finally, the recognition and analysis results are output as the recognition results of the model space and the database block table, providing accurate data basis for subsequent steps.
[0035] The breadth-first search algorithm is used to traverse the tile reference entities of the model space, starting from the root node of the model space, accessing each tile reference entity layer by layer, and ensuring that no entity is missed. In the traversal process, the graph theory algorithm in the correlation analysis algorithm is used to abstract the tile reference entities as nodes in the graph, and the connection relationship between the nodes is constructed according to the first correlation relationship such as spatial adjacency, attribute similarity and logical association, forming a graph structure. By calculating the shortest path and connectivity between nodes in the graph, a set of tile reference entities with close correlation is found. Then, the data filtering algorithm is used to extract the first tile data that meets the first correlation relationship according to the correlation analysis results. This algorithm will filter out tile reference entities with low correlation according to the preset correlation threshold, and only keep the tile data with correlation higher than the threshold with the current traversal node. Subsequently, the classification algorithm in machine learning is used to process the first tile data. Historical CAD operation data is collected, including tile access frequency, operation time, operation type and other information, to train a classification model such as a decision tree classifier. The relevant features of the first tile data are input into the trained classification model, and the model will judge whether each tile data belongs to high-frequency access or low-frequency access according to the features, so as to mark the high-frequency access candidate label for the first tile data. Finally, the marked first tile data is stored to provide a basis for subsequent cache management and drawing loading optimization.
[0036] For the database block table, a recursive traversal algorithm is enabled, starting from the root node of the database block table, and exploring the sub-graph block reference entities in it. Every time a sub-graph block reference entity is encountered, if it still contains a sub-graph block, the traversal function is recursively called until the bottom layer of the sub-graph block is reached. During the traversal process, a correlation analysis algorithm is used to construct a second correlation relationship, which takes into account factors such as hierarchical dependency, data reference, and scene correlation between sub-graph blocks. For example, if a sub-graph block is a basic component of another sub-graph block, or is only occasionally referenced in a specific design process, a specific correlation will be formed. Based on the constructed second correlation relationship, a data extraction algorithm is used to filter out second block data that meets the conditions. This algorithm extracts graph block data with specific correlations accurately according to pre-set correlation rules and thresholds. In order to determine appropriate access labels for second block data, an access pattern analysis algorithm is used, which deeply analyzes the historical operation data of CAD drawings and counts the access frequency and access interval time of each block data. Combined with the general use mode of similar CAD drawings in the industry, the possible access frequency of these second block data in subsequent operations is predicted. If the predicted access frequency is low, these second block data are marked with a low-frequency access candidate label for subsequent reasonable cache management and resource allocation.
[0037] After the extraction of first block data and second block data and the determination of high-frequency and low-frequency access candidate labels, a data correlation algorithm is used to map the determined high-frequency access candidate labels and low-frequency access candidate labels to the corresponding block data according to the unique identifiers of the block data (such as number, name, etc.). This algorithm will traverse all block data, and for each block data, it will find its corresponding label information. For first block data marked as high-frequency access candidate, a high-frequency access candidate label field is added to its data structure, and the corresponding label value is written to this field. Similarly, for second block data marked as low-frequency access candidate, a low-frequency access candidate label field is also added to its data structure and the corresponding label value is written. In this way, access characteristic labels are closely associated with block data, forming a complete set of block data with access characteristic labels.
[0038] In one possible implementation, step S200 further includes:
[0039] Step S210: Extracting first block data based on matching the high-frequency access candidate label with the block data.
[0040] Step S220: Assigning the first block data to the first level of the memory cache area.
[0041] Step S230: Extracting second block data based on matching the low-frequency access candidate data with the block data.
[0042] Step S240: allocating the second tile data to a second level of the memory cache area or the disk cache area.
[0043] Specifically, first, a high-frequency access candidate label set and a complete tile data list are respectively read from a database or data structure in which tile data and corresponding label information are stored. Subsequently, data matching is started, and a fast matching algorithm is used to perform traversal search in the tile data list for each high-frequency access candidate label. In the search process, it is determined whether the tile data self-provided unique identifier (such as a specific tile ID, name code, etc.) and the identifier information associated with the high-frequency access candidate label match by comparison. Once a matching item is found, it is determined that the tile data is the first tile data meeting the condition, and the first tile data is extracted from the tile data list. The extracted first tile data is temporarily stored in a special cache area, waiting to be allocated to the first level of the memory cache area, so as to ensure that these high-frequency access data can be quickly acquired and used in the subsequent CAD drawing operation process, and the overall operation efficiency is improved.
[0044] The first tile data is allocated to the first level of the memory cache area. First, the state of the first level of the memory cache area is checked, including the occupied space size, the remaining available space, and the current cache strategy and other information. Then, according to the size of the first tile data and the remaining space of the first level of the memory cache area, it is determined whether there is enough space to accommodate the data. If the space is sufficient, a memory allocation algorithm is called to open a continuous storage area for the first tile data in the first level of the memory cache area. The address of this storage area is recorded, and a mapping relationship is established between the address and the identifier (such as a unique tile ID) of the first tile data, and is stored in a special index table, so as to be quickly located and accessed subsequently. At the same time, the occupied space information of the first level of the memory cache area is updated, and the size of the allocated space is recorded. If the first level of the memory cache area is insufficient, a cache cleaning mechanism is started. According to a preset cache replacement strategy (such as the least recently used strategy LRU), the least frequently used tile data in the first level is found and removed to release sufficient space. After the space is released, the memory space for the first tile data is allocated according to the above process, and the corresponding mapping relationship is established and the cache area state information is updated. Through this series of operations, it is ensured that the first tile data can be successfully and efficiently allocated to the first level of the memory cache area.
[0045] The low-frequency access candidate data containing low-frequency access candidate labels is read from the storage while loading all tile data containing respective feature information and labels. Then, the label information of each tile data is generated into a hash value by using a hash matching algorithm, and the labels in the low-frequency access candidate data are also generated into corresponding hash values. By comparing the hash values, a set of possibly matching tile data can be quickly screened out, greatly reducing the time complexity of full data comparison. After the set of possibly matching tile data is preliminarily screened out, secondary accurate matching is performed. For each possibly matching tile data, the detailed content of the label is compared in depth, including the semantic of the label, the associated attribute information, etc., to ensure that the labels are completely consistent. Once it is determined that the label of a certain tile data is completely matched with the label in the low-frequency access candidate data, the tile data is identified as the second tile data, and is extracted from the original tile data set and stored in a temporary storage area specially opened for the second tile data. The temporary storage area records the detailed information of the second tile data, and prepares for subsequent allocation of the second tile data to the second level of the in-memory cache area or the disk cache area, so as to realize reasonable storage and management of the low-frequency access data.
[0046] After the second tile data is successfully extracted, the data is reasonably allocated to the second level of the in-memory cache area or the disk cache area. First, the second tile data is analyzed in detail to evaluate key factors such as the data size, future access probability, and timeliness of the data. At the same time, the state of the second level of the in-memory cache area is monitored in real time to understand information such as the remaining available space, current cache load, and data access pattern. If the second tile data is small in size and has a certain access possibility in the future according to historical operation records, and the second level of the in-memory cache area has sufficient remaining space, the second tile data is preferentially allocated to the second level of the in-memory cache area. During the allocation process, the data is sequentially stored in a suitable position of the second level according to the relevance and access frequency of the data, and the index information of the cache area is updated so that subsequent positioning and access can be quickly performed. Conversely, if the second tile data is large in size or has a very low future access probability, in order to avoid occupying too much memory resource and affecting the system performance, the second tile data is selected to be allocated to the disk cache area. The corresponding storage space is allocated for the data on the disk, the data is completely written to the disk, and the storage location and related meta information of the data on the disk are recorded. Through this dynamic and flexible allocation strategy, the characteristics of the in-memory cache area and the disk cache area are fully utilized to realize efficient management of the tile data and improve the overall performance and response speed of CAD drawing processing.
[0047] In one possible implementation manner, the step S300 further includes:
[0048] Step S310: Real-time monitoring of the access state of the tile data in the memory cache area, the access state including the access times, access time stamps, and single access memory consumption of the tile data in the memory cache area.
[0049] Step S320: Aggregating the access times, access time stamps, and single access memory consumption according to the tile identifier, generating tile access timing features, and adding the tile access timing features to the first monitoring data set.
[0050] Step S330: Based on the first monitoring data set, combining the tile data for cache analysis, and generating the first cache parameter.
[0051] Specifically, an event-driven and timing polling combined mechanism is adopted to implement real-time monitoring of the tile data in the memory cache area. Whenever the tile data is accessed, the record is triggered immediately through the memory access hook function, accurately recording the number of times the tile data is called. Since the start, each access will make the corresponding counter increase by one. At the same time, the current time is obtained as the access time stamp using a high-precision clock function, accurate to the millisecond level, ensuring the recording of the specific time of each access. In terms of single access memory consumption monitoring, with the help of the memory management interface provided by the operating system, the memory usage is obtained before and after the tile data access, and the number of memory bytes consumed by single access is calculated by difference. In addition, a periodic polling task is also set, which scans the memory cache area every fixed time (such as 100 milliseconds), checks the access state information of each tile data comprehensively, and ensures the integrity and real-time of the data.
[0052] Based on the collected tile data access times, access time stamps, and single access memory consumption, the tile identifier is used as an index to traverse all monitoring data, and the data corresponding to the same tile identifier is classified. Through time series analysis algorithm, the access time stamps are arranged in chronological order, and combined with the access times and single access memory consumption, the timing structure reflecting the access rule of the tile data is constructed. In this process, the time interval of adjacent access time stamps is calculated, the access frequency change in different time periods is counted, and the distribution of memory consumption with access times and other feature parameters are calculated to form complete tile access timing features. Finally, the generated access timing features of each tile are added to the first monitoring data set as new record units, so that the data set can more comprehensively and deeply present the access characteristics of the tile data in the memory cache area.
[0053] Based on the first monitoring data set, combined with the tile data, a comprehensive cache analysis is carried out. First, by calculating the access times and access time stamps recorded in the first monitoring data set, the real-time access frequency of each tile data is accurately calculated by using the time window sliding algorithm, and the memory occupancy rate is accumulated according to the memory consumption of single access. Subsequently, a dynamic adjustment strategy is formulated according to the calculated real-time access frequency and memory occupancy rate. For the tile data with high access frequency and low memory occupancy rate, it is preferentially considered to be allocated to the high level of the memory cache area to ensure fast access; and for the tile data with low access frequency and high memory occupancy rate, it is migrated to the disk cache area or the level of the memory cache area is reduced, thereby releasing memory resources. In the whole adjustment process, the performance and resource utilization of the cache are continuously evaluated, and the adjustment strategy is continuously optimized. Finally, the first cache parameter is generated according to these dynamic adjustment strategies.
[0054] In one possible implementation manner, step S330 further includes:
[0055] Step S331: Based on the first monitoring data set, the access times of the tile data are extracted, and the access times are calculated by time decay weighting to obtain the access frequency of the tile data.
[0056] Step S332: Based on the first monitoring data set, the memory occupancy is calculated to obtain the memory occupancy rate of the tile data.
[0057] Step S333: Based on the tile data combined with the access frequency, when the access frequency of the tile data is high-frequency access and the cache level of the tile data is low priority, the tile data is promoted to the high priority level of the memory cache area, and the reserved candidate data is generated.
[0058] Step S334: Based on the tile data combined with the access frequency and the memory occupancy rate, when the access frequency of the tile data is low-frequency access and the memory occupancy rate of the tile data exceeds a preset threshold, the cache level weight of the tile data is reduced, and the to-be-unloaded candidate data is generated.
[0059] Step S335: Based on the reserved candidate data and the to-be-unloaded candidate data, the first cache parameter is constructed.
[0060] Specifically, first, the access times of each tile data are accurately extracted from the first monitoring data set. In order to more reasonably measure the access heat of the tile data, especially to highlight the influence of recent access behavior, a time decay weighting calculation method is used to obtain the normalized access frequency of the tile data , the calculation formula is = , This represents the normalized access frequency of tile i. It is the decay factor, whose value is between 0 and 1, used to control the degree of time decay; It is the time interval between the k-th visit and the current time. This is the memory consumption weight for the k-th access. As... Increase Smaller, earlier visits The contribution decreases. This formula combines the access frequency based on different times and memory consumption weights to obtain a normalized access frequency. The tiles are then classified based on this normalized access frequency. Two thresholds are pre-set. and ( > When the normalized access frequency of tile i) > This tile is classified as a high-frequency access tile, indicating that it has been frequently accessed recently and consumes a certain amount of memory resources; when > > At that time, the tile was a medium-frequency access tile, with its access popularity and resource consumption at a moderate level; while when < In this case, the tile was classified as a low-frequency access tile, indicating that it had been accessed infrequently recently. This tile classification method based on normalized access frequency provides an important basis for more accurate cache management and resource allocation in the future.
[0061] Based on the first monitoring dataset, the memory usage of the map tile data is calculated. The records for each map tile in the first monitoring dataset are traversed, and the memory consumption for each access is extracted. The memory consumption for all accesses of the same map tile is summed to obtain the total memory consumption for that map tile over the entire monitoring period. Simultaneously, the total capacity of the memory cache is obtained. Then, the total memory consumption of each map tile is divided by the total capacity of the memory cache, and multiplied by 100% to obtain the memory occupancy rate of each map tile in the memory cache. This memory occupancy rate directly reflects the degree of memory resource consumption by each map tile, providing crucial data support for subsequent cache optimization decisions such as cache level adjustment and resource allocation based on memory usage.
[0062] Based on the previously calculated access frequency of the tile data and its current cache level in the memory cache, the system performs a judgment operation. The system checks each tile data piece by piece, first confirming whether its access frequency falls within the high-frequency access range (i.e., the access frequency meets the requirements). > ), if the tile data meets the high-frequency access condition, further check its current cache level. When it is found that the tile data is currently in a low-priority cache level, it indicates that although it is frequently accessed, it cannot obtain the advantage position of fast response in the memory cache area. Based on this, the promotion operation is performed to migrate the tile data to the high-priority level of the memory cache area, so that it can be read faster when accessed subsequently, and the overall system performance is improved. After completing the promotion operation, the tile data is marked as reserved candidate data, which means that it is the object that needs to be reserved in the memory cache area and the access speed needs to be guaranteed in priority, and provides clear target guidance for subsequent cache resource management and optimization.
[0063] All tile data is traversed, and for each tile data, its access frequency is compared with the previously set low-frequency access judgment standard (i.e. < ) and whether its memory occupancy rate exceeds the preset threshold is checked. If the access frequency of a certain tile data is judged as low-frequency access, it means that it is rarely used in the near future; and its memory occupancy rate exceeds the preset threshold, which means that the tile data occupies relatively more memory resources, but does not make enough contribution to the efficient operation of the system. Based on such judgment result, corresponding measures are taken to reduce the cache level weight of the tile data. That is, the priority access level originally enjoyed by the tile data in the memory cache area is reduced, so that it is more likely to be processed when the memory resource is tight. Then, the tile data is marked as a candidate data to be unloaded, which will become the preferred object for subsequent unloading from the memory cache area to the disk cache area when necessary, so as to release the memory space, optimize the resource utilization of the memory cache area, and guarantee the stability of the overall system performance.
[0064] After the determination of the reserved candidate data and the to-be-unloaded candidate data is completed, the first cache parameter is constructed. The reserved candidate data is first sorted, and detailed information of each reserved candidate tile data is recorded, such as an identifier, a current memory cache area high priority level position, an access frequency and the like. These information will be used as a basis for subsequent ensuring that the data can be continuously and efficiently accessed. For the to-be-unloaded candidate data, key information is also collected, including a tile identifier, a current cache level weight, a memory occupancy rate and an access frequency and the like. Through these information, the occupancy and the use frequency of the to-be-unloaded candidate data in the memory cache area can be determined. Subsequently, according to the information of the reserved candidate data and the to-be-unloaded candidate data, a complete cache adjustment strategy is formulated. For the reserved candidate data, the retention time length of the reserved candidate data in the memory cache area high priority level, access permission and the like rules are determined; for the to-be-unloaded candidate data, the triggering condition of unloading, the unloading sequence and the storage position of the to-be-unloaded candidate data in the disk cache area after unloading are determined. Finally, the information sorted and the strategy formulated are integrated to form the first cache parameter. The parameter covers the management rules of the reserved candidate data and the to-be-unloaded candidate data, provides clear guidance for subsequent dynamic adjustment and optimization of the memory cache area, and helps to improve the running efficiency and resource utilization efficiency of the system.
[0065] In one possible implementation manner, step S330 further includes:
[0066] Step S336: generating a cache migration instruction set according to the first cache parameter, and executing the cache migration instruction set by a memory manager to migrate the tile data according to the priority to different cache levels, and generating a plurality of migration parameters.
[0067] Step S337: searching and retaining the tile data in the memory cache area according to the plurality of migration parameters, determining a metadata index, and obtaining a fast backtracking loading path.
[0068] Step S338: maintaining the tile data unloaded to the disk cache area according to the plurality of migration parameters, constructing a hash mapping table to record the correspondence between the tile identifier and the disk cache position, and obtaining a fast search path.
[0069] Specifically, according to the processing strategy of the tile data in the first cache parameter, the migration requirements of each tile data are parsed, and a cache migration instruction set is generated. The source cache address in the instruction set accurately locates the storage position of the tile data in the memory cache area or the disk cache area; the target cache address is according to the priority rule of the first cache parameter, and it is clear that the tile data should be migrated to the memory cache area level or the specified position of the disk cache area; the data compression identifier determines whether to enable the data compression algorithm in the migration process according to the size and characteristics of the tile data to save transmission bandwidth and storage space. Subsequently, the memory manager receives the cache migration instruction set and performs the migration operation on the tile data according to the instruction order. The memory manager will preferentially process the high-priority tile data migration task to ensure that the high-frequency access data can be quickly migrated to the appropriate cache level. During the migration process, the memory manager monitors the migration state in real time, records the migration start time, end time, transmission data volume and other information of each tile data. When all the tile data migration is completed, according to the recorded migration information, a plurality of migration parameters are generated. These migration parameters record the cache address change, migration time consumption, data compression ratio and other key information of each tile data before and after migration in detail.
[0070] After generating a plurality of migration parameters, according to the information contained in the plurality of migration parameters, the tile data in the memory cache area is searched and retained. The migration parameters record the state of each tile data before and after migration in detail, and based on this information, the tile data that needs to be retained in the memory cache area is selected. This is usually determined by the first cache parameter as high-frequency access data that needs to be quickly responded to, so as to ensure that the system can efficiently process related operations. After determining the tile data to be retained, the metadata index is constructed. The metadata index is a collection of key information of the retained tile data, including tile identifier, current memory cache address, access frequency, data update time, etc. Through the organization and management of these metadata, the tile data can be located and accessed in a more efficient way. Based on the constructed metadata index, the association and access logic between the data are further analyzed, and the fast backtracking loading path is planned. This path specifies how to quickly locate the target data from the index and load it from the memory cache when accessing the tile data in the memory cache area. The determination of the fast backtracking loading path significantly reduces the data search and loading time, improves the access speed and response performance of the system to the tile data, and makes the subsequent operation of the CAD drawing more smooth and efficient.
[0071] The tile data unloaded to the disk cache area is maintained according to multiple migration parameters. The migration parameters record the detailed information of the migration of the tile data, including the target position of each tile data unloaded from the memory cache area to the disk cache area, the data size, and the like. By using this information, the tile data in the disk cache area is periodically checked and updated to ensure the integrity and accuracy of data storage, and to clean up possible redundant or invalid data. On this basis, a hash mapping table is constructed. By using a hash algorithm, the unique identifier of each tile is mapped to the corresponding disk cache position. The hash mapping table stores data in the form of key-value pairs, where the key is the tile identifier and the value is the specific storage position information of the tile in the disk cache area. This data structure enables the system to quickly calculate the corresponding disk position of the tile through the tile identifier when accessing the tile data in the disk cache area, without the need for full disk scanning. Finally, based on the constructed hash mapping table, a fast retrieval path is obtained. When subsequent operations need to call the tile data stored in the disk cache area, only the tile identifier needs to be provided, and the hash mapping table can quickly locate the storage position of the tile on the disk, greatly shortening the data retrieval time and effectively improving the efficiency of disk cache area data access, providing efficient support for the CAD drawing in the disk cache data calling link.
[0072] In one possible implementation, step S400 further includes:
[0073] Step S410: integrating the candidate data to be unloaded according to the access frequency and the memory occupancy rate of the tile data in the first monitoring data, and constructing a list of tiles to be unloaded.
[0074] Step S420: performing cache replacement sorting on the list of tiles to be unloaded, filtering based on a cache replacement sequence, and determining a target unloaded tile.
[0075] Step S430: migrating the target unloaded tile from the memory cache area to the disk cache area, and recording the disk storage path of the target unloaded tile.
[0076] Step S440: extracting the state information of the memory cache area after unloading according to the disk storage path, and generating the second cache parameter.
[0077] Specifically, the access frequency and the memory occupancy rate indicators of each tile data in the first monitoring data are analyzed based on the first monitoring data. The first monitoring data is traversed, and the tile data whose access frequency is lower than the low-frequency threshold (i.e. < ) and the memory occupancy exceeds the preset upper limit are screened out. During the screening process, the relevant attributes of each candidate data to be unloaded are recorded in detail, including the tile identifier, the specific access frequency value, the memory occupancy percentage, and the data creation time, the latest access time, and other information. Subsequently, the screened candidate data to be unloaded is integrated according to certain rules to construct a list of tiles to be unloaded. The list is presented in table form, with each row corresponding to a tile data to be unloaded, and each column storing the attribute information of the tile.
[0078] Each tile data in the list is preliminarily classified according to the dual standards of access frequency from low to high and memory occupancy from high to low. For tiles with the same access frequency, those with higher memory occupancy are prioritized; and for tiles with the same memory occupancy, those with lower access frequency are prioritized. After the preliminary classification, all tiles are arranged in sequence according to this rule to generate a cache replacement sequence. In the screening link, combined with the actual situation such as the current remaining space capacity of the memory cache area and the system's demand for memory performance, the tiles are selected from the starting position of the sequence. If the current memory cache area is in a state of tight remaining space and needs to release a large amount of memory, the system will continuously select the tiles at the front end of the sequence until the memory release demand is met; if the memory pressure is small, only a small number of tiles at the front of the sequence will be selected. The finally selected tiles are the target unloaded tiles, which will be the objects of subsequent migration from the memory cache area to the disk cache area, so as to optimize the resource allocation of the memory cache area and improve the overall system efficiency.
[0079] After determining the target unloaded tiles, these tiles are migrated from the memory cache area to the disk cache area. First, the target unloaded tiles are located and read according to their storage positions in the memory cache area. During the reading process, the data compression identifier of the target unloaded tiles is checked. If the identifier indicates that compression is needed, the preset compression algorithm is used to compress the tile data to reduce the storage space occupation on the disk. Subsequently, the system will allocate appropriate disk storage locations for each target unloaded tile according to the storage strategy and current storage state of the disk cache area. The storage strategy will consider factors such as the partitioning of the disk, the layout of the file system, and the access frequency of the data, to ensure that the data is stored on the disk efficiently and easily managed. During the process of writing the target unloaded tiles into the disk cache area, the writing progress is monitored in real time to ensure the integrity and accuracy of the data. Once the target unloaded tiles are successfully migrated to the disk cache area, the disk storage path of each tile is immediately recorded. These path information will be stored in a special index table, which uses a hash table to quickly locate the tiles when they need to be accessed in the future. By recording the disk storage path, the system can accurately retrieve the target unloaded tiles from the disk cache area when needed, providing strong support for subsequent data management and use.
[0080] The tile data successfully unloaded to the disk cache area is determined according to the disk storage path, and the tiles are removed from the management data structure of the memory cache area. Then, for the remaining tile hierarchical distribution, a depth-first search algorithm is used to traverse the multi-level storage structure of the memory cache area, and the number of tiles at each level, the total memory occupation, and the unique identifier of each tile are recorded. Starting from the highest priority level, each storage node is accessed in turn, the relevant information is counted, and a clear hierarchical distribution table is constructed. When generating the compression identifier, the attributes of the remaining tiles are analyzed. By calculating the ratio of the memory occupation size and the access frequency of each tile, a threshold is set. When the ratio is greater than the threshold, the tile is marked as needing compression, and the corresponding compression identifier is recorded. For tiles with a ratio less than the threshold, they are marked as not needing compression. For the preloading strategy, a prediction algorithm based on time series analysis is used to collect the access timestamps and access frequencies of the remaining tiles in the past period of time, and a time series model is constructed. According to the current time and system load, the tiles that may be accessed in the future period of time are predicted. The tiles with high prediction probability are added to the preloading list, and the time point and level of preloading are determined to ensure that they can be quickly loaded when needed. Finally, the remaining tile hierarchical distribution table, the compression identifier, and the preloading list are integrated together to generate the second cache parameter, which is used for subsequent efficient management and optimization of the memory cache area.
[0081] In one possible implementation manner, step S500 further includes:
[0082] Step S510: detecting and analyzing the user's interactive operation on the drawing to determine a target view area.
[0083] Step S520: based on the target view area, extracting the associated tile data of the memory cache area from the first cache parameter for real-time loading to generate a loading result, the loading result being a hit loading result and / or a miss loading result.
[0084] Step S530: if the hit loading result and the miss loading result exist, or only the miss loading result exists, a disk loading request is generated.
[0085] Step S540: triggering the second cache parameter through the disk loading request to execute an asynchronous loading task, and updating the tile data of the memory cache area and the preloading strategy in the second cache parameter according to the execution result of the asynchronous loading task.
[0086] Specifically, in the drawing interactive operation processing flow, when the user performs zoom-in, zoom-out, panning and other interactive operations on the drawing, the operation instructions are monitored in real time, and by analyzing the operation parameters such as the distance of mouse dragging and the scale of zooming, the target view area currently focused by the user is accurately determined, which clearly defines the range of the drawing that the user currently wants to view.
[0087] According to the determined target view area, the tile data associated with the target view area in the memory cache area is extracted from the first cache parameter. The first cache parameter records the cache level and access frequency of the tile data and other key information, and according to these information, the associated tile data possibly located in the memory cache area is quickly located and extracted for real-time loading. During the loading process, if the required tile data is successfully obtained, a hit loading result is generated; if the corresponding data cannot be found in the memory cache area, a miss loading result is generated. These loading results reflect the response of the memory cache area to the user's demand.
[0088] The loading results are judged. Once the hit loading result and the miss loading result exist at the same time, or only the miss loading result exists, it means that the memory cache area cannot fully meet the data demand of the current view area of the user. At this time, a disk loading request is immediately generated, which contains the tile data information required by the target view area but not found in the memory cache area, and is used to obtain the missing data from the disk cache area.
[0089] When the disk loading request is received, the second cache parameter is triggered quickly. The second cache parameter contains important information such as disk storage path, remaining tile level distribution, compression identifier, and preloading strategy. Using these information, an asynchronous loading task is started to avoid blocking the main thread and ensure that the user can still interact smoothly while waiting for data loading. In the asynchronous loading task, the target tile data is searched from the disk cache area according to the disk storage path. If the data has a compression identifier, it will be decompressed first. During the loading process, the system will monitor the task progress in real time and evaluate the execution result after the loading is completed. If the asynchronous loading task successfully obtains the required tile data, the new data is updated to the memory cache area according to certain rules. This may involve adjusting the distribution of tiles at different levels to optimize the use of memory. At the same time, according to the access frequency of the newly loaded tiles, the memory occupation situation and the user's operation habits and other factors, the preloading strategy in the second cache parameter is re-evaluated and updated. For example, if a tile is frequently accessed after this loading, its priority in the preloading list will be increased, or the preloading time interval will be adjusted to respond more quickly to user needs in subsequent operations. If the asynchronous loading task fails to obtain the data, the corresponding error information is recorded, and the preloading strategy may be adjusted according to the failure situation, such as increasing the preloading frequency of related data to reduce the possibility of similar problems in the future. In this way, the management of the memory cache area and the preloading strategy are continuously optimized to improve the efficiency of data loading and user experience.
[0090] In one possible implementation, step S510 further includes:
[0091] Step S511: Capture the user's input scaling, translation or rotation instructions, and calculate the view transformation matrix.
[0092] Step S512: Determine the boundary coordinates and scaling level of the tile data according to the transformation matrix.
[0093] Step S513: Based on the boundary coordinates and the scaling level, generate the geometric coverage range parameters of the tile data, map the geometric coverage range parameters to the tile space index, and determine the target view area.
[0094] Specifically, a matrix operation algorithm is used to calculate the view transformation matrix. When the user's input scaling instruction is captured, assume that the scaling factors in the x-axis and y-axis directions are , , and the scaling matrix S is constructed as . If a translation instruction is received, assume that the translation amounts in the x-axis and y-axis directions are , Then the translation matrix T is generated as When the rotation instruction is detected, taking counterclockwise rotation as an example, let the rotation angle be The rotation matrix R is constructed as According to the user operation sequence, if scaling is performed first and then translation, the scaling matrix S is multiplied by the translation matrix T, i.e. M = T x S. If the operation sequence is scaling, rotation, and translation, M = T x R x S is calculated in sequence, and the final matrix M is the view transformation matrix. This matrix integrates the user's scaling, translation, and rotation operations through matrix multiplication, and can perform accurate geometric transformation on the tile data to meet the view display requirements after user interaction.
[0095] The transformation matrix calculated will be used to accurately determine the boundary coordinates and scaling level of the tile data. First, the boundary coordinates of the tile data in the original state are extracted, which clearly indicate the position range of the tile in the initial view. Then, the coordinates of each boundary point are expressed in homogeneous coordinate form and multiplied by the transformation matrix. After this operation, the coordinates of the boundary points will change accordingly according to the scaling, translation, and rotation operations described by the transformation matrix, thereby obtaining the boundary coordinates of the tile data in the new view. These new coordinates accurately reflect the actual position of the tile after the current user interaction. In terms of scaling level, the scaling factor is extracted from the transformation matrix. Since the transformation matrix contains information related to scaling operations, the scaling ratio in the horizontal and vertical directions can be accurately obtained by analyzing the matrix elements. A series of scaling levels are pre-set, each corresponding to a specific scaling ratio interval. According to the extracted scaling factor, it is compared with these pre-set intervals to determine the current scaling level of the tile data. This scaling level not only reflects the size change of the tile data, but also provides a key reference for subsequent tile data loading and display, ensuring that the system can display the tile data with the appropriate level of detail.
[0096] The boundary coordinates are used to accurately define the actual position and spatial span of the tile data on a two-dimensional plane. These boundary coordinates form the outer contour of the tile data, clearly defining its specific range under the current view. At the same time, the zoom level provides information on the scaling degree of the tile data, and the range determined by the boundary coordinates is adjusted accordingly based on this information to ensure that the geometric coverage range parameters accurately reflect the actual coverage area of the tile data under the current zoom state. Subsequently, the geometric coverage range parameters of the tile data are generated based on these accurately calculated boundaries and adjusted ranges. These parameters describe the geometric characteristics of the tile data in the current view in detail, such as shape, size, position, etc. Then, the generated geometric coverage range parameters are mapped to the pre-constructed tile space index, which is an efficient data structure that organizes and stores tile data according to certain rules, enabling quick positioning and retrieval of tile data in a specific area. Through this mapping operation, the tile data matching the current geometric coverage range parameters is quickly filtered out from the tile space index. These filtered tile data collectively form the target view area, which accurately covers all the tile information that the user is interested in under the current interactive operation, providing a clear range definition for subsequent data loading and display.
[0097] In the second embodiment, based on the same inventive concept as the CAD drawing loading method combined with cache optimization in the preceding embodiments, as shown in the accompanying drawings, the present application provides a CAD drawing loading system combined with cache optimization. The system and method embodiments in the present application are based on the same inventive concept. The system comprises: Figure 2
[0098] A drawing recognition module 10 is configured to read and recognize the target CAD drawing, and extract the entity-associated tile data according to the recognition result.
[0099] A data distribution module 20 is configured to dynamically distribute the tile data to a plurality of cache areas, wherein the plurality of cache areas include memory cache areas and disk cache areas.
[0100] A first cache parameter generation module 30 is configured to monitor the tile data in the memory cache areas in real time, generate a first monitoring data set, adjust the cache based on the first monitoring data set, and generate a first cache parameter.
[0101] A second cache parameter generation module 40 is configured to unload the first cache parameter to the disk cache areas based on the first monitoring data set, and generate a second cache parameter.
[0102] The drawing loading module 50 is used for loading the drawing in the memory cache area according to the first cache parameter based on the user's interactive operation on the drawing, and triggering the second cache parameter to load the drawing in the disk cache area asynchronously according to the loading result.
[0103] Further, the system is also used for the following functions:
[0104] reading a target CAD drawing, identifying based on the target CAD drawing, obtaining an identification result, the identification result containing a model space and a database block table; traversing the block reference entity of the model space to perform correlation analysis, extracting first block data according to a first correlation relationship, marking the first block data, and determining a high-frequency access candidate label; recursively traversing the sub-block reference entity in the database block table, extracting second block data according to a second correlation relationship, marking the second block data, and determining a low-frequency access candidate label; adding the high-frequency access candidate label and the low-frequency access candidate label to the block data.
[0105] Further, the system is also used for the following functions:
[0106] matching the high-frequency access candidate label with the block data to extract first block data; distributing the first block data to a first level of the memory cache area; matching the low-frequency access candidate data with the block data to extract second block data; and distributing the second block data to a second level of the memory cache area or the disk cache area.
[0107] Further, the system is also used for the following functions:
[0108] real-time monitoring of the access state of the block data in the memory cache area, the access state containing the access frequency, access timestamp, and single access memory consumption of the block data in the memory cache area; aggregating the access frequency, access timestamp, and single access memory consumption according to the block identifier to generate block access timing characteristics, and adding the block access timing characteristics to the first monitoring data set; and performing cache analysis based on the first monitoring data set and the block data to generate the first cache parameter.
[0109] Further, the system is also used for the following functions:
[0110] extracting an access frequency of the tile data based on the first monitoring data set, performing time decay weighting calculation on the access frequency, obtaining the access frequency of the tile data; performing storage occupancy calculation based on the first monitoring data set, obtaining the memory occupancy rate of the tile data; determining based on the tile data combined with the access frequency, when the access frequency of the tile data is high-frequency access and the cache level of the tile data is low priority, the tile data is promoted to the high-priority level of the memory cache area, generating reserved candidate data; determining based on the tile data combined with the access frequency, the memory occupancy rate, when the access frequency of the tile data is low-frequency access and the memory occupancy rate of the tile data exceeds a preset threshold, the cache level weight of the tile data is reduced, generating a candidate data to be unloaded; constructing the first cache parameter based on the reserved candidate data and the candidate data to be unloaded.
[0111] Further, the system is also used for the following functions:
[0112] According to the first cache parameter, a cache migration instruction set is generated, and the cache migration instruction set is executed by a memory manager to migrate the tile data to different cache levels according to priority, generating a plurality of migration parameters; the tile data in the memory cache area is searched and reserved according to the plurality of migration parameters, the metadata index is determined, and the fast backtracking loading path is obtained; the tile data unloaded to the disk cache area is maintained according to the plurality of migration parameters, a hash mapping table is constructed to record the correspondence between the tile identifier and the disk cache location, and the fast search path is obtained.
[0113] Further, the system is also used for the following functions:
[0114] According to the access frequency and the memory occupancy rate of the tile data in the first monitoring data, the candidate data to be unloaded is integrated to construct a list of tiles to be unloaded; the list of tiles to be unloaded is sorted by cache replacement, and the target unloaded tile is determined based on the cache replacement sequence; the target unloaded tile is migrated from the memory cache area to the disk cache area, and the disk storage path of the target unloaded tile is recorded; the state information of the memory cache area after unloading is extracted according to the disk storage path, and the second cache parameter is generated.
[0115] Further, the system is also used for the following functions:
[0116] The interaction operation of the user on the drawing is detected to analyze and determine a target view area; based on the target view area, associated tile data of the memory cache area is extracted from the first cache parameter to perform real-time loading, and a loading result is generated, the loading result being a hit loading result and / or a miss loading result; if the hit loading result and the miss loading result exist, or only the miss loading result exists, a disk loading request is generated; the second cache parameter is triggered through the disk loading request to perform an asynchronous loading task, and according to an execution result of the asynchronous loading task, tile data of the memory cache area and a preloading strategy in the second cache parameter are updated.
[0117] Further, the system is also used for the following functions:
[0118] The zoom, translation or rotation instruction input by the user is captured to calculate a view transformation matrix; the boundary coordinates and zoom level of the tile data are determined according to the transformation matrix; based on the boundary coordinates and the zoom level, a geometric coverage range parameter of the tile data is generated, the geometric coverage range parameter is mapped to a tile space index, and the target view area is determined.
[0119] It should be noted that the above-mentioned sequence of the embodiments of the present application is only for description, and does not represent the advantages and disadvantages of the embodiments. And the above describes a specific embodiment of the present application. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multi-task processing and parallel processing are also possible or can be advantageous.
[0120] The above only describes the preferred embodiments of the present application, and does not limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0121] The present application and the drawings are only exemplary descriptions of the present application, and are considered to cover any and all modifications, changes, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art can make various modifications and changes to the present application without departing from the scope of the present application. Thus, if these modifications and changes of the present application belong to the scope of the present application and its equivalents, the present application intends to include these modifications and changes.
Claims
1. A CAD drawing loading method combined with cache optimization, characterized in that, The method comprises: reading a target CAD drawing for identification, and extracting block data associated with entities according to the identification result; dynamically distributing the block data to a plurality of cache areas, wherein the plurality of cache areas include a memory cache area and a disk cache area; monitoring the block data in the memory cache area in real time to generate a first monitoring data set, adjusting the cache according to the first monitoring data set to generate a first cache parameter; performing data offloading on the first cache parameter to the disk cache area according to the first monitoring data set to generate a second cache parameter; loading the drawing in the memory cache area according to the first cache parameter based on the user's interactive operation on the drawing, and triggering the second cache parameter to perform asynchronous loading on the disk cache area according to the loading result; reading a target CAD drawing for identification, and extracting block data associated with entities according to the identification result, the method comprising: reading a target CAD drawing, identifying the target CAD drawing to obtain an identification result, and the identification result including a model space and a database block table; performing correlation analysis on block reference entities in the model space, extracting first block data according to a first correlation relationship, marking the first block data, and determining high-frequency access candidate labels; recursively traversing sub-block reference entities in the database block table, extracting second block data according to a second correlation relationship, marking the second block data, and determining low-frequency access candidate labels; adding the high-frequency access candidate labels and the low-frequency access candidate labels to the block data; the process of dynamically distributing the block data to a plurality of cache areas, comprising: matching the high-frequency access candidate labels with the block data to extract first block data; distributing the first block data to a first level of the memory cache area; matching the low-frequency access candidate labels with the block data to extract second block data; distributing the second block data to a second level of the memory cache area or the disk cache area; monitoring the block data in the memory cache area in real time to generate a first monitoring data set, adjusting the cache according to the first monitoring data set to generate a first cache parameter, the method comprising: monitoring the access state of the block data in the memory cache area in real time, wherein the access state includes the access frequency, access timestamp, and single access memory consumption of the block data in the memory cache area; aggregating the access frequency, access timestamp, and single access memory consumption according to block identifiers to generate block access timing characteristics, and adding the block access timing characteristics to the first monitoring data set; performing cache analysis on the first monitoring data set and the block data to generate the first cache parameter.
2. The CAD drawing loading method with cache optimization of claim 1, wherein, performing cache analysis on the first monitoring data set and the block data to generate the first cache parameter, comprising: extracting the access frequency of the block data based on the first monitoring data set, and performing time decay weighting calculation on the access frequency to obtain the access frequency of the block data. Based on the first monitoring data set, a memory occupation calculation is performed to obtain a memory occupation rate of the tile data; Based on the tile data and the access frequency, it is determined that when the access frequency of the tile data is high-frequency access and the cache level of the tile data is low priority, the tile data is promoted to a high-priority level of the memory cache area to generate reserved candidate data; Based on the tile data, the access frequency, and the memory occupation rate, it is determined that when the access frequency of the tile data is low-frequency access and the memory occupation rate of the tile data exceeds a preset threshold, the cache level weight of the tile data is reduced to generate to-be-unloaded candidate data; Based on the reserved candidate data and the to-be-unloaded candidate data, the first cache parameter is constructed.
3. The CAD drawing loading method with cache optimization of claim 1, wherein, After generating the first cache parameter, the method comprises: According to the first cache parameter, a cache migration instruction set is generated, and the cache migration instruction set is executed by a memory manager to migrate the tile data to different cache levels according to priority, thereby generating a plurality of migration parameters; According to the plurality of migration parameters, the tile data in the memory cache area is searched and reserved to determine a metadata index and obtain a fast backtracking loading path; According to the plurality of migration parameters, the tile data unloaded to the disk cache area is maintained to construct a hash mapping table recording the correspondence between the tile identifier and the disk cache location, thereby obtaining a fast search path.
4. The CAD drawing loading method with cache optimization of claim 2, wherein, According to the first monitoring data set, the first cache parameter is data-unloaded to the disk cache area to generate a second cache parameter, and the method comprises: According to the access frequency and the memory occupation rate of the tile data in the first monitoring data, the to-be-unloaded candidate data is integrated to construct a to-be-unloaded tile list; The to-be-unloaded tile list is sorted according to cache replacement, and the target unloaded tile is determined based on the cache replacement sequence; The target unloaded tile is migrated from the memory cache area to the disk cache area, and the disk storage path of the target unloaded tile is recorded; According to the disk storage path, the state information of the memory cache area after unloading is extracted to generate the second cache parameter.
5. The CAD drawing loading method with cache optimization of claim 1, wherein, According to the user's interactive operation on the drawing, the drawing in the memory cache area is loaded in combination with the first cache parameter, and the asynchronous loading of the disk cache area is triggered according to the loading result based on the second cache parameter, and the method comprises: Detecting and analyzing the user's interactive operation on the drawing to determine a target view area; Based on the target view area, the associated tile data of the memory cache area is extracted from the first cache parameter for real-time loading to generate a loading result, wherein the loading result is a hit loading result and / or a miss loading result; If there is the hit loading result and the miss loading result, or only the miss loading result, a disk loading request is generated; The second cache parameter is triggered by the disk loading request to execute an asynchronous loading task, and the tile data of the memory cache area and the preloading strategy in the second cache parameter are updated according to the execution result of the asynchronous loading task.
6. The CAD drawing loading method with cache optimization of claim 5, wherein, The method comprises the following steps: Detecting the user's interactive operation on the drawing to analyze and determine a target view area, the method comprising: Capturing the user's input zoom, pan or rotation instructions, and calculating a view transformation matrix; Determining the boundary coordinates and zoom level of the tile data according to the transformation matrix; 7. A CAD drawing loading system with combined cache optimization, characterized by Based on the boundary coordinates and zoom level, generating the geometric coverage range parameters of the tile data, mapping the geometric coverage range parameters to the tile space index, and determining the target view area. The system is used to implement the CAD drawing loading method with cache optimization according to any one of claims 1-6, and the system comprises: A drawing identification module for reading and identifying the target CAD drawing, and extracting the tile data associated with the entity according to the identification result; A data allocation module for dynamically allocating the tile data to a plurality of cache areas, wherein the plurality of cache areas include memory cache areas and disk cache areas; A first cache parameter generation module for real-time monitoring of the tile data in the memory cache areas, generating a first monitoring data set, adjusting the cache according to the first monitoring data set, and generating a first cache parameter; A second cache parameter generation module for data unloading of the first cache parameter to the disk cache areas according to the first monitoring data set, and generating a second cache parameter; A drawing loading module for loading the drawing in the memory cache areas according to the user's interactive operation on the drawing in combination with the first cache parameter, and triggering the asynchronous loading of the disk cache areas according to the loading result.
Citation Information
Patent Citations
CAD drawing memory optimization method and system
CN119807204A
Cache management optimization method and system
CN119961189A
Dynamic management method and system for multi-layer data cache
CN119987685A