Picture data caching method and apparatus, computer device, and storage medium

CN117421285BActive Publication Date: 2026-09-22CHINA PING AN LIFE INSURANCE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311395356.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-25
Publication Date
2026-09-22
Estimated Expiration
2043-10-25

AI Technical Summary

Benefits of technology

[0048]本申请提出的图片数据缓存方法和装置、计算机设备和存储介质,其通过获取至少两个应用程序组件的图片数据得到原始图片数据,并在图片加载库中给每一应用程序组件创建对应的目标缓存文件夹,以实现不同应用程序组件的图片数据隔离存放。然后,基于接口适配器从应用程序组件的管理类数据中筛选出目标类数据,再确定目标类数据对应的应用程序组件为目标程序组件,以将目标程序组件的目标图片数据存入到目标缓存文件夹。因此,实现每一应用程序组件的图片数据在缓存时精准控制和隔离缓存,减少不同应用程序组件之间的图片数据干扰,极大程度提高了目标应用的开发效率和稳定性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117421285B_ABST
    Figure CN117421285B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a picture data caching method and device, computer equipment and a storage medium, and belongs to the technical field of artificial intelligence. The method comprises the following steps: obtaining picture data derived from at least two application program components to obtain original picture data; creating a target cache folder for each application program component in the picture loading library based on pre-acquired storage path information; obtaining management class data of each application program component; screening target class data from the management class data based on a preset interface adapter; screening a target program component from the at least two application program components based on the target class data; obtaining target picture data by taking the original picture data of the target program component; and caching the target picture data to the target cache folder. The embodiment of the application can reduce interference of different application program components during picture data caching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to an image data caching method and apparatus, computer equipment and storage medium. Background Technology

[0002] With the advent of the big data era, how to efficiently and quickly process massive amounts of data has become crucial for its development. For example, in the field of software development, when multiple functions are set up on the same application, it is necessary to quickly cache the image data downloaded by these functions to improve the application's operating efficiency.

[0003] In related technologies, a third-party database is used to handle image data caching for multiple application components. This database downloads and caches data from the network, sets the image data to the corresponding UI controls, and stores the image data in a single storage space. However, because image data from different application components is stored in the same storage space, interference can occur, leading to cross-referencing between components and impacting the business logic of some functions within the target application. Therefore, reducing interference between image data during caching has become a pressing technical problem. Summary of the Invention

[0004] The main objective of this application is to provide an image data caching method, apparatus, computer device, and storage medium, which aims to reduce interference between different application components during image data caching.

[0005] To achieve the above objectives, a first aspect of this application proposes an image data caching method for image caching in a target application, wherein the target application has an image loading library installed and includes at least two application components; the method includes:

[0006] Obtain image data from at least two application components to obtain the original image data;

[0007] Based on the pre-obtained storage path information, a target cache folder is created for each of the application components in the image loading library;

[0008] Obtain the management class data for each of the aforementioned application components;

[0009] Target class data is filtered from the management class data based on a preset interface adapter;

[0010] Based on the target class data, target program components are selected from the at least two application components;

[0011] Obtain the target image data by acquiring the original image data of the target program component;

[0012] The target image data is cached in the target cache folder.

[0013] In some embodiments, obtaining the management class data for each of the application components includes:

[0014] Obtain the management class creation data for each of the application components; wherein, the management class creation data includes: target namespace information;

[0015] A management class is created for the target namespace information to obtain the target management class for each application component.

[0016] The target management class is invoked to obtain the management class data of the application component.

[0017] In some embodiments, the step of creating a management class for the target namespace information to obtain a target management class for each application component includes:

[0018] Based on the target namespace information, a management class search is performed in a preset management class data structure to obtain the management class search result;

[0019] If the management class search result indicates that there is no candidate management class that is the same as the target namespace information, the management class is created according to the target namespace information to obtain the target management class;

[0020] If the management class search result indicates the existence of a candidate management class that is identical to the target namespace information, a cache management prompt message is pushed to the target application to receive cache management feedback information, and a management class is created based on the cache management feedback information to obtain the target management class.

[0021] In some embodiments, if the management class search result indicates the existence of a candidate management class identical to the target namespace information, a cache management prompt is pushed to the target application to receive cache management feedback information, and a management class is created based on the cache management feedback information to obtain the target management class, including:

[0022] If the management class search result indicates the existence of a candidate management class that is identical to the target namespace information, a cache management prompt message is pushed to the target application.

[0023] Receive cache management feedback information from the target application based on the cache management prompt information; wherein, the cache management feedback information includes any one of the following: updated namespace information and merge management information;

[0024] If the cache management feedback information is the updated namespace information, a management class is created based on the updated namespace information to obtain the target management class;

[0025] If the cache management feedback information is the merged management information, the candidate management class that is the same as the target namespace information in the management class data structure shall be taken as the target management class.

[0026] In some embodiments, before performing a management class search in a preset management class data structure based on the target namespace information to obtain the management class search result, the method further includes:

[0027] Create a management-class data structure, specifically including:

[0028] Obtain the management class creation information of the candidate management class; wherein, the management class creation information includes: candidate namespace information and management class data;

[0029] The candidate namespace information is used as the key of a preset data structure, and the management data is used as the value of the preset data structure to obtain the management data structure.

[0030] In some embodiments, the step of performing a management class search in a preset management class data structure based on the target namespace information to obtain the management class search result includes:

[0031] The candidate namespace information is filtered based on the target namespace information to obtain the selected namespace information;

[0032] The management data is screened based on the selected namespace information to obtain the management search results.

