Image cache processing method, device, electronic device and storage medium
By adopting a preset image data cache structure in the target cache space, the problem of large-scale asynchronous concurrent processing of image data blocks in security storage technology is solved, and the utilization rate and management efficiency of cache space are improved.
Patent Information
- Application Number
- CN202011130180.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-21
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2040-10-21
AI Technical Summary
In the field of security storage technology, it is difficult for the prior art to realize large-scale asynchronous concurrent processing of image data blocks, resulting in low universality of cache applications, difficult to guarantee structural consistency, and limited cache space utilization.
By using a preset image data cache structure in the target cache space, the physical space is initialized according to the fixed cache length basic unit, including the overall part of the cache structure, the cache node description part, and the cache node storage part, thereby realizing image cache service requests task processing.
It improves the universality of image caching strategies and the utilization of cache space, ensures the uniform length of different types of data, improves the management efficiency of cached data, and avoids resource waste due to different lengths of different types of information formats.
Smart Images

Figure CN114463162B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of data processing technology, and in particular to an image cache processing method, device, electronic device and storage medium. Background Art
[0002] In the field of security storage technology, many application scenarios require large-scale asynchronous concurrent processing of large data blocks to improve read and write performance. However, due to inconsistencies in data structure and business type, different cache strategies and structures need to be adopted, resulting in low versatility of cache applications, and even making it difficult to ensure structural consistency and limited cache space utilization. Therefore, it is very important to ensure effective caching of images. Summary of the invention
[0003] The embodiments of the present invention provide an image cache processing method, device, electronic device and storage medium to achieve the universality of image cache strategy and improve cache space utilization.
[0004] In a first aspect, an embodiment of the present invention provides an image cache processing method, comprising:
[0005] receiving at least one image cache service request sent by a front-end device, and sending the at least one image cache service request to an image cache processing thread;
[0006] Performing task processing on the at least one image cache service request in the target cache space through the image cache processing thread;
[0007] The target cache space uses a preset image data cache structure to initialize and determine the preset physical space according to a preset cache length basic unit, and the preset image data cache structure includes a cache structure overall part, a cache node description part and a cache node storage part.
[0008] In a second aspect, an embodiment of the present invention further provides an image cache processing device, comprising:
[0009] A service request receiving module, configured to receive at least one image cache service request sent by a front-end device, and send the at least one image cache service request to an image cache processing thread;
[0010] A service request processing module, configured to perform task processing on the at least one image cache service request in a target cache space through an image cache processing thread;
[0011] The target cache space uses a preset image data cache structure to initialize and determine the preset physical space according to a preset cache length basic unit, and the preset image data cache structure includes a cache structure overall part, a cache node description part and a cache node storage part.
[0012] In a third aspect, an embodiment of the present invention further provides an electronic device, including:
[0013] one or more processing devices;
[0014] A storage device for storing one or more programs;
[0015] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement any image cache processing method described in any one of the embodiments of the present invention.
[0016] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processing device, any image cache processing method described in the embodiments of the present invention is implemented.
[0017] In an embodiment of the present application, an image cache processing method is provided, in which a target cache space uses a preset image data cache structure to initialize and determine a preset physical space according to a preset cache length basic unit, and the preset image data cache structure includes a cache structure overall part, a cache node description part, and a cache node storage part; after receiving at least one image cache service request issued by a front-end device, at least one image cache service request is sent to an image cache processing thread, and through the image cache processing thread, task processing is performed on at least one image cache service request under the target cache space.
[0018] By adopting the technical solution of the present application, before caching, the basic unit of cache length used by the target cache space can be customized according to business needs to ensure that the cache data length has good versatility and scalability. The cache space includes different types of data parts, and the lengths of various types of data are unified into a fixed basic unit of cache length, so that when caching, they can be uniformly addressed and managed through the ID of the fixed basic unit of cache length. At the same time, the efficiency of cache space utilization can be greatly improved, and the situation where some types of information are used up and there is still a lot of remaining information due to the different format lengths of different types of information is avoided as much as possible.
[0019] The above invention content is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Other features, objects and advantages of the present invention will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings. The drawings are only for the purpose of illustrating preferred embodiments and are not to be considered as limiting the present invention. Also, the same reference symbols are used throughout the drawings to represent the same parts. In the drawings:
[0021] Figure 1 is a flow chart of an image cache processing method provided in an embodiment of the present invention;
[0022] Figure 2 is a schematic diagram of the overall structure of an image data cache structure provided in an embodiment of the present invention;
[0023] Figure 3 is a schematic diagram of a node structure of a cache node provided in an embodiment of the present invention;
[0024] Figure 4 is a structural block diagram of an image cache processing device provided in an embodiment of the present invention;
[0025] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only the parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0027] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the operations (or steps) as sequential processes, many of the operations (or steps) therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0028] Figure 1: is a flowchart of an image cache processing method provided in an embodiment of the present invention. The technical solution of the embodiment of the present application can be applied to the case of caching image data sent by a front-end device in a monitoring scenario. The method can be executed by an image cache processing device, which can be implemented in software and / or hardware and integrated in any electronic device with network communication function. Figure 1 As shown, the image cache processing method in the embodiment of the present application may include the following steps:
[0029] S110: Receive at least one image cache service request sent by a front-end device, and send the at least one image cache service request to an image cache processing thread.
[0030] S120: Perform task processing on the at least one image cache service request in the target cache space through the image cache processing thread.
[0031] The target cache space uses a preset image data cache structure to initialize and determine the preset physical space according to a preset cache length basic unit, and the preset image data cache structure includes a cache structure overall part, a cache node description part and a cache node storage part.
[0032] In this embodiment, the front-end device can collect and acquire image data, cache the collected image data, and then flush the cached image data to the disk for storage, so as to avoid the front-end device directly storing data to the disk, resulting in frequent reading and writing of the disk, affecting the read and write performance of the disk. In this way, it is necessary to design and adopt an efficient image cache space for image caching.
[0033] In this embodiment, Figure 2 is a schematic diagram of the overall structure of an image data cache structure provided in an embodiment of the present invention. Figure 2 , the image data cache is divided into three parts from the structure, which may include the cache structure overall part head, the cache node description part inode and the cache node storage part cache_group. Among them, the cache structure overall part head mainly stores the overall information of the entire image data cache structure; the cache node description part inode represents the usage of each cache node in the cache node storage part; the cache node storage part cache_group stores the specific information of each cache node.
[0034] In this embodiment, see Figure 2, the target cache space uses a preset image data cache structure to initialize and determine the preset physical space according to a preset cache length basic unit. Among them, the physical space may include physical memory and other caches. In the target cache space, the lengths of various types of data carried in the cache structure overall part head, the cache node description part inode, and the cache node storage part cache_group in the image data cache are unified into a fixed-length cache length basic unit slice. In this way, it can be uniformly addressed and managed through the id of the cache length basic unit slice, which improves the convenience of addressing and management; at the same time, it can avoid as much as possible the situation where some types of information are used up due to the different format lengths of different types of information, and the rest of the information is still largely left, thereby improving the efficiency of cache space use.
[0035] In this embodiment, when caching the image data of the front-end device, a set of standard interfaces for image cache service requests may be provided for the front-end device, for example, the standard interfaces for image cache service requests include a cache node creation request interface open, a cache data write request interface write, a cache node close request interface close, and a cache data read request interface read. Since a large number of front-end devices may send different image cache service requests at the same time, the standard interfaces for image cache service requests are set to an asynchronous non-blocking mode.
[0036] In this embodiment, after receiving the image cache service request sent by the front-end device, each image cache service request can be sent to the image cache processing thread. Then, the image cache processing thread can process at least one image cache service request in the corresponding cache node under the target cache space.
[0037] In another optional solution of this embodiment, this embodiment can be combined with each optional solution in one or more of the above embodiments. Sending at least one image cache service request to the image cache processing thread may include the following steps A1-A2:
[0038] Step A1: sort the image cache service requests sent by the front-end device through service request arbitration.
[0039] Step A2: sending each image cache service request to the image cache processing thread in sequence according to the task sorting result; wherein the image cache service request includes at least one of the following: a cache node creation request, a cache data write request, a cache node close request, and a cache data read request.
[0040] In this embodiment, the main function of the service request arbitration adjuster is to sort the received image cache service requests so as to realize the dynamic balance between the release and opening of cache nodes according to the free capacity of the cache structure. Image cache service requests include cache node creation requests open_in, cache data write requests write_in, cache data read requests read_in, cache node closing requests close_in issued from the front-end device, and free task requests generated by the internal cache node after processing and recycling.
[0041] In the present embodiment, it should be pointed out that these internal business request tasks are non-blocking, and these tasks only interact with the memory. For the cache node creation request open_in, when the cache space does not have enough space to create a cache node, it will be sorted by adjuster again and will not be discarded. For other business request tasks, when the business request task processing fails, it will be directly discarded and a response error will be returned or the corresponding alarm information will be printed. After sorting by adjuster, each image cache business request can be sent to the image cache processing thread in turn, which will handle these non-blocking business request tasks.
[0042] In another optional solution of this embodiment, this embodiment can be combined with each optional solution in one or more of the above embodiments. In which, by using the image cache processing thread, performing task processing on at least one image cache service request in the target cache space may include the following steps B1-B2:
[0043] Step B1: If the image cache service request is a cache node creation request, the cache node creation interface is called through the image cache processing thread to create a cache node with description information and tag information added under the cache node storage part of the target cache space.
[0044] Step B2: After a cache node is created, the cache node is mounted to the head of the waiting-to-fill linked list under the overall part of the cache structure of the target cache space, so that the cache node state is changed to waiting to be filled.
[0045] In this embodiment, the cache node creation request carries description information and label information of the image data to be cached. When the cache node creation interface create interface is called, and the parameter information and data block size are tracked, a cache node is created under the cache node storage part of the target cache space, and description information and label information are synchronously added to the created cache node.
[0046] In this embodiment, the cache structure overall part head includes management information and structure information of cache node cache. The management information mainly includes 5 linked list headers, which represent the different stages of the cache node, which can be waiting for filling linked list header, waiting for operation linked list header, waiting for callback linked list header, waiting for overload linked list header, and waiting for release linked list header. The structure information includes the cache node description part inode check value, structure header information, check magic signature, version, the starting position of the cache structure overall part head in physical space (such as physical memory), the total cache size, the basic unit of cache length slice size, the number of cache nodes and reserved space.
[0047] In this embodiment, after the cache node is created, the cache node information is added to the waiting_Fill_Head list in the head of the cache structure, and the cache node status is updated to be filled, waiting for the writing of image data. Here, the cache node creation request open_in does not have the function of finding the cache node location, avoiding unnecessary time-consuming operations in this thread. The callback function goback function in the cache node will call back to inform that the cache task has been sent to the destination, and there is no need to perform a read operation in the cache structure, which can avoid time-consuming traversal actions.
[0048] In this embodiment, see Figure 2 Optionally, the cache node description part inode describes the usage of the cache node storage part cache group. Every two map bits represent the usage of a cache node storage part cache group. 00 indicates free, 01 indicates in use, and 11 indicates not full. The effective length of the cache node description part inode is determined by the total cache capacity of the cache node storage part.
[0049] In another optional solution of this embodiment, this embodiment can be combined with each optional solution in one or more of the above embodiments. In which, by using the image cache processing thread, task processing is performed on the at least one image cache service request in the target cache space, and the following steps may also be included:
[0050] After creating a cache node, if the image cache service request includes a cache node write request, the cache node write interface is called by the image cache processing thread to write the image data transmitted by the front-end device to the corresponding cache node under the cache node storage part of the target cache space.
[0051] In this embodiment, see Figure 2 In the process of filling data, the cache node write interface write interface is called to write the image data transmitted by the front-end device to the corresponding cache node under the cache node storage part of the target cache space.
[0052] In another optional solution of this embodiment, this embodiment can be combined with each optional solution in one or more of the above embodiments. In which, by using the image cache processing thread, at least one image cache service request is processed in the target cache space, and the following steps C1-C2 can also be included:
[0053] Step C1: after writing image data to a cache node, if the image cache service request includes a cache node closing request, the cache node closing interface is called by the image cache processing thread to close the cache node under the cache node storage part of the target cache space.
[0054] Step C2: mount the created cache node to the head of the waiting operation linked list under the overall part of the cache structure of the target cache space, so that the state of the cache node is changed to pending execution.
[0055] In this embodiment, after the front-end device completes data transmission to the cache node under the cache node storage part of the target cache space, it can continue to send a corresponding cache node closing request to determine whether the cache node has completed writing the data through the cache node closing request. Then, under the image cache processing thread, the cache node under the cache node storage part of the target cache space is closed by calling the cache node closing interface.
[0056] In this embodiment, see Figure 2 , when judging that the cache node is ready and needs to execute the corresponding custom operation opt task, the prepared cache node can be mounted to the waiting operation list head Waiting_Opt_Head node under the overall part of the cache structure of the target cache space, and the cache node status is updated to be filled. For example, in the application of monitoring card port, the written data needs to be further processed, such as extracting key information from the image data and uploading it to the database. Therefore, the custom Opt function is used to process multiple cache tasks to be executed in the cache in multiple threads, and the processing results are notified to the corresponding cache node by the callback function. Therefore, the cache task has been processed normally, and the task status is updated to be released.
[0057] In another optional solution of this embodiment, this embodiment can be combined with each optional solution in one or more of the above embodiments. After mounting the created cache node to the head of the waiting operation linked list under the overall part of the cache structure of the target cache space, the following steps D1-D3 can also be included:
[0058] Step D1, taking out the cache node from the waiting operation linked list head under the cache structure overall part of the target cache space, and executing the custom operation function of the description information record under the cache node storage part of the target cache space.
[0059] Step D2: Take the cache node from the waiting callback linked list head under the cache structure overall part of the target cache space, and execute the custom callback function of the description information record under the cache node storage part of the target cache space.
[0060] Step D3: During the loading process, the cache nodes that have not been executed are mounted to the waiting reload linked list head under the overall cache structure part of the target cache space, and the custom reload function described in the information record under the cache node storage part of the target cache space is executed.
[0061] In this embodiment, see Figure 2 , the cache node storage part cache_group is mainly divided into two parts, the header information head of the cache node storage part and the item array of the cache node storage part. The header information head of the cache node storage part describes the length and usage of the cache node storage part cache_group, including the head check, the total number of items (the reason for the unfixed value is that the last cache_group supports a length smaller than the standard), the number of uses, inodes and reservations. Among them, the cache node description part inode identifies the type and use of an item every 2 bits, 00 indicates that it is not enabled, 01 indicates that the cache node item type is the label information (tag) of the cache node, 10 indicates that the item type is the description information (desc) of the cache node, and 11 indicates that the item type is the data information of the cache node.
[0062] In this embodiment, Figure 3 is a schematic diagram of a node structure of a cache node provided in an embodiment of the present invention. Figure 3 ,A cache node includes three types of information, namely tag information (tag), description information (desc), and data information (data). Among them, tag information and description information are required, and data information depends on the needs of users.
[0063] In this embodiment, see Figure 3, the tag information (tag) records the overall information of the cache node, including hang_info (status mount information), tag information verification, tag_flag (identifies the item as tag information), status (identifies the status of the cache node, which will be introduced later), the verification value of the description information, the id of the item where the description information starts, the data information verification value, the id list of the item where the data information is located, the execution result of the task, the id of the sub-cache header information, and the reserved space. Considering the data information of the valid task, the memid-list in the cache header information is not enough to store all the data information, so the total number of id storage of the data information item is increased with the information of the linked list.
[0064] In this embodiment, see Figure 3 , the description information (desc) describes the execution function of the task at each stage and its required parameters, which can be specifically divided into two parts: execution function information and execution parameter information. The execution function information includes an identifier (desc_flag indicates that the item belongs to the description information), a pointer to the next description information, the names of three execution functions, the full path of the dynamic library where the execution function is located, and reservations. The three execution functions are opt (the function for task execution), goback (the function for callback after task execution is completed), and reload (the reload processing function after the cache is reloaded after the device is restarted). The execution parameter information includes identification information, a pointer to the next identification information, and parameter information. In this way, the method of writing the dynamic library path and function name into the cache structure makes the cache task configuration highly flexible, and the specific functions of the callback function are completely customized by the business layer as long as the fixed interface type is met.
[0065] In this embodiment, optionally, the cache node can be taken out from the waiting operation list header Waiting_Opt_Head under the overall part of the cache structure of the target cache space, and an idle thread is selected to execute the task according to the custom created operation function. According to the execution result, the execution result field in the tag information of the cache node under the cache node storage part of the target cache space is updated, and the cache node is mounted to the waiting callback list header Waiting_goback_Head under the overall part of the cache structure of the target cache space. For example, the task separator Dispatcher 1 takes the cache node out of Waiting_Opt_Head and selects a thread to execute the task. The executed task is the opt function customized when it is created, and this process is blocked. According to the execution result, the returned error code is updated, such as the result field in the tag information in the cache node; then the waiting callback list header Waiting_goback_Head is added, and the cache node status is updated to be called back.
[0066] In this embodiment, optionally, when calling back, the cache node can be taken out from the Waiting_goback_Head list of the waiting callback list head, and the callback function is executed. Among them, the callback function is a custom goback function created when it is created. The function can make different processing according to the result mentioned above, or it can do nothing. After processing, the cache node status is updated to be released, and the waiting release list head Waiting_free_Head is added. Lib_ACC_MNG mainly dynamically stores the callback interface of the custom cache node to avoid the overhead of repeatedly loading dynamic libraries.
[0067] In this embodiment, the reload process is mainly to add the cache node information that has not been executed to the waiting reload list head Waiting_Reload_Head during the loading process after the cache information is loaded from other non-volatile media into the memory, and then process it according to the custom reload method. Optionally, the released tasks and other created cache nodes can be sorted according to the adjuster to ensure that the released space and the created space are balanced, and the cache nodes are recycled through non-blocking threads.
[0068] In this embodiment, the loading process supports verification and reconstruction when the data is inconsistent to ensure the consistency of the cache structure. Specifically, it includes: verifying the header, if there is a problem, reformatting the header information through the cache size and slice size; initializing the mng_info in the head, this part of the information must be rebuilt; verifying the inode information, if it is invalid, it is necessary to find each cache node according to the identifier of the cache node, verify it, and finally rebuild the inode area; verifying each cache node, deleting invalid ones, and mounting valid ones on different linked lists in the head according to the status; starting each service thread; initialization is successful.
[0069] In this embodiment, the cache task to be released enters the request sorting of adjuster and other front-end devices through the free interface, releases the cache space, and flushes the data into the next level storage space such as disk. If the front end sends a read request for the image data, the image data in the cache node can be directly read by calling the cache node read interface read interface before the image data is flushed into the disk.
[0070] In the image cache processing scheme of the embodiment of the present application, before caching, the basic unit of cache length used by the target cache space can be customized according to business needs to ensure that the cache data length has good versatility and scalability. The cache space includes different types of data parts, and the lengths of various types of data are unified into a fixed basic unit of cache length, so that when caching, they can be uniformly addressed and managed through the ID of the fixed basic unit of cache length. At the same time, the efficiency of the use of the cache space can be greatly improved, and the situation where some types of information are used up and there is a lot of remaining information can be avoided as much as possible due to the different format lengths of different types of information.
[0071] Figure 4 : is a structural block diagram of an image cache processing device provided in an embodiment of the present invention. The technical solution of the embodiment of the present application can be applied to the situation where image data sent by the front-end device in the monitoring scene is cached. The device can be implemented in software and / or hardware and integrated in any electronic device with network communication function. Figure 4 As shown, the image cache processing device in the embodiment of the present application may include the following: a service request receiving module 410 and a service request processing module 420. Among them:
[0072] The service request receiving module 410 is used to receive at least one image cache service request sent by the front-end device, and send the at least one image cache service request to the image cache processing thread;
[0073] The service request processing module 420 is used to perform task processing on the at least one image cache service request in the target cache space through the image cache processing thread;
[0074] The target cache space uses a preset image data cache structure to initialize and determine the preset physical space according to a preset cache length basic unit, and the preset image data cache structure includes a cache structure overall part, a cache node description part and a cache node storage part.
[0075] Based on the above embodiment, optionally, the cache structure overall part stores the overall information of the entire image data cache structure; the cache node description part stores the usage of each cache node; the cache node storage part stores the specific information of each cache node, and the specific information of the cache node includes label information, description information and data information.
[0076] Based on the above embodiment, optionally, the service request receiving module 410 includes:
[0077] Through service request adjudication, task sorting is performed on each image cache service request issued by the front-end device;
[0078] Send each image cache service request to the image cache processing thread in sequence according to the task sorting result;
[0079] The image cache service request includes at least one of the following: a cache node creation request, a cache data write request, a cache node close request, and a cache data read request.
[0080] Based on the above embodiment, optionally, the service request processing module 420 includes:
[0081] If the image cache service request is a cache node creation request, a cache node creation interface is called through the image cache processing thread to create a cache node with description information and tag information added under the cache node storage part of the target cache space;
[0082] After a cache node is created, the cache node is mounted to the head of the waiting-to-fill linked list under the overall part of the cache structure of the target cache space, so that the cache node state is changed to waiting to be filled.
[0083] Based on the above embodiment, optionally, the service request processing module 420 includes:
[0084] After creating a cache node, if the image cache service request includes a cache node write request, the cache node write interface is called by the image cache processing thread to write the image data transmitted by the front-end device to the corresponding cache node under the cache node storage part of the target cache space.
[0085] Based on the above embodiment, optionally, the service request processing module 420 includes:
[0086] After writing image data to a cache node, if the image cache service request includes a cache node closing request, calling a cache node closing interface through the image cache processing thread to close the cache node under the cache node storage part of the target cache space;
[0087] The created cache node is mounted to the head of the waiting operation linked list under the overall part of the cache structure of the target cache space, so that the state of the cache node is changed to pending execution.
[0088] Based on the above embodiment, optionally, after mounting the created cache node to the head of the waiting operation linked list under the overall part of the cache structure of the target cache space, the method further includes:
[0089] Take the cache node from the waiting operation linked list head under the cache structure overall part of the target cache space, and execute the custom operation function of the description information record under the cache node storage part of the target cache space;
[0090] Take the cache node from the waiting callback linked list head under the cache structure overall part of the target cache space, and execute the custom callback function of the description information record under the cache node storage part of the target cache space;
[0091] During the loading process, the cache nodes that have not been executed are mounted to the waiting reload linked list head under the overall part of the cache structure of the target cache space, and the custom reload function of the description information record under the cache node storage part of the target cache space is executed.
[0092] The image cache processing device provided in the embodiments of the present application can execute the image cache processing method provided in any of the embodiments of the present application, and has the corresponding functions and beneficial effects of executing the image cache processing method. For technical details not described in detail in the above embodiments, please refer to the image cache processing method provided in any of the embodiments of the present application.
[0093] Figure 5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 5 The electronic device provided in the embodiment of the present invention includes: one or more processors 510 and a storage device 520; the processor 510 in the electronic device may be one or more, Figure 5 A processor 510 is taken as an example; the storage device 520 is used to store one or more programs; the one or more programs are executed by the one or more processors 510, so that the one or more processors 510 implement the image cache processing method as described in any one of the embodiments of the present invention.
[0094] The electronic device may further include: an input device 530 and an output device 540 .
[0095] The processor 510, storage device 520, input device 530 and output device 540 in the electronic device can be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0096] The storage device 520 in the electronic device is a computer-readable storage medium that can be used to store one or more programs, which can be software programs, computer executable programs and modules, such as program instructions / modules corresponding to the image cache processing method provided in the embodiment of the present invention. The processor 510 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the storage device 520, that is, the image cache processing method in the above method embodiment is implemented.
[0097] The storage device 520 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the storage device 520 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the storage device 520 may further include a memory remotely arranged relative to the processor 510, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0098] The input device 530 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device. The output device 540 may include a display device such as a display screen.
[0099] Furthermore, when one or more programs included in the electronic device are executed by the one or more processors 510, the program performs the following operations:
[0100] receiving at least one image cache service request sent by a front-end device, and sending the at least one image cache service request to an image cache processing thread;
[0101] Performing task processing on the at least one image cache service request in the target cache space through the image cache processing thread;
[0102] The target cache space uses a preset image data cache structure to initialize and determine the preset physical space according to a preset cache length basic unit, and the preset image data cache structure includes a cache structure overall part, a cache node description part and a cache node storage part.
[0103] Of course, those skilled in the art can understand that when one or more programs included in the above electronic device are executed by the one or more processors 510, the program can also perform related operations in the image cache processing method provided in any embodiment of the present invention.
[0104] In an embodiment of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the program is used to execute a memory card processing method. The method includes:
[0105] receiving at least one image cache service request sent by a front-end device, and sending the at least one image cache service request to an image cache processing thread;
[0106] Performing task processing on the at least one image cache service request in the target cache space through the image cache processing thread;
[0107] The target cache space uses a preset image data cache structure to initialize and determine the preset physical space according to a preset cache length basic unit, and the preset image data cache structure includes a cache structure overall part, a cache node description part and a cache node storage part.
[0108] Optionally, when the program is executed by a processor, it can also be used to execute the image cache processing method provided in any embodiment of the present invention.
[0109] The computer storage medium of the embodiment of the present invention may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination of the above. The computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device.
[0110] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to: electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0111] The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, radio frequency (RF), etc., or any suitable combination of the above.
[0112] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0113] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0114] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. An image cache processing method, characterized in that: include: receiving at least one image cache service request sent by a front-end device, and sending the at least one image cache service request to an image cache processing thread; Performing task processing on the at least one image cache service request in the target cache space through the image cache processing thread; The target cache space uses a preset image data cache structure to initialize and determine a preset physical space according to a preset cache length basic unit, and the preset image data cache structure includes a cache structure overall part, a cache node description part and a cache node storage part; the cache structure overall part is used to store the overall information of the image data cache structure, the cache node description part is used to indicate the usage of the cache node in the cache node storage part, and the cache node storage part is used to store the specific information of the cache node; The at least one image cache service request is processed in the target cache space by the image cache processing thread, including: After writing image data to a cache node, if the image cache service request includes a cache node closing request, calling a cache node closing interface through the image cache processing thread to close the cache node under the cache node storage part of the target cache space; The created cache node is mounted to the head of the waiting operation linked list under the overall part of the cache structure of the target cache space, so that the state of the cache node is changed to pending execution.
2. The method according to claim 1, characterized in that The cache structure overall part stores the overall information of the entire image data cache structure; the cache node description part stores the usage of each cache node; the cache node storage part stores the specific information of each cache node, and the specific information of the cache node includes label information, description information and data information.
3. The method according to claim 1, characterized in that Sending the at least one image cache service request to the image cache processing thread includes: Through service request adjudication, task sorting is performed on each image cache service request issued by the front-end device; Send each image cache service request to the image cache processing thread in sequence according to the task sorting result; The image cache service request includes at least one of the following: a cache node creation request, a cache data write request, a cache node close request, and a cache data read request.
4. The method according to claim 1, characterized in that: The at least one image cache service request is processed in the target cache space by the image cache processing thread, including: If the image cache service request is a cache node creation request, a cache node creation interface is called through the image cache processing thread to create a cache node with description information and tag information added under the cache node storage part of the target cache space; After a cache node is created, the cache node is mounted to the head of the waiting-to-fill linked list under the overall part of the cache structure of the target cache space, so that the cache node state is changed to waiting to be filled.
5. The method according to claim 1, characterized in that The at least one image cache service request is processed in the target cache space by the image cache processing thread, including: After creating a cache node, if the image cache service request includes a cache node write request, the cache node write interface is called by the image cache processing thread to write the image data transmitted by the front-end device to the corresponding cache node under the cache node storage part of the target cache space.
6. The method according to claim 1, characterized in that After mounting the created cache node to the waiting operation linked list head under the overall part of the cache structure of the target cache space, it also includes: Take the cache node from the waiting operation linked list head under the cache structure overall part of the target cache space, and execute the custom operation function of the description information record under the cache node storage part of the target cache space; Take the cache node from the waiting callback linked list head under the cache structure overall part of the target cache space, and execute the custom callback function of the description information record under the cache node storage part of the target cache space; During the loading process, the cache nodes that have not been executed are mounted to the waiting reload linked list head under the overall part of the cache structure of the target cache space, and the custom reload function of the description information record under the cache node storage part of the target cache space is executed.
7. An image cache processing device, characterized in that: include: A service request receiving module, configured to receive at least one image cache service request sent by a front-end device, and send the at least one image cache service request to an image cache processing thread; A service request processing module, configured to perform task processing on the at least one image cache service request in a target cache space through an image cache processing thread; The target cache space uses a preset image data cache structure to initialize and determine a preset physical space according to a preset cache length basic unit, and the preset image data cache structure includes a cache structure overall part, a cache node description part and a cache node storage part; the cache structure overall part is used to store the overall information of the image data cache structure, the cache node description part is used to indicate the usage of the cache node in the cache node storage part, and the cache node storage part is used to store the specific information of the cache node; The business request processing module includes: after writing image data to a cache node, if the image cache business request includes a cache node closing request, calling the cache node closing interface through the image cache processing thread to close the cache node under the cache node storage part of the target cache space; mounting the created cache node to the waiting operation linked list head under the cache structure overall part of the target cache space, so that the cache node state is changed to pending execution.
8. An electronic device, characterized in that: include: one or more processing devices; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the image cache processing method described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the image cache processing method described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Image data processing method and device, terminal equipment and readable storage medium
CN108632624A