[0033] In some embodiments, after caching the target image data to the target cache folder, the method further includes:

[0034] Obtain the usage frequency of the target image data in the target cache file to obtain the image usage frequency;

[0035] Selected image data is extracted from the target cache file based on a preset usage frequency threshold and the image usage frequency;

[0036] The space occupied by the target cache folder is calculated according to the preset periodic cleaning cycle to obtain the occupied space value;

[0037] When the occupied space value reaches the preset limit for cleaning, the selected image data is cleaned up.

[0038] To achieve the above objectives, a second aspect of this application provides an image data caching device for caching images in a target application, the target application being installed in an image loading library, and the target application including at least two application components; the device includes:

[0039] The raw data acquisition module is used to acquire image data from the at least two application components to obtain raw image data;

[0040] The folder creation module is used to create a target cache folder for each application component in the image loading library based on the pre-obtained storage path information.

[0041] The management data acquisition module is used to acquire management data for each of the application components.

[0042] A data filtering module is used to filter target data from the managed data based on a preset interface adapter;

[0043] The component filtering module is used to filter target program components from the at least two application components based on the target class data;

[0044] The target data acquisition module is used to acquire the original image data of the target program component to obtain the target image data;

[0045] The data caching module is used to cache the target image data to the target cache folder.

[0046] To achieve the above objectives, a third aspect of the present application provides a computer device, the computer device including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method described in the first aspect.

[0047] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect.

[0048] The image data caching method, apparatus, computer device, and storage medium proposed in this application obtain raw image data by acquiring image data from at least two application components. A corresponding target cache folder is created for each application component in the image loading library to achieve isolated storage of image data from different application components. Then, target class data is filtered from the management class data of the application components based on the interface adapter. The application component corresponding to the target class data is then identified as the target program component, and the target image data of the target program component is stored in the target cache folder. Therefore, precise control and isolated caching of image data for each application component is achieved during caching, reducing interference between image data from different application components and greatly improving the development efficiency and stability of the target application. Attached Figure Description

[0049] Figure 1 This is a system architecture diagram of existing image data caching methods;

[0050] Figure 2 This is a system architecture diagram of the image data caching method provided in the embodiments of this application;

[0051] Figure 3 This is a flowchart of the image data caching method provided in the embodiments of this application;

[0052] Figure 4 yes Figure 3 The flowchart of step S303 in the process;

[0053] Figure 5 yes Figure 4 The flowchart of step S402 in the document;

[0054] Figure 6 This is a flowchart of an image data caching method provided in another embodiment of this application;

[0055] Figure 7 yes Figure 5 The flowchart of step S501 in the process;

[0056] Figure 8 yes Figure 5 The flowchart of step S503 in the process;

[0057] Figure 9 This is a flowchart of an image data caching method provided in another embodiment of this application;

[0058] Figure 10 This is a schematic diagram of the image data caching device provided in the embodiments of this application;

[0059] Figure 11 This is a schematic diagram of the hardware structure of the computer device provided in the embodiments of this application. Detailed Implementation

[0060] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0061] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0062] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0063] First, let's analyze some of the terms used in this application:

[0064] Artificial intelligence (AI) is a new branch of computer science that studies, develops, and applies theories, methods, technologies, and systems to simulate, extend, and expand human intelligence. It aims to understand the essence of intelligence and produce intelligent machines that can react in a way similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. AI can simulate the information processes of human consciousness and thought. Furthermore, AI utilizes digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceiving the environment, acquiring knowledge, and using that knowledge to achieve optimal results.

[0065] SDWebImage is an open-source image loading and caching library that provides a fast, asynchronous, and scalable solution for image loading and caching. SDWebImage supports loading images from the network, local file system, and memory, and can automatically manage image caching. SDWebImage also offers additional features such as progressive image loading, image transformations, and rounded corners. SDWebImage is widely used in iOS and macOS development to help developers load and display images more efficiently, improving the user experience.

[0066] A namespace is a mechanism for organizing and managing code, representing the scope of an identifier. In programming, namespaces group code to avoid naming conflicts and improve maintainability. Namespaces can contain code elements such as classes, interfaces, functions, and variables. Placing related code within the same namespace makes the code structure clearer, easier to understand, and easier to maintain.

[0067] In software development, to facilitate module calls and quickly integrate more functionalities into the system, software development teams encapsulate their modules, ultimately providing them as dynamic libraries, static libraries, shared libraries, or sometimes even source code within a functional library. It's important to note that this functional library is also called a system library, while libraries not provided by the software are called third-party libraries. The system library primarily refers to operating system layers such as iOS, Android, and Windows. System libraries typically only provide operating system APIs, which are difficult to use and require specialized developers. Third-party libraries were created to address this API usage difficulty. These libraries support downloading and caching image data from the network and setting the image data to the corresponding UI space, utilizing their internal multi-threading and caching mechanisms. However, different software development teams using third-party libraries can disrupt the business logic of other teams when their components are compiled into the same system. For example,... Figure 1 As shown, application components A, B, C to N all use third-party libraries. The image data of each application component is cached in the "Default" folder, and the three application components have management permissions for the "Default" folder, which can easily affect the functionality of other application components.

[0068] Based on this, embodiments of this application provide an image data caching method and apparatus, a computer device, and a storage medium. An image loading library is installed in a target application, and the target application includes at least two application components. When image data caching is required, the original image data of at least two application components is obtained, and a target cache folder for each application component is created within the image loading library. The image data of each application component is stored in isolation through these target cache folders. When image data is cached to the target cache folder, the management data of the selected application component is used as the target data. Based on the target data, a target application component is selected from the application components, and the original image data of the target application component is used as the target image data to store the target image data in the target cache folder. Therefore, by storing image data specifically in the corresponding target cache folder according to the management data of each application component, the image data is isolated and specifically stored in the target cache folder, achieving image data isolation and precise control for each application component, reducing functional interference between application components, and improving the efficiency and stability of application development.

[0069] The image data caching method, apparatus, computer device, and storage medium provided in this application are specifically described through the following embodiments. First, the image data caching method in this application is described.

[0070] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0071] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0072] The image data caching method provided in this application relates to the field of artificial intelligence technology. This image data caching method can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing the image data caching method, but is not limited to the above forms.

[0073] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer computer devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0074] It should be noted that in all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards. In addition, when embodiments of this application require access to sensitive personal information of users, separate permission or consent from the user is obtained through pop-ups or redirection to confirmation pages. Only after obtaining the user's separate permission or consent is the necessary user-related data required for the proper functioning of these embodiments acquired.

[0075] This application discloses an image data caching method, which is applied to the image caching of a target application. Figure 2As shown, the target application includes at least two application components. The target application has an image loading library installed, which serves as a cache for storing image data within the application components. An interface adapter connects the image loading library and the target application. A management class is created for each application component through the interface adapter to manage its image data cache and isolate the image data caches of other application components. It should be noted that the interface adapter not only isolates image data caches from different application components but also isolates image data from different business functions within the same application component. This achieves isolated image data caching, reduces interference between image data from different business functions within the same application component, and makes the target application's functionality more stable.

[0076] Specifically, such as Figure 2 As shown, if at least two application components are configured, and four application components are shown, defined as application component A, application component B, application component C, and application component N respectively, the target cache file corresponding to application component A is pathA, the target cache folder corresponding to application component B is pathB, the target cache folder corresponding to application component C is pathC, and the target cache folder corresponding to application component N is pathN. Therefore, by setting different target cache folders for each application component, isolation of image data caching is achieved, reducing interference between image data between application components.

[0077] It should be noted that the image loading library used in this embodiment is SDWebImage, in order to create a target cache folder for each application component in SDWebImage.

[0078] Figure 3 This is an optional flowchart of the image data caching method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps S301 to S307.

[0079] Step S301: Obtain image data from at least two application components to obtain the original image data;

[0080] Step S302: Based on the pre-obtained storage path information, create a target cache folder for each application component in the image loading library;

[0081] Step S303: Obtain the management class data for each application component;

[0082] Step S304: Filter target class data from management class data based on preset interface adapters;

[0083] Step S305: Select target application components from at least two application components based on target class data;

[0084] Step S306: Obtain the original image data of the target program component to obtain the target image data;

[0085] Step S307: Cache the target image data to the target cache folder.

[0086] Steps S301 to S307 of this embodiment involve obtaining raw image data by acquiring image data from at least two application components, and creating a corresponding target cache folder for each application component in the image loading library. When it is necessary to specifically cache the image data of an application component in the target cache folder, target class data is filtered from the management class data of the application component based on the interface adapter, and then the application component corresponding to the target class data is determined as the target program component, so that the target image data of the target program component is stored in the target cache folder. Therefore, by specifically caching image data to the corresponding target cache folder according to the management class data of each application component, the image data isolation and precise control of each application component are achieved, which greatly improves the development efficiency and stability of the target application.

[0087] In step S301 of some embodiments, before acquiring image data from at least two application components, an image data acquisition interface needs to be created through an interface adapter. This image data acquisition interface is used to acquire image data from the application components. Therefore, by setting up an image data acquisition interface to collect image data from the application components as raw image data, the acquisition of raw image data becomes simple. It should be noted that the image data acquisition interface is provided through the base view class in the interface adapter. In this embodiment, the base view class is UIView, which includes: UIButton+XYWebCache, UIImageView+XYHighlightedWebCache, and UIImageView+XYWebCache. UIButton+XYWebCache provides an API for setting image data for UIButton, UIImageView+XYHighlightedWebCache provides an API for setting highlighted image data for UIImageView, and UIImageView+XYWebCache provides an API for setting image data for UIImageView. Therefore, by providing image data interfaces through different base view classes, the methods for acquiring image data from application components are expanded.

[0088] In step S302 of some embodiments, cache file name information is determined based on pre-obtained storage path information, and the cache file name information is consistent with the storage path information. A target cache folder is created for each application component within the image loading library according to the cache file name information. It should be noted that the storage path information is set based on pre-obtained namespace information, and each namespace is unique, so the cache file name information for each target cache folder is unique. By setting unique cache file name information, it is ensured that image data for each application component is specifically placed into the corresponding target cache folder, reducing the possibility of incorrect image data storage.

[0089] For example, if the target application is XXapply, and the application component is the "Friends' Moments" feature of the target application, with the namespace information for "Friends' Moments" being "XXapply / find / moment," and the storage path information determined based on the namespace information being "cache / XXapply / find / moment," then the cache file name information for the target folder of "Friends' Moments" will be "cache / XXapply / find / moment." Similarly, if the application component is the "Live View" feature of the target application, with the namespace information for "Live View" being "XXapply / find / look," and the storage path information determined based on the namespace information being "cache / XXapply / find / look," then the cache file name information for the target folder of "Live View" will be "cache / XXapply / find / look." Therefore, by creating a target cache folder for each application component based on unique namespace information, image data between each application component is isolated through the target cache folder, reducing interference between image data from different application components.

[0090] Please see Figure 4 In some embodiments, step S303 may include, but is not limited to, steps S401 to S403:

[0091] Step S401: Obtain the management class creation data for each application component; wherein, the management class creation data includes: target namespace information;

[0092] Step S402: Create a management class for the target namespace information to obtain the target management class for each application component;

[0093] Step S403: Call the target management class to obtain the management class data of the application components.

[0094] In step S401 of some embodiments, the namespace information of each application component is obtained to obtain target namespace information. The target namespace information represents the visibility range of an identifier, and the meanings of different target namespace information are unrelated to each other, so the target namespace information is unique.

[0095] In step S402 of some embodiments, a target management class is created for each application component by processing the target namespace information. It should be noted that the target namespace information is unique, so the class name of the created target management class is also unique. That is, it is impossible for two target management classes with the same name to exist in the target application, thus reducing the possibility of call conflicts due to identical class names.

[0096] For example, if the namespace information for "Friends' Moments" is "XXapply / find / moment", the target management class is named manageA. If the namespace information for "Real-time View" is determined to be "XXapply / find / look", the target management class is named manageB. The target management class with class name manageA manages the image data cache for "Friends' Moments", while the target management class with class name manageB manages the image data cache for "Real-time View".

[0097] It should be noted that the management class creation interface is set based on the interface adapter. In this embodiment, the management class creation interface is xyCreateManagerForN, which provides a method for creating a management class based on the target namespace information. It should be further explained that modifying the code within the existing image loading library of the application components to build a new image loading library, and then using the new image loading library to complete image caching for each application component, can lead to overwriting issues if different application components have duplicate library names when building new image loading libraries. This application, however, creates a management class for each application component by setting a management class creation interface. This interface creates the management class based on the target namespace information, without modifying the code within the image loading library. It uses only one image loading library to achieve isolated caching of image data for multiple application components, improving the stability of image data caching.

[0098] In step S403 of some embodiments, after the target management class is completed, the target management class is used to manage the image data cache of the corresponding application components. Therefore, management class data of the application components is obtained based on the target management class. It should be noted that one target management class can manage the image data cache of multiple application components. Therefore, the basic management class data and management component data of the target management class are obtained as management class data. Further, the basic management class data is the basic information of the target management class, and the management component data indicates which application components' image data caches the target management class manages.

[0099] Steps S401 to S403 as shown in the embodiments of this application involve creating a target management class based on the target namespace information of the application component, thereby creating a target management class with a unique class name, and then calling the target management class to obtain the management class data of the application component, making it easy to obtain the management class data of each application component.

[0100] Please refer to Figure 5 In some embodiments, step S402 may include, but is not limited to, steps S501 to S503:

[0101] Step S501: Based on the target namespace information, perform a management class search in the preset management class data structure to obtain the management class search result;

[0102] Step S502: If the management class search result indicates that there is no candidate management class that is the same as the target namespace information, the management class is created according to the target namespace information to obtain the target management class;

[0103] Step S503: If the management class search result indicates that there is a candidate management class with the same namespace information as the target, push cache management prompt information to the target application to receive cache management feedback information, and create the management class according to the cache management feedback information to obtain the target management class.

[0104] In step S501 of some embodiments, the management class data structure is a mapping relationship, and the mapping relationship is a data structure that associates keys and values, that is, a data structure that associates namespace information and management class data. The corresponding management class data is retrieved in the management class data structure based on the target namespace information to obtain the management class lookup result. Based on the management class lookup result, it is determined whether a management class for the application component has been created.

[0105] Specifically, in this embodiment, the management class data structure is a global map. A global map is a variable of a mapping type defined globally within the target application, and it stores the mapping relationship as key-value pairs. Therefore, based on the target namespace information, the corresponding management class data can be quickly found in the global map to obtain the management class search result.

[0106] In step S502 of some embodiments, if the management class search result indicates that there is no candidate management class identical to the target namespace information, that is, there is no management class data corresponding to the target namespace information in the management class data structure, it indicates that no application component has created a management class corresponding to the target namespace information. Therefore, a target management class is created based on the target namespace information. It should be noted that when creating a target management class, it is necessary to first determine which management class data is recorded in the management class data structure to determine which management classes have been created, and then create a target management class that is different from the already created management classes based on the target namespace information. For example, if the class names of the already created management classes include manageA, manageB, and manageC, and the target namespace information is now determined to be "XXapply / find / Search", then the class name of the corresponding target management class created based on the target namespace information is manageD.

[0107] It should be noted that after the target management class is created, the management class data structure needs to be updated based on the target management class and the target namespace information. That is, the mapping relationship between the management class data of the target management class and the target namespace information is established as the target mapping relationship, and the target mapping relationship is stored in the management class data structure.

[0108] In step S503 of some embodiments, if the management class search result indicates the existence of a candidate management class that is identical to the target namespace information, that is, the management class data structure contains management class data corresponding to the target namespace information, it also indicates that other application components have established management classes corresponding to the target namespace information. Therefore, it is necessary to push cache management prompt information to the target application, and the cache management prompt information is displayed in the target application's interface in the form of a "pop-up window," so that the development team can know that a management class corresponding to the target namespace information already exists through the content displayed in the "pop-up window." The development team will provide feedback on how to create the management class of the application component based on the cache management prompt information, and receive cache management feedback information from the target application based on the cache management prompt information. The target management class is created based on the cache management feedback information, so that each application component can create a corresponding target management class to manage the image data cache of the application component through the target management class, thereby achieving image data cache isolation between different application components and reducing interference between image data.

[0109] In steps S501 to S503 of this embodiment, the management class search result is obtained by searching the management class data structure according to the target namespace information, that is, by determining whether other application components have already created the management class corresponding to the target namespace information. Based on the management class search result, it is determined whether to create the management class corresponding to the target namespace information or to create the management class corresponding to the cache management feedback information, so as to create the management class for each application component independently and reduce cache interference of image data of different application components.

[0110] In some embodiments, before step S501, the image data caching method may further include: creating a management class data structure. It should be noted that before searching in the management class data structure based on the target namespace information, it is necessary to first determine the mapping relationship between each candidate namespace information and the management class data, and then construct the management class data structure based on the mapping relationship. After constructing the management class data structure, a management class search is performed in the management class data structure based on the target namespace information to determine whether the management class data corresponding to the target namespace information has been created. This eliminates the need for comparing management class data one by one, improving the efficiency of the management class search.

[0111] Please see Figure 6 In some embodiments, creating a management-type data structure may include, but is not limited to, steps S601 to S602:

[0112] Step S601: Obtain the management class creation information of the candidate management classes; wherein, the management class creation information includes: candidate namespace information and management class data;

[0113] Step S602: Use the candidate namespace information as the key of the preset data structure and the management data as the value of the preset data structure to obtain the management data structure.

[0114] In step S601 of some embodiments, the candidate management class is a pre-set management class. The management class creation information for each candidate management class is obtained, and the management class creation information includes: candidate namespace information and management class data, to determine the candidate namespace information corresponding to the candidate management class. It should be noted that there are created and uncreated management classes among the candidate management classes. The management class data of created management classes includes basic management class information and management component data, while the management class data of uncreated management classes only includes basic management class information.

[0115] In step S602 of some embodiments, the preset data structure is a global map, and the global map stores different management class data according to different candidate namespaces. Therefore, the candidate namespace information is used as the key of the preset data structure, and the management class data is used as the value of the preset data structure to obtain the management class data structure. Therefore, by setting a mapping relationship between candidate namespace information and management class data represented by key-value pairs, it is convenient to quickly find management class data in the management class data structure using the target namespace information as the key. It should be noted that the value of the management class data structure is determined to be a specific numerical value based on the management class data of the management class that has been created, while the value of the management class data structure is set to empty based on the management class data of the management class that has not been created, so as to determine whether there is a candidate management class that has been created based on whether the value in the management class data structure is empty.

[0116] It should be noted that the management classes include a default management class and a custom management class. The default management class is a public management class. Custom management classes are created based on namespace information and only manage the image data cache of their corresponding application components, not the image data cache of other application components. In this embodiment, the candidate management class is a custom management class. By using a custom management class to manage the image data cache of the corresponding application component separately, the image data caching between application components is reduced.

[0117] Specifically, in this embodiment, the management data structure is a global map, which refers to a mapping type variable defined globally within the target application. The global map is obtained by associating candidate namespace information as keys and management data as values. Therefore, by constructing a global map represented by key-value pairs, the corresponding management data can be quickly found and accessed within the global map using the target namespace information as the key.

[0118] In steps S601 to S602 of this embodiment, a management class data structure is constructed by using the candidate namespace information of the candidate management class as the key and the candidate namespace information of the candidate management class as the value of the preset data structure. Therefore, by using key-value pairs to represent the mapping relationship between candidate namespace information and management class data, it is convenient to quickly find the corresponding management class data in the management class data structure with the target namespace information when searching for management class data.

[0119] Please see Figure 7 In some embodiments, step S501 may include, but is not limited to, steps S701 to S702:

[0120] Step S701: Filter the candidate namespace information according to the target namespace information to obtain the selected namespace information;

[0121] Step S702: Screen the management data according to the selected namespace information to obtain the management search results.

[0122] In step S701 of some embodiments, since the management class data structure records all candidate namespace information, the same candidate namespace information is first searched in the management class data structure according to the target namespace information as the selected namespace information. For example, the management class data structure is shown in Table 1. The management class data corresponding to the candidate namespace information "XXapply / find / moment" is manageA, so the candidate management class management application component "XXapply / find / moment" with class name manageA is determined; the management class data corresponding to the candidate namespace information "XXapply / find / look" is manageB, and the management class data corresponding to the candidate namespace information "XXapply / find / shopping" is manageB. Therefore, the management class management application components "XXapply / find / look" and "XXapply / find / shopping" with class name manageB are known. The management class data corresponding to the candidate namespace information "XXapply / find / moment" is empty, so it is determined that there is no management class corresponding to the candidate namespace information "XXapply / find / moment". Therefore, Table 1 can be used to determine the management class data corresponding to each candidate namespace information, and it can also be determined whether the management class corresponding to which candidate namespace exists.

[0123]

[0124] Table 1

[0125] In step S702 of some embodiments, the management class data is screened based on the selected namespace information, that is, whether the value corresponding to the selected namespace information is empty is obtained to obtain the management class search result. If the value corresponding to the selected namespace information is a specific numerical value, it is determined that the management class search result is that there is a candidate management class that is the same as the target namespace information. If the value corresponding to the selected namespace information is empty, it is determined that there is no candidate management class that is the same as the target namespace information. For example, if the value corresponding to the selected namespace information XXapply / find / moment is manageA, it is determined that the search result is that there is a candidate management class manageA that corresponds to the target namespace information. If the value corresponding to the selected namespace information XXapply / find / Search is empty, then the search result is that there is no candidate management class that corresponds to the target namespace information.

[0126] In steps S701 to S702 of this embodiment, the corresponding candidate namespace information is found based on the target namespace information and selected as the target namespace information. Then, the value corresponding to the selected namespace information is checked in the management class data structure to determine whether the management class search result is empty, thereby determining whether the candidate management class corresponding to the target namespace information has been created. Therefore, determining whether the candidate management class corresponding to the target namespace information has been created does not require comparing each management class data, improving the efficiency of determining whether management class data has been created.

[0127] Please see Figure 8 In some embodiments, step S503 may include, but is not limited to, steps S801 to S804:

[0128] Step S801: If the management class search result indicates that there is a candidate management class with the same namespace information as the target application, push cache management prompt information to the target application;

[0129] Step S802: Receive cache management feedback information from the target application based on the cache management prompt information; wherein, the cache management feedback information includes any one of the following: updated namespace information and merge management information;

[0130] Step S803: If the cache management feedback information is updated namespace information, create a management class based on the updated namespace information to obtain the target management class;

[0131] Step S804: If the cache management feedback information is merged management information, the candidate management class in the management class data structure that is the same as the target namespace information is taken as the target management class.

[0132] In step S801 of some embodiments, if the management class search result indicates the existence of a candidate management class with the same target namespace information, it indicates that other application components have created a candidate management class corresponding to the target namespace information. For example, if the target namespace information is XXapply / find / look, the existing candidate management class is determined to be manageB through Table 1. It should be noted that the candidate management class manageB is a created management class, and it was pre-created based on the candidate namespace information XXapply / find / shopping. It should also be noted that the candidate management class with the class name manageB is used to manage the image data cache of the application component XXapply / find / shopping. Therefore, after discovering that a management class corresponding to the target namespace information has been created, a cache management prompt message is pushed to the target application to inquire with the development team of the target application how to create a target management class to manage the application component with the target namespace information XXapply / find / look.

[0133] In step S802 of some embodiments, cache management feedback information is received from the target application, and the cache management feedback information includes updated namespace information and merged management information. It should be noted that the updated namespace information refers to the modified namespace information, and the updated namespace information is different from the target namespace information. The merged management information is used to indicate that candidate management classes will be found to manage the application components corresponding to the target namespace information together.

[0134] In step S803 of some embodiments, if updated namespace information is received, a management class is created based on the updated namespace information to obtain a target management class, and the target management class manages the image data cache of the application component corresponding to the updated namespace information. For example, if a candidate management class named manageB has already been created for the target namespace information XXapply / find / look, and the updated namespace information is XXapply / find / see, a target management class named manageE is created based on the updated namespace information, so that the application component corresponding to "XXapply / find / look" can be managed through the target management class manageE.

[0135] In step S804 of some embodiments, if merged management information is received, the found candidate management class is used as the target management class, and the candidate namespace information and the application components corresponding to the target namespace information are managed through the target management class. For example, if a candidate management class named manageB has been created corresponding to the target namespace information XXapply / find / look, the candidate management class named manageB is used as the target management class. Therefore, the target management class named manageB manages the image data cache of the application components corresponding to the namespace information "XXapply / find / look" and "XXapply / find / shopping".

[0136] In steps S801 to S804 of this embodiment, after finding the management class corresponding to the created target namespace information, a new management class is created as the target management class for updating the namespace information based on the cache management feedback information. Based on the cache management feedback information, the found candidate management classes are used as the target management class for merging management information. The target management class then merges and manages the image data caches of multiple application components. Therefore, when users cache image data, if there is a risk of interference, a new management class is created to manage the image data cache of the application components; if there is no interference, a merging management method is used to expand the management methods for the image data cache of application components.

[0137] In step S304 of some embodiments, after the management class of each application is created, the management class data of each application component is obtained, so as to filter the target class data from the management class data based on the interface adapter, that is, to select which target management class to cache the image data. It should be noted that the management class data of the corresponding target management class is obtained as the target class data according to the time order in which the target management class initiates the image caching request.

[0138] In steps S305 to S307 of some embodiments, at least the application components are filtered based on the target class data. Specifically, the image data cache of the application component being managed by the target management class is identified to obtain the target application component. Then, the original image data of the target application component is obtained as the target image data. It should be noted that after determining which target management class initiated the image caching request through the interface adapter, the original image data of the target application component managed by the target management class is determined as the target image data. Then, based on the interface adapter, the target cache folder of the target management class is sent to the image downloader, that is, the storage path of the target cache folder is sent to the image downloader so that the image downloader can cache the target image data in the target cache folder. This achieves isolated caching of image data for each application component, and the cached target image data is stored in isolation, reducing interference between application components during image data caching and improving the efficiency and stability of system development.

[0139] Please see Figure 9 In some embodiments, step S502 includes, but is not limited to, steps S901 to S904:

[0140] Step S901: Obtain the usage frequency of the target image data in the target cache file to obtain the image usage frequency;

[0141] Step S902: Extract selected image data from the target cache file according to the preset usage frequency threshold and image usage frequency;

[0142] Step S903: Calculate the occupied space of the target cache folder according to the preset periodic cleaning cycle to obtain the occupied space value;

[0143] Step S904: When the occupied space value reaches the preset limit for cleaning, the selected image data is cleaned.

[0144] In step S901 of some embodiments, a preset counter on the target cache folder is incremented by one each time the target image data in the target cache folder is used. Therefore, the image usage frequency is obtained by determining the frequency at which the target image data is used by acquiring the value calculated by the counter. It should be noted that a higher image usage frequency indicates that the corresponding target image data is more important, and conversely, a lower image usage frequency indicates that the corresponding target image data is less important.

[0145] In step S902 of some embodiments, target image data in the target cache folder is filtered according to a preset usage frequency threshold and image usage frequency; that is, target image data with an image usage frequency lower than the usage frequency threshold is selected as the selected image data. It should be noted that the selected image data is defined as unimportant target image data.

[0146] In steps S903 and S904 of some embodiments, to ensure that each target cache folder can store important target image data and reduce the space occupied by unimportant target image data, a pre-set periodic cleaning cycle and a quota cleaning threshold are used to monitor and clean the target cache folder. Specifically, the occupied space value of the target cache folder is calculated periodically according to the periodic cleaning cycle. By comparing the occupied space value with the quota cleaning threshold, if the occupied space value reaches the quota cleaning threshold, it indicates that too much target image data is stored in the target cache folder, which will affect the stability of the target application. By cleaning selected image data to delete unimportant target image data, the memory occupation of target image data in the target cache folder is reduced, thereby improving the running efficiency of the target application.

[0147] It should be noted that in addition to periodically cleaning the target cache folder, it can also be manually cleaned. By receiving manual cleanup commands, the corresponding target image data in the target cache folder can be cleaned according to the commands, making the cleanup of target image data in the target cache folder more flexible.

[0148] In steps S901 to S904 of this embodiment, target image data with low usage frequency is selected from the target image data. When the occupied space in the target cache folder periodically exceeds a preset cleanup threshold, the selected image data is cleared to free up more memory space for caching other target image data. This reduces the occupation of the target cache folder by unimportant target image data and improves the operating efficiency of the target application.

[0149] This application embodiment installs an image loading library in the target application, with an interface adapter between the image loading library and the target application. When image data caching is required, an image data retrieval interface is created through the interface adapter to obtain the original image data from at least two application components. Before image data caching, cache file name information is determined based on pre-obtained storage path information, and a target cache folder is created for each application component within the image loading library according to the cache file name information. During image data caching, the namespace information of each application component is obtained to obtain target namespace information. Based on the target namespace information, the selected namespace information is filtered from the candidate namespace information in the management class data structure. Then, based on the selected namespace information, it is determined whether the corresponding management class data is null. If the management class data corresponding to the selected namespace information is control, the management class search result is determined to be that there is no candidate management class with the same namespace information as the target namespace information. If the management class data corresponding to the selected namespace information exists, the management class search result is determined to be that there is a candidate management class with the same namespace information as the target namespace information. If the management class search result indicates that no candidate management class exists that matches the target namespace information, it means that no application component has created a management class corresponding to the target namespace information. The target management class is then created based on the target namespace information. If the management class search result indicates that a candidate management class exists that matches the target namespace information, it means that other application components have already created a candidate management class corresponding to the target namespace information. Cache management feedback information is received from the target application, including updated namespace information and merged management information. A new management class is created as the target management class based on the updated namespace information, and the found candidate management classes are used as the target management class based on the merged management information. The target management class then merges and manages the image data cache of multiple application components. After the target management class is created, the management class data of the target management class that initiated the image caching request is obtained as the target class data. At least one application component is then filtered based on the target class data to obtain the target application component. The target application component's target cache folder is sent to the image downloader via an interface adapter, which also sends the storage path of the target cache folder to the image downloader. This allows the image downloader to cache the target image data in the target cache folder. Therefore, by setting different target cache files to isolate the image data of different application components before image data caching, and by selectively caching image data to the corresponding target cache folder based on the management class data of different application components during image data caching, isolated image data caching is achieved. This reduces interference between image data from different application components and improves the development efficiency and stability of the target application.

[0150] Please see Figure 10 This application also provides an image data caching device that can implement the above-described image data caching method for image caching of a target application. The target application is installed in an image loading library and includes at least two application components. The image data caching device includes:

[0151] The raw data acquisition module 1001 is used to acquire image data from at least two application components to obtain raw image data;

[0152] The folder creation module 1002 is used to create a target cache folder for each application component in the image loading library based on the pre-obtained storage path information.

[0153] The management data acquisition module 1003 is used to acquire management data for each application component;

[0154] The data filtering module 1004 is used to filter target data from management data based on a preset interface adapter;

[0155] The component filtering module 1005 is used to filter target program components from at least two application components based on target class data;

[0156] The target data acquisition module 1006 is used to acquire the original image data of the target program component to obtain the target image data;

[0157] The data caching module 1007 is used to cache the target image data to the target cache folder.

[0158] The specific implementation of this image data caching device is basically the same as the specific embodiment of the image data caching method described above, and will not be repeated here.

[0159] This application also provides a computer device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described image data caching method. This computer device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0160] Please see Figure 11 , Figure 11 The hardware structure of a computer device according to another embodiment is illustrated. The computer device includes:

[0161] The processor 1101 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.

[0162] The memory 1102 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1102 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1102 and is called and executed by the processor 1101 using the image data caching method of the embodiments of this application.

[0163] Input / output interface 1103 is used to implement information input and output;

[0164] The communication interface 1104 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0165] Bus 1105 transmits information between various components of the device (e.g., processor 1101, memory 1102, input / output interface 1103, and communication interface 1104);

[0166] The processor 1101, memory 1102, input / output interface 1103 and communication interface 1104 are connected to each other within the device via bus 1105.

[0167] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described image data caching method.

[0168] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0169] The image data caching method, apparatus, computer device, and storage medium provided in this application embodiment install an image loading library on the application component. Before the application component caches image data, a target cache folder is created in advance for each application component to isolate and store image data. When the application component caches image data, target management data is selected from management data based on the interface adapter. Then, target program components are selected from at least two application components based on the target management data. The original image data of the target program components is cached as target image data in the target cache file. This ensures that the image data caching process is also isolated and precisely controlled, reducing interference between image data from different application components during the caching process and improving the development efficiency and stability of the target application.

[0170] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0171] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0172] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0173] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0174] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0175] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0176] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0177] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0178] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0179] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0180] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. A method for caching image data, characterized in that, Image caching for a target application, the target application having an image loading library installed, the target application comprising at least two application components; the method includes: Obtain image data from at least two application components to obtain the original image data; Based on the pre-obtained storage path information, a target cache folder is created for each of the application components in the image loading library; Obtain the management class data for each of the aforementioned application components; Target class data is filtered from the management class data based on a preset interface adapter; Based on the target class data, target program components are selected from the at least two application components; Obtain the target image data by acquiring the original image data of the target program component; The target image data is cached in the target cache folder; Based on the pre-acquired storage path information, the step of creating a target cache folder for each application component in the image loading library includes: The cache file name information is determined based on the pre-acquired storage path information; wherein the storage path information is set according to the pre-acquired namespace information, and each namespace information is unique; Based on the cache file name information, create the target cache folder for each application component within the image loading library; The step of obtaining management class data for each application component includes: Obtain the management class creation data for each of the application components; wherein, the management class creation data includes: target namespace information; A management class is created for the target namespace information to obtain the target management class for each application component. The target management class is invoked to obtain the management class data of the application component; wherein, the target management class data is used to manage the image data cache of multiple application components.

2. The method according to claim 1, characterized in that, The step of creating a management class for the target namespace information to obtain a target management class for each application component includes: Based on the target namespace information, a management class search is performed in a preset management class data structure to obtain the management class search result; If the management class search result indicates that there is no candidate management class that is the same as the target namespace information, the management class is created according to the target namespace information to obtain the target management class; If the management class search result indicates the existence of a candidate management class that is identical to the target namespace information, a cache management prompt message is pushed to the target application to receive cache management feedback information, and a management class is created based on the cache management feedback information to obtain the target management class.

3. The method according to claim 2, characterized in that, If the management class search result indicates the existence of a candidate management class with the same namespace information as the target, a cache management prompt is pushed to the target application to receive cache management feedback information, and a management class is created based on the cache management feedback information to obtain the target management class, including: If the management class search result indicates the existence of a candidate management class that is identical to the target namespace information, a cache management prompt message is pushed to the target application. Receive cache management feedback information from the target application based on the cache management prompt information; wherein, the cache management feedback information includes any one of the following: updated namespace information and merge management information; If the cache management feedback information is the updated namespace information, a management class is created based on the updated namespace information to obtain the target management class; If the cache management feedback information is the merged management information, the candidate management class that is the same as the target namespace information in the management class data structure shall be taken as the target management class.

4. The method according to claim 2, characterized in that, Before performing a management class search in a preset management class data structure based on the target namespace information to obtain the management class search result, the method further includes: Create a management-class data structure, specifically including: Obtain the management class creation information of the candidate management class; wherein, the management class creation information includes: candidate namespace information and management class data; The candidate namespace information is used as the key of a preset data structure, and the management data is used as the value of the preset data structure to obtain the management data structure.

5. The method according to claim 4, characterized in that, The step of performing a management class search in a preset management class data structure based on the target namespace information to obtain the management class search result includes: The candidate namespace information is filtered based on the target namespace information to obtain the selected namespace information; The management data is screened based on the selected namespace information to obtain the management search results.

6. The method according to any one of claims 1 to 5, characterized in that, After caching the target image data to the target cache folder, the method further includes: Obtain the usage frequency of the target image data in the target cache file to obtain the image usage frequency; Selected image data is extracted from the target cache file based on a preset usage frequency threshold and the image usage frequency; The space occupied by the target cache folder is calculated according to the preset periodic cleaning cycle to obtain the occupied space value; When the occupied space value reaches the preset limit for cleaning, the selected image data is cleaned up.

7. An image data caching device, characterized in that, Image caching for a target application, the target application being installed in an image loading library, the target application comprising at least two application components; the apparatus includes: The raw data acquisition module is used to acquire image data from the at least two application components to obtain raw image data; The folder creation module is used to create a target cache folder for each application component in the image loading library based on the pre-obtained storage path information. The management data acquisition module is used to acquire management data for each of the application components. A data filtering module is used to filter target data from the managed data based on a preset interface adapter; The component filtering module is used to filter target program components from the at least two application components based on the target class data; The target data acquisition module is used to acquire the original image data of the target program component to obtain the target image data; The data caching module is used to cache the target image data to the target cache folder; Based on the pre-acquired storage path information, the step of creating a target cache folder for each application component in the image loading library includes: The cache file name information is determined based on the pre-acquired storage path information; wherein the storage path information is set according to the pre-acquired namespace information, and each namespace information is unique; Based on the cache file name information, create the target cache folder for each application component within the image loading library; The method of obtaining management class data for each application component includes: Obtain the management class creation data for each of the application components; wherein, the management class creation data includes: target namespace information; A management class is created for the target namespace information to obtain the target management class for each application component. The target management class is invoked to obtain the management class data of the application component; wherein, the target management class data is used to manage the image data cache of multiple application components.

8. A computer device, characterized in that, The computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the image data caching method according to any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the image data caching method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Operating system cache file processing method

    CN113626391A