Resource caching method and device, computer equipment and storage medium

By receiving resource access requests in the cache space, judging the existence of resources, and accurately controlling the memory footprint, the problem of inaccurate measurement of the memory footprint in the cache space in the prior art is solved, and the efficiency of resource caching is improved.

CN119690646AActive Publication Date: 2025-03-25NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411680130.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-03-25
Estimated Expiration
2044-11-21

AI Technical Summary

Technical Problem

In the prior art, using the number of resources as the threshold of the cache space cannot accurately measure the actual memory footprint of the current cache space, resulting in resource cache failure.

Method used

By receiving resource access requests, we judge whether the target resource and shared resources exist in the cache space. If not, we obtain the remaining memory space of the cache space and the total memory footprint of the target resource and shared resources. If the total memory footprint exceeds the remaining memory space, remove the cache space resource until the total memory footprint does not exceed the remaining memory space. Then add the target resource and shared resources to the cache space and generate reference information for the shared resource.

Benefits of technology

Improve the resource caching efficiency of storage space, ensure precise control of the memory space of the cache space, and avoid resource caching failure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690646A_ABST
    Figure CN119690646A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a resource caching method and device, computer equipment and a storage medium. According to the scheme, the resource access request is received, and whether the target resource indicated to be accessed by the resource access request and the first shared resource needing to be referenced by the target resource exist in the cache space or not is determined; if the target resource and the first shared resource do not exist in the cache space, obtaining the remaining memory space of the current cache space, and obtaining the total memory occupation size corresponding to the target resource and the first shared resource; if the total memory occupation size exceeds the residual memory space, removing resources in the cache space until the total memory occupation size does not exceed the residual memory space of the cache space after the resources are removed; and adding the target resource and the first shared resource into the cache space, and generating reference information of the first shared resource in the storage space. Therefore, the resource caching efficiency of the storage space can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a resource caching method, device, computer equipment and storage medium. Background Art

[0002] The LRU (Least Recently Used) algorithm is a commonly used cache eviction strategy. The core idea is that if the data has been accessed recently, it is more likely to be accessed in the future. Therefore, when the cache space is full, the least recently used cache data will be eliminated first.

[0003] In related technologies, the LRU algorithm usually uses the number of resources as the threshold of the cache space, that is, whether the cache space can continue to cache resources depends on the result of comparing the number of resources currently cached in the space with the set maximum number of storage resources. However, using the number of resources as the threshold often cannot accurately measure the actual memory usage of the current cache space, which may lead to resource caching failure. Summary of the invention

[0004] The embodiments of the present application provide a resource caching method, apparatus, computer equipment, and storage medium, which can improve the resource caching efficiency of storage space.

[0005] The present application provides a resource caching method, including:

[0006] Receive a resource access request, and determine whether a target resource to be accessed by the resource access request and a first shared resource that the target resource needs to reference exist in a cache space;

[0007] If the target resource and the first shared resource do not exist in the cache space, obtaining the remaining memory space of the current cache space, and obtaining the total memory occupied size corresponding to the target resource and the first shared resource;

[0008] If the total memory occupancy size exceeds the remaining memory space, the resources in the cache space are removed until the total memory occupancy size does not exceed the remaining memory space of the cache space after the resources are removed;

[0009] The target resource and the first shared resource are added to the cache space, and reference information of the first shared resource in the storage space is generated, where the reference information is used to perform storage management on the first shared resource in the cache space.

[0010] Accordingly, the embodiment of the present application further provides a resource cache device, including:

[0011] A receiving unit, configured to receive a resource access request, and determine whether a target resource to be accessed by the resource access request and a first shared resource to be referenced by the target resource exist in a cache space;

[0012] A first acquisition unit, configured to acquire the remaining memory space of the current cache space and the total memory occupied size corresponding to the target resource and the first shared resource if the target resource and the first shared resource do not exist in the cache space;

[0013] A first operating unit, configured to remove resources in the cache space if the total memory occupation size exceeds the remaining memory space, until the total memory occupation size does not exceed the remaining memory space of the cache space after the resources are removed;

[0014] The first adding unit is used to add the target resource and the first shared resource to the cache space, and generate reference information of the first shared resource in the storage space, wherein the reference information is used to store and manage the first shared resource in the cache space.

[0015] Correspondingly, an embodiment of the present application further provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes any resource caching method provided in any embodiment of the present application.

[0016] Correspondingly, an embodiment of the present application further provides a storage medium, which stores a plurality of instructions, and the instructions are suitable for loading by a processor to execute the above resource caching method.

[0017] The embodiment of the present application receives a resource access request, determines whether the target resource accessed by the resource access request and the first shared resource that the target resource needs to reference exist in the cache space; if the target resource and the first shared resource do not exist in the cache space, obtains the remaining memory space of the current cache space, and obtains the total memory occupied size corresponding to the target resource and the first shared resource; if the total memory occupied size exceeds the remaining memory space, removes the resources in the cache space until the total memory occupied size does not exceed the remaining memory space of the cache space after the resources are removed; adds the target resource and the first shared resource to the cache space, and generates reference information of the first shared resource in the storage space, and the reference information is used to store and manage the first shared resource in the cache space. In this way, the resource cache efficiency of the storage space can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0019] Figure 1 A flowchart of a resource caching method provided in an embodiment of the present application.

[0020] Figure 2 A flowchart of another resource caching method provided in an embodiment of the present application.

[0021] Figure 3 A flowchart of another resource caching method provided in an embodiment of the present application.

[0022] Figure 4 A structural block diagram of a resource caching device provided in an embodiment of the present application.

[0023] Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0025] The embodiments of the present application provide a resource caching method, apparatus, storage medium and computer equipment. Specifically, the resource caching method of the embodiments of the present application can be executed by a computer device, wherein the computer device can be a server or other equipment. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0026] For example, the computer device may be a server, which may receive a resource access request, determine whether a target resource indicated by the resource access request and a first shared resource that the target resource needs to reference exist in the cache space; if the target resource and the first shared resource do not exist in the cache space, obtain the remaining memory space of the current cache space, and obtain the total memory occupancy size corresponding to the target resource and the first shared resource; if the total memory occupancy size exceeds the remaining memory space, remove the resources in the cache space until the total memory occupancy size does not exceed the remaining memory space of the cache space after the resources are removed; add the target resource and the first shared resource to the cache space, and generate reference information of the first shared resource in the storage space, the reference information being used for storage management of the first shared resource in the cache space.

[0027] Based on the above problems, the embodiments of the present application provide a first resource caching method, apparatus, computer device and storage medium, which can improve the resource caching efficiency of the storage space.

[0028] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0029] The embodiment of the present application provides a resource caching method, which can be executed by a terminal or a server. The embodiment of the present application takes the resource caching method executed by a server as an example for explanation.

[0030] like Figure 1 As shown, Figure 1 A schematic diagram of a resource caching method provided in an embodiment of the present application. The specific process of the resource caching method may be as follows:

[0031] 101. Receive a resource access request, and determine whether a target resource indicated by the resource access request to be accessed and a first shared resource that the target resource needs to reference exist in a cache space.

[0032] Among them, a resource access request refers to a request sent by a user or system entity to a resource provider or manager to obtain access rights to a specific resource or to perform a certain operation.

[0033] Among them, resources may include files, databases, API interfaces, network services, etc.

[0034] In the embodiment of the present application, the resource access request may be used to indicate access to a target resource.

[0035] The first shared resource refers to a resource referenced and used by the target resource, that is, there is a reference relationship between the first shared resource and the target resource.

[0036] Specifically, the reference relationship between resources refers to the mutual dependence or association between different resources. Resource reference usually refers to the explicit mention or dependence of another resource in one resource. This reference can be direct or indirect. A direct reference refers to a direct reference to the name or identifier of another resource in one resource; while an indirect reference refers to a reference to the target resource through one or more intermediate resources. The reference relationship between resources can be divided into many types, including but not limited to: dependency relationship, association relationship, inclusion relationship, etc.

[0037] Among them, dependency refers to a resource that must rely on another resource to work properly or exist. For example, in software development, an application may rely on a specific library or framework to run; association refers to a logical connection between two resources, but not necessarily a direct dependency. For example, two database tables may establish an association relationship through a foreign key; inclusion refers to a resource that contains another resource as its sub-resource. For example, a folder may contain multiple files and sub-folders.

[0038] For example, the target resource may be user interface node resource A, which references texture resource B and material resource C. Then, texture resource B and material resource C may be used as the first shared resources corresponding to the target resource.

[0039] In some embodiments, a shared resource refers to a resource that can be commonly referenced by multiple resources.

[0040] Cache space refers to storage space used to store temporary data, usually located in memory or cache. The functions of cache space can include: reducing data access time and improving system performance. By storing frequently accessed data in cache, the system can quickly access this data when needed without having to retrieve it from slower storage media (such as hard disks).

[0041] In the embodiment of the present application, when a resource access request is received, it can be determined whether the target resource indicated by the resource access request to be accessed and the first shared resource exist in the cache space.

[0042] 102. If the target resource and the first shared resource do not exist in the cache space, obtain the remaining memory space of the current cache space, and obtain the total memory occupation size corresponding to the target resource and the first shared resource.

[0043] The remaining memory space of the current cache space refers to the size of the storage space in the cache space that has not been occupied by data or files.

[0044] The total memory usage refers to the sum of the memory usage of the target resource and the memory usage of the first shared resource. For example, if the memory usage of the target resource is m and the memory usage of the first shared resource is n, the total memory usage is m+n.

[0045] The memory usage size refers to the size of the storage space occupied by the resource.

[0046] In some embodiments, if the target resource and the first shared resource exist in the cache space, the target resource and the first shared resource can be directly accessed from the cache space. At the same time, since the cache space is managed based on the LRU algorithm, the positions of the target resource and the first shared resource in the cache space can be updated to the head position.

[0047] The header position of the cache space generally refers to the starting address or position of the cache data structure or cache block in the memory.

[0048] 103. If the total memory usage exceeds the remaining memory space, remove the resources in the cache space until the total memory usage does not exceed the remaining memory space of the cache space after the resources are removed.

[0049] The total memory usage exceeds the remaining memory space, which means that the cache space currently does not support the storage of the target resource and the first shared resource. At this time, the resources in the cache space need to be removed so that the cache space supports the storage of the target resource and the first shared resource.

[0050] In some embodiments, in order to achieve accurate control of the memory usage of the cache space, the step of “removing resources from the cache space” may include the following operations:

[0051] Determine a first resource located at the end of the cache space and a first memory occupation size of the first resource;

[0052] The first resource is removed from the cache space, and based on the first memory occupation size and the current remaining memory space, the remaining memory space of the cache space after the removal is determined;

[0053] If the total memory usage size exceeds the remaining memory space of the cache space after removal, the new first resource located at the end position is continuously selected from the cache space for removal until the total memory usage size does not exceed the remaining memory space of the cache space after removal.

[0054] In the embodiment of the present application, since the cache space is managed based on the LRU algorithm, when removing resources in the cache space, the resources can be removed starting from the end position of the cache space.

[0055] The end position of the cache space is the end address or position of the cache data structure or cache block in the memory.

[0056] The first resource refers to the resource stored in the cache space, and the first memory occupation size refers to the size of the storage space occupied by the first resource.

[0057] In some embodiments, determining the remaining memory space of the cache space after removal based on the first memory occupancy size and the current remaining memory space may include: adding the current remaining memory space to the first memory occupancy size to obtain a new remaining memory space as the remaining memory space of the cache space after removal.

[0058] Furthermore, the total memory occupancy size is continued to be compared with the remaining memory space of the cache space after removal. If the total memory occupancy size still exceeds the remaining memory space of the cache space after removal, a new first resource at the end position can be further determined from the cache space and removed.

[0059] Then, the remaining memory space of the cache space after removal is added to the memory occupied by the new first resource to obtain a new remaining memory space. When the total memory occupied size does not exceed the new remaining memory space, the resource removal operation in the cache space can be terminated.

[0060] In some embodiments, in order to avoid repeated calculation of the memory footprint of the shared resource, the method may further include the following steps:

[0061] If the second shared resource referenced by the first resource exists in the cache space, obtaining reference information of the second shared resource;

[0062] After the first resource is moved out of the cache space, the reference information of the second shared resource is updated according to the first resource.

[0063] The second shared resource refers to a resource in the cache space that is referenced and used by the first resource, that is, there is a reference relationship between the second shared resource and the first resource.

[0064] In an embodiment of the present application, the reference information of the shared resource may include a reference count corresponding to the shared resource, and the reference count is the number of other resources in the cache space that reference the shared resource.

[0065] Acquiring the reference information of the second shared resource may include: determining the number of references to the second shared resource from the cache space, and obtaining a reference count of the second shared resource.

[0066] Specifically, after the first resource is moved out of the cache space, the number of references to the second shared resource in the cache space decreases by one, and the number of reference counts of the second shared resource may be reduced by one.

[0067] For example, the reference information of the second shared resource includes: the number of other resources in the cache space that reference the shared resource is: 5. After the first resource is moved out of the cache space, the number 5 in the reference information of the second shared resource can be subtracted from 1, and the updated reference information of the second shared resource is: the number of other resources in the cache space that reference the shared resource is: 4.

[0068] In some embodiments, in order to implement management of shared resources in the cache space based on reference information, the method may further include the following steps:

[0069] If the quantity in the updated reference information of the second shared resource is zero, the second shared resource is removed from the cache space;

[0070] A second memory occupation size corresponding to the second shared resource is obtained, and based on the second memory occupation size, the second memory occupation size, and the current remaining memory space, the remaining memory space of the cache space after the removal is determined.

[0071] The number in the updated reference information of the second shared resource is zero, indicating that there are no other resources in the cache space that reference the second shared resource. At this time, in order to save memory usage of the cache space, the second shared resource can be moved out of the cache space.

[0072] Since the second shared resource is moved out of the cache space, the remaining memory space of the cache space needs to be updated at the same time.

[0073] The second memory occupation size refers to the size of the storage space occupied by the second shared resource.

[0074] In some embodiments, determining the remaining memory space of the cache space after removal based on the second memory occupied size, the second memory occupied size and the current remaining memory space may include: adding the current remaining memory space to the second memory occupied size and the second memory occupied size to obtain the remaining memory space of the cache space after removal.

[0075] In some embodiments, multithreading is used to implement asynchronous loading for some resources. In order to avoid the situation where the shared resource has not been loaded when the memory usage size of the shared resource is obtained, and the accurate memory usage size cannot be obtained, the method can obtain the status of the shared resource before obtaining the memory usage size of the shared resource, that is, it can include the following steps:

[0076] Determine whether the second shared resource has been loaded;

[0077] If the second shared resource is loaded, determining whether the second shared resource is loaded successfully;

[0078] If the second shared resource is successfully loaded, obtaining a second memory occupied size of the second shared resource;

[0079] The reference relationship between the first resource and the second shared resource is stored in a preset resource relationship table, and the second memory occupation size of the second shared resource is stored in the preset resource memory table.

[0080] The completion of resource loading means that the resource loading process has ended, that is, the resource has been loaded into the system or application. When the resource is loaded, the resource may be available, but it may also require further initialization or processing before it can be used. To determine whether the resource is loaded, you can listen to the loading event or check the loading status to determine whether the resource is loaded.

[0081] The successful loading of resources means that the resources are not only loaded into the system or application, but also no errors or exceptions occur during the loading process, and the resources can be used normally. Successfully loaded resources usually have passed all necessary verification and initialization steps and can be used directly by the application. In addition to detecting the loading completion status, it is also necessary to check whether the resources are complete, valid, and meet expectations.

[0082] For example, the information of resource A records that it references shared resource B. When loading shared resource B, if it is detected that the file corresponding to shared resource B exists, for example, resource A indicates that it uses the file D: / pictures / b.png, and the b.png file exists in the D: / pictures directory, then the resource is successfully loaded; if it is detected that the file corresponding to shared resource B does not exist, for example, resource A indicates that it uses the file D: / pictures / b.png, and the b.png file does not exist in the D: / pictures directory, then the resource is not successfully loaded.

[0083] In an embodiment of the present application, when a resource is successfully loaded, the memory size of the resource can be calculated, and then the memory size of the resource can be stored to indicate that the resource is successfully loaded, and the memory size of the resource can be directly obtained.

[0084] The preset resource relationship table may be used to store reference relationships between resources, that is, includes reference relationships between resources in the cache space and shared resources.

[0085] For example, the preset resource relationship table includes: a reference relationship between resource A1 and shared resource A; a reference relationship between resource B1 and shared resource A, and so on.

[0086] The preset resource memory table may be used to store the memory usage size of the shared resources in the cache space.

[0087] For example, the preset resource memory table includes: the memory occupied by shared resource A: m; the memory occupied by shared resource B: n, and so on.

[0088] For example, see Figure 2 , Figure 2 A flowchart of another resource caching method provided for an embodiment of the present application. The steps of obtaining the status of a shared resource may include: first, traversing the shared resources referenced by the resource, that is, determining the shared resources for which status information needs to be obtained, for example, the second shared resource referenced by the first resource; then, determining whether the shared resource has been loaded, if the shared resource has been loaded, further determining whether the shared resource has been loaded successfully, if the shared resource has been loaded successfully, then the application relationship between the shared resource and the resource that references the shared resource may be stored in a preset resource relationship table, and the memory usage size corresponding to the shared resource may be stored in a preset resource memory table.

[0089] In some embodiments, after a shared resource is successfully loaded, the reference relationship between the shared resource and the resource that references the shared resource is stored in a preset resource relationship table, which can facilitate subsequent acquisition of the reference information of the shared resource from the preset resource relationship table and update of the reference information.

[0090] In some embodiments, the method may further include the following steps:

[0091] If the second shared resource has not been loaded, the second shared resource is added to the to-be-loaded list;

[0092] Waiting for the second shared resource to be loaded.

[0093] The to-be-loaded list is used to store shared resources that have not been loaded yet.

[0094] In an embodiment of the present application, a to-be-loaded list is created, which can be used to store shared resources that have not been loaded completely in the cache space.

[0095] For example, see Figure 2 , wherein, when the shared resource is not loaded, the shared resource can be added to the list to be loaded. The loading of the shared resource can be continued until the shared resource is successfully loaded, and the information of the shared resource is stored in the preset resource relationship table and the preset resource memory table, or until the shared resource fails to load, and the information of the shared resource is removed from the cache space. At the same time, the resources that reference the shared resource can also be stored in the resource list corresponding to the shared resource, so as to be used for subsequent calculation of the reference information of the shared resource.

[0096] In some embodiments, if the second shared resource is not loaded successfully, that is, the second shared resource does not exist, the second shared resource may be ignored and not processed.

[0097] In some embodiments, the step of “obtaining the second memory usage size corresponding to the second shared resource” may include the following operations:

[0098] The second memory occupation size corresponding to the second shared resource is obtained from the preset resource memory table.

[0099] In an embodiment of the present application, the shared resources stored in the preset resource memory table are shared resources that are successfully loaded, and the memory usage size of the shared resources can be accurately obtained from the preset resource memory table to update the storage space of the cache space.

[0100] In some embodiments, in order to avoid invalid traversal of the shared resources to be loaded during the process of updating the reference information of the shared resources, the method may update the list of resources to be loaded before each access to the resources, which may specifically include the following steps:

[0101] Traverse the list to be loaded to determine whether the shared resources to be loaded in the list to be loaded have been loaded;

[0102] If the shared resource to be loaded is loaded, determining whether the shared resource to be loaded is loaded successfully;

[0103] If the shared resource to be loaded is loaded successfully, the shared resource to be loaded is removed from the to-be-loaded list, and the reference relationship between the shared resource to be loaded and the reference to the shared resource to be loaded is stored in the preset resource relationship table.

[0104] For example, see Figure 3 , Figure 3 A flowchart of another resource caching method provided for an embodiment of the present application. The step of obtaining the status of a shared resource may include: first, traversing the shared resources to be loaded in the to-be-loaded list; then, determining whether the shared resource has been loaded, if the shared resource has been loaded, further determining whether the shared resource has been loaded successfully, if the shared resource has been loaded successfully, the shared resource to be loaded may be removed from the to-be-loaded list, and at the same time, according to the resource list corresponding to the shared resource in the above steps, the reference relationship between the shared resource to be loaded and the reference to the shared resource to be loaded is stored in a preset resource relationship table.

[0105] If the shared resource to be loaded has not been loaded completely, you can continue to wait for loading; if the shared resource to be loaded has been loaded completely but not successfully, it means that the shared resource does not exist, and you can ignore the shared resource and do not process it.

[0106] Specifically, by updating the list of resources to be loaded, invalid traversal of shared resources to be loaded can be avoided in the process of updating the reference count of shared resources (the successfully loaded shared resources are recorded in the data structure of the mapping relationship between "resources and their shared resource list"), thereby reducing the performance overhead of the algorithm itself.

[0107] In some embodiments, since a preset resource relationship table is created to store the reference relationship between the resource in the cache space and the shared resource, the step of "updating the reference information of the second shared resource according to the first resource" may include the following operations:

[0108] Remove the reference relationship between the first resource and the second shared resource from the preset resource relationship table;

[0109] Based on the number of resources in the removed preset resource relationship table that have a reference relationship with the second shared resource, updated reference information of the second shared resource is obtained.

[0110] Specifically, since the first resource is moved out of the cache space, there is no reference relationship between the first resource and the second shared resource in the cache space, and thus the reference relationship between the first resource and the second shared resource can be removed from the preset resource relationship table.

[0111] Among them, based on the number of resources that have a reference relationship with the second shared resource in the preset resource relationship table after removal, that is, from the preset resource relationship table after removal, the number of resources that have a reference relationship with the second shared resource is obtained as the updated reference information of the second shared concept stock resource.

[0112] In some embodiments, the method may further include the following steps:

[0113] If the total memory occupation size does not exceed the remaining memory space, the target resource and the first shared resource are added to the cache space, and reference information of the first shared resource is determined based on the target resource.

[0114] The total memory usage size does not exceed the remaining memory space, which means that the cache space currently supports the storage of the target resource and the first shared resource. Therefore, the target resource and the first shared resource can be directly added to the cache space for storage.

[0115] In some embodiments, since the present solution manages the cache space based on the LRU algorithm, adding the target resource and the first shared resource to the cache space may include: adding the target resource and the first shared resource to the head position in the cache space.

[0116] Among them, determining the reference information of the first shared resource based on the target resource may include: determining that the resources in the cache space that reference the first shared resource include: the target resource, that is, the number of references to the first shared resource is 1, then the reference count of the first shared resource can be generated as: 1, as the reference information of the first shared resource.

[0117] In some embodiments, the method may further include the following steps:

[0118] If the target resource does not exist in the cache space, and the first shared resource exists in the cache space, obtaining the remaining memory space of the current cache space, the third memory occupied size corresponding to the target resource, and the existing reference information of the first shared resource;

[0119] If the third memory occupancy size exceeds the remaining memory space, remove the resources in the cache space until the third memory occupancy size does not exceed the remaining memory space of the cache space after the resources are removed;

[0120] The target resource is added to the cache space, and the existing reference information of the first shared resource is updated based on the target resource.

[0121] The existence of the first shared resource in the cache space may indicate that the first shared resource has corresponding reference information in the cache space, that is, the existing reference information of the first shared resource, which includes the number of references to the first shared resource in the cache space, that is, the reference count corresponding to the first shared resource.

[0122] In some embodiments, resources having a reference relationship with the first shared resource may be obtained from a preset resource relationship table, and then a reference count corresponding to the first shared resource may be determined to obtain existing reference information corresponding to the first shared resource.

[0123] The third memory occupation size refers to the size of the storage space occupied by the target resource.

[0124] Specifically, the third memory occupancy size can be compared with the remaining memory space of the cache space. If the third memory occupancy size exceeds the remaining memory space, it means that the buffer space currently does not support the storage of the target resource, and the resource in the cache space needs to be removed.

[0125] In some embodiments, the step of “removing resources from the cache space until the third memory usage size does not exceed the remaining memory space of the cache space after the resources are removed” may include the following operations:

[0126] Determine a second resource located at the end of the cache space and a fourth memory occupation size of the second resource;

[0127] The second resource is removed from the cache space, and based on the fourth memory occupation size and the current remaining memory space, the remaining memory space of the cache space after the removal is determined;

[0128] If the total memory usage size exceeds the remaining memory space of the cache space after removal, the new second resource located at the end position is continuously selected from the cache space for removal until the total memory usage size does not exceed the remaining memory space of the cache space after removal.

[0129] In the embodiment of the present application, an LRU algorithm may be used to manage the cache space, that is, when removing resources from the cache space, the resources may be removed starting from the end of the cache space.

[0130] Further, when the third memory occupation size does not exceed the remaining memory space of the cache space after the resource is removed, the target resource may be added to the cache space, and the existing reference information of the first shared resource may be updated based on the target resource.

[0131] In some embodiments, since the present solution manages the cache space based on the LRU algorithm, adding the target resource to the cache space may include: adding the target resource to the head position in the cache space.

[0132] Among them, updating the existing reference information of the first shared resource based on the target resource may include: saving the reference relationship between the target resource and the first shared resource in a preset resource relationship table, and then re-obtaining the reference count corresponding to the first shared resource from the preset resource relationship table as the updated existing reference information of the first shared resource.

[0133] 104. Add the target resource and the first shared resource to the cache space, and generate reference information of the first shared resource in the storage space, where the reference information is used to perform storage management on the first shared resource in the cache space.

[0134] Specifically, when resources in the cache space are removed so that the remaining memory space of the cache space exceeds the total memory occupied by the target resource and the first shared resource, it means that the cache space supports the storage of the target resource and the first shared resource. Then, the target resource and the first shared resource can be added to the cache space.

[0135] In some embodiments, since the present solution manages the cache space based on the LRU algorithm, adding the target resource and the first shared resource to the cache space may include: adding the target resource and the first shared resource to the head position in the cache space.

[0136] Among them, generating reference information of the first shared resource in the storage empty space may include: it may include: determining that the resources in the cache space that reference the first shared resource include: the target resource, that is, the number of references to the first shared resource is 1, then the reference count of the first shared resource can be generated as: 1, as the reference information of the first shared resource.

[0137] Specifically, the resource caching method provided by this solution, based on the LRU algorithm, achieves precise control of the memory space of the cache space by calculating the memory occupied by the resource and adding reference counts to the shared resources.

[0138] The embodiment of the present application discloses a resource caching method, which includes: receiving a resource access request, determining whether the target resource indicated by the resource access request and the first shared resource that the target resource needs to reference exist in the cache space; if the target resource and the first shared resource do not exist in the cache space, obtaining the remaining memory space of the current cache space, and obtaining the total memory occupied size corresponding to the target resource and the first shared resource; if the total memory occupied size exceeds the remaining memory space, removing the resources in the cache space until the total memory occupied size does not exceed the remaining memory space of the cache space after the resources are removed; adding the target resource and the first shared resource to the cache space, and generating reference information of the first shared resource in the storage space, the reference information is used to store and manage the first shared resource in the cache space. In this way, the resource caching efficiency of the storage space can be improved.

[0139] To facilitate better implementation of the resource caching method provided in the embodiment of the present application, the embodiment of the present application also provides a resource caching device based on the resource caching method. The meanings of the terms are the same as those in the resource caching method, and the specific implementation details can refer to the description in the method embodiment.

[0140] See also Figure 4 , Figure 4 A structural block diagram of a resource cache device provided in an embodiment of the present application, the device comprising:

[0141] The receiving unit 301 is used to receive a resource access request, and determine whether a target resource to be accessed by the resource access request and a first shared resource to be referenced by the target resource exist in a cache space;

[0142] A first acquisition unit 302 is configured to acquire the remaining memory space of the current cache space and the total memory occupied size corresponding to the target resource and the first shared resource if the target resource and the first shared resource do not exist in the cache space;

[0143] A first operating unit 303 is configured to remove resources in the cache space if the total memory occupancy exceeds the remaining memory space, until the total memory occupancy does not exceed the remaining memory space of the cache space after the resources are removed;

[0144] The first adding unit 304 is used to add the target resource and the first shared resource to the cache space, and generate reference information of the first shared resource in the storage space, wherein the reference information is used to store and manage the first shared resource in the cache space.

[0145] In some embodiments, the first operation unit 303 may include:

[0146] A first determining subunit, configured to determine a first resource located at the end of the cache space and a first memory occupation size of the first resource;

[0147] A first removal subunit, configured to remove the first resource from the cache space, and determine a remaining memory space of the cache space after the removal based on the first memory occupation size and a current remaining memory space;

[0148] The first removal subunit is used to continue selecting a new first resource located at the end position from the cache space for removal if the total memory occupancy size exceeds the remaining memory space of the cache space after removal, until the total memory occupancy size does not exceed the remaining memory space of the cache space after removal.

[0149] In some embodiments, the apparatus may further include:

[0150] A second acquiring unit, configured to acquire reference information of a second shared resource if the second shared resource referenced by the first resource exists in the cache space;

[0151] An updating unit is used to update the reference information of the second shared resource according to the first resource after the first resource is moved out of the cache space.

[0152] In some embodiments, the reference information of the second shared resource includes the number of resources corresponding to the second shared resource in the cache space;

[0153] The device may also include:

[0154] a second removal subunit, configured to remove the second shared resource from the cache space if the quantity in the updated reference information of the second shared resource is zero;

[0155] The acquisition subunit is used to acquire the second memory occupation size corresponding to the second shared resource, and determine the remaining memory space of the cache space after the removal based on the second memory occupation size, the second memory occupation size and the current remaining memory space.

[0156] In some embodiments, the apparatus may further include:

[0157] A first determining unit, configured to determine whether the second shared resource has been loaded;

[0158] A second determining unit, configured to determine whether the second shared resource is loaded successfully if the loading of the second shared resource is completed;

[0159] A third acquisition unit, configured to acquire a second memory usage size of the second shared resource if the second shared resource is successfully loaded;

[0160] A storage unit, used to store the reference relationship between the first resource and the second shared resource in a preset resource relationship table, and to store the second memory occupancy size of the second shared resource in a preset resource memory table, wherein the preset resource relationship table is used to store the reference relationship between resources, and the preset resource memory table is used to store the memory occupancy size of resources.

[0161] In some embodiments, the acquisition subunit may be specifically used for:

[0162] A second memory occupancy size corresponding to the second shared resource is obtained from the preset resource memory table.

[0163] In some embodiments, the apparatus may further include:

[0164] A second adding unit, configured to add the second shared resource to a to-be-loaded list if the second shared resource has not been loaded completely, wherein the to-be-loaded list is used to store the shared resources that have not been loaded completely;

[0165] A waiting unit is used to wait for the loading of the second shared resource.

[0166] In some embodiments, the apparatus may further include:

[0167] A traversal unit, used for traversing the to-be-loaded list to determine whether the to-be-loaded shared resources in the to-be-loaded list have been loaded;

[0168] A third determining unit, configured to determine whether the shared resource to be loaded is successfully loaded if the loading of the shared resource to be loaded is completed;

[0169] The removal unit is used to remove the shared resource to be loaded from the to-be-loaded list if the shared resource to be loaded is successfully loaded, and store the reference relationship between the shared resource to be loaded and the reference to the shared resource to be loaded in the preset resource relationship table.

[0170] In some embodiments, the updating unit may include:

[0171] A second removing subunit, configured to remove a reference relationship between the first resource and the second shared resource from the preset resource relationship table;

[0172] The second determining subunit is configured to obtain updated reference information of the second shared resource based on the number of resources in the removed preset resource relationship table that have a reference relationship with the second shared resource.

[0173] In some embodiments, the apparatus may further include:

[0174] The third adding unit is configured to add the target resource and the first shared resource to the cache space if the total memory occupation size does not exceed the remaining memory space, and determine reference information of the first shared resource based on the target resource.

[0175] In some embodiments, the apparatus may further include:

[0176] a fourth acquisition unit, configured to acquire, if the target resource does not exist in the cache space and the first shared resource exists in the cache space, the remaining memory space of the current cache space, the third memory occupation size corresponding to the target resource, and the existing reference information of the first shared resource;

[0177] A second operating unit is configured to remove resources in the cache space if the third memory occupation size exceeds the remaining memory space, until the third memory occupation size does not exceed the remaining memory space of the cache space after the resources are removed;

[0178] A fourth adding unit is configured to add the target resource to the cache space, and update the existing reference information of the first shared resource based on the target resource.

[0179] The embodiment of the present application discloses a resource cache device, which receives a resource access request through a receiving unit 301, determines whether the target resource indicated by the resource access request and the first shared resource that the target resource needs to reference exist in the cache space; if the target resource and the first shared resource do not exist in the cache space, the first acquisition unit 302 acquires the remaining memory space of the current cache space, and acquires the total memory occupied size corresponding to the target resource and the first shared resource; if the total memory occupied size exceeds the remaining memory space, the first operation unit 303 removes the resources in the cache space until the total memory occupied size does not exceed the remaining memory space of the cache space after the resources are removed; the first adding unit 304 adds the target resource and the first shared resource to the cache space, and generates reference information of the first shared resource in the storage space, and the reference information is used to store and manage the first shared resource in the cache space. In this way, the resource cache efficiency of the storage space can be improved.

[0180] Accordingly, the embodiment of the present application also provides a computer device, which may be a server. Figure 5 As shown, Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device 400 includes a processor 401 having one or more processing cores, a memory 402 having one or more computer-readable storage media, and a computer program stored in the memory 402 and executable on the processor. The processor 401 is electrically connected to the memory 402. It will be understood by those skilled in the art that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0181] The processor 401 is the control center of the computer device 400. It uses various interfaces and lines to connect the various parts of the entire computer device 400, executes various functions of the computer device 400 and processes data by running or loading software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, thereby monitoring the computer device 400 as a whole.

[0182] In the embodiment of the present application, the processor 401 in the computer device 400 will load instructions corresponding to the processes of one or more application programs into the memory 402 according to the following steps, and the processor 401 will run the application programs stored in the memory 402 to implement various functions:

[0183] Receive a resource access request, and determine whether a target resource indicated by the resource access request and a first shared resource that the target resource needs to reference exist in the cache space;

[0184] If the target resource and the first shared resource do not exist in the cache space, obtain the remaining memory space of the current cache space, and obtain the total memory occupied size corresponding to the target resource and the first shared resource;

[0185] If the total memory usage exceeds the remaining memory space, the resources in the cache space are removed until the total memory usage does not exceed the remaining memory space of the cache space after the resources are removed;

[0186] The target resource and the first shared resource are added to the cache space, and reference information of the first shared resource in the storage space is generated, where the reference information is used to perform storage management on the first shared resource in the cache space.

[0187] The embodiment of the present application receives a resource access request, determines whether the target resource accessed by the resource access request and the first shared resource that the target resource needs to reference exist in the cache space; if the target resource and the first shared resource do not exist in the cache space, obtains the remaining memory space of the current cache space, and obtains the total memory occupied size corresponding to the target resource and the first shared resource; if the total memory occupied size exceeds the remaining memory space, removes the resources in the cache space until the total memory occupied size does not exceed the remaining memory space of the cache space after the resources are removed; adds the target resource and the first shared resource to the cache space, and generates reference information of the first shared resource in the storage space, and the reference information is used to store and manage the first shared resource in the cache space. In this way, the resource cache efficiency of the storage space can be improved.

[0188] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0189] Optional, such as Figure 5 As shown, the computer device 400 further includes: a touch screen 403, a radio frequency circuit 404, an audio circuit 405, an input unit 406, and a power supply 407. The processor 401 is electrically connected to the touch screen 403, the radio frequency circuit 404, the audio circuit 405, the input unit 406, and the power supply 407, respectively. Those skilled in the art can understand that Figure 5 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0190] The touch display screen 403 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 403 may include a display panel and a touch panel. Among them, the display panel may be used to display information input by the user or information provided to the user and various graphical user interfaces of the computer device, and these graphical user interfaces may be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light emitting diode (OLED, Organic Light-Emitting Diode) and the like. The touch panel may be used to collect the user's touch operation on or near it (such as the user using any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 401, and can receive the command sent by the processor 401 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 401 to determine the type of touch event, and then the processor 401 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 403 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 403 can also be used as a part of the input unit 406 to realize the input function.

[0191] In the embodiment of the present application, the processor 401 executes the game application to generate a graphical user interface on the touch screen 403. The virtual scene on the graphical user interface includes at least one skill control area, and the skill control area includes at least one skill control. The touch screen 403 is used to present the graphical user interface and receive operation instructions generated by the user acting on the graphical user interface.

[0192] The radio frequency circuit 404 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other computer devices through wireless communication, and to send and receive signals between the network device or other computer devices.

[0193] The audio circuit 405 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 405 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 405 and converted into audio data, and then the audio data is output to the processor 401 for processing, and then sent to another computer device through the radio frequency circuit 404, or the audio data is output to the memory 402 for further processing. The audio circuit 405 may also include an earphone jack to provide communication between an external headset and the computer device.

[0194] The input unit 406 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0195] The power supply 407 is used to supply power to various components of the computer device 400. Optionally, the power supply 407 can be logically connected to the processor 401 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 407 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0196] although Figure 5 Not shown, the computer device 400 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.

[0197] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0198] As can be seen from the above, the computer device provided in this embodiment can receive a resource access request, determine whether the target resource indicated by the resource access request and the first shared resource that the target resource needs to reference exist in the cache space; if the target resource and the first shared resource do not exist in the cache space, obtain the remaining memory space of the current cache space, and obtain the total memory occupancy size corresponding to the target resource and the first shared resource; if the total memory occupancy size exceeds the remaining memory space, remove the resources in the cache space until the total memory occupancy size does not exceed the remaining memory space of the cache space after the resources are removed; add the target resource and the first shared resource to the cache space, and generate reference information of the first shared resource in the storage space, and the reference information is used to store and manage the first shared resource in the cache space.

[0199] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0200] To this end, an embodiment of the present application provides a computer-readable storage medium, in which multiple computer programs are stored, and the computer program can be loaded by a processor to execute the steps in any resource caching method provided in the embodiment of the present application. For example, the computer program can execute the following steps:

[0201] Receive a resource access request, and determine whether a target resource indicated by the resource access request and a first shared resource that the target resource needs to reference exist in the cache space;

[0202] If the target resource and the first shared resource do not exist in the cache space, obtain the remaining memory space of the current cache space, and obtain the total memory occupied size corresponding to the target resource and the first shared resource;

[0203] If the total memory usage exceeds the remaining memory space, the resources in the cache space are removed until the total memory usage does not exceed the remaining memory space of the cache space after the resources are removed;

[0204] The target resource and the first shared resource are added to the cache space, and reference information of the first shared resource in the storage space is generated, where the reference information is used to perform storage management on the first shared resource in the cache space.

[0205] The embodiment of the present application receives a resource access request, determines whether the target resource accessed by the resource access request and the first shared resource that the target resource needs to reference exist in the cache space; if the target resource and the first shared resource do not exist in the cache space, obtains the remaining memory space of the current cache space, and obtains the total memory occupied size corresponding to the target resource and the first shared resource; if the total memory occupied size exceeds the remaining memory space, removes the resources in the cache space until the total memory occupied size does not exceed the remaining memory space of the cache space after the resources are removed; adds the target resource and the first shared resource to the cache space, and generates reference information of the first shared resource in the storage space, and the reference information is used to store and manage the first shared resource in the cache space. In this way, the resource cache efficiency of the storage space can be improved.

[0206] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0207] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0208] Since the computer program stored in the storage medium can execute the steps in any one of the resource caching methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the resource caching methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0209] The above is a detailed introduction to a resource caching method, device, storage medium and computer equipment provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A resource caching method, characterized in that: The method comprises: Receive a resource access request, and determine whether a target resource to be accessed by the resource access request and a first shared resource that the target resource needs to reference exist in a cache space; If the target resource and the first shared resource do not exist in the cache space, obtaining the remaining memory space of the current cache space, and obtaining the total memory occupied size corresponding to the target resource and the first shared resource; If the total memory occupancy size exceeds the remaining memory space, the resources in the cache space are removed until the total memory occupancy size does not exceed the remaining memory space of the cache space after the resources are removed; The target resource and the first shared resource are added to the cache space, and reference information of the first shared resource in the storage space is generated, where the reference information is used to perform storage management on the first shared resource in the cache space.

2. The method according to claim 1, characterized in that The removing operation on the resources in the cache space includes: Determine a first resource located at the end of the cache space and a first memory occupation size of the first resource; The first resource is removed from the cache space, and based on the first memory occupation size and the current remaining memory space, a remaining memory space of the cache space after the removal is determined; If the total memory occupancy size exceeds the remaining memory space of the cache space after removal, continue to select a new first resource at the end position from the cache space for removal until the total memory occupancy size does not exceed the remaining memory space of the cache space after removal.

3. The method according to claim 2, characterized in that The method further comprises: If a second shared resource referenced by the first resource exists in the cache space, obtaining reference information of the second shared resource; After the first resource is moved out of the cache space, the reference information of the second shared resource is updated according to the first resource.

4. The method according to claim 3, characterized in that The reference information of the second shared resource includes the number of resources in the cache space that reference the second shared resource; The method further comprises: If the quantity in the updated reference information of the second shared resource is zero, moving the second shared resource out of the cache space; A second memory occupation size corresponding to the second shared resource is obtained, and based on the second memory occupation size, the second memory occupation size, and the current remaining memory space, a remaining memory space of the cache space after the removal is determined.

5. The method according to claim 4, characterized in that The method further comprises: Determining whether the second shared resource has been loaded; If the second shared resource is loaded, determining whether the second shared resource is loaded successfully; If the second shared resource is successfully loaded, obtaining a second memory occupied size of the second shared resource; Storing the reference relationship between the first resource and the second shared resource in a preset resource relationship table, and storing the second memory usage size of the second shared resource in a preset resource memory table, wherein the preset resource relationship table is used to store the reference relationship between resources, and the preset resource memory table is used to store the memory usage size of resources; The obtaining the second memory occupation size corresponding to the second shared resource includes: A second memory occupancy size corresponding to the second shared resource is obtained from the preset resource memory table.

6. The method according to claim 5, characterized in that The method further comprises: If the second shared resource has not been loaded, adding the second shared resource to a to-be-loaded list, wherein the to-be-loaded list is used to store the shared resources that have not been loaded; Wait for the second shared resource to be loaded.

7. The method according to claim 6, characterized in that The method further comprises: Traversing the to-be-loaded list to determine whether the to-be-loaded shared resources in the to-be-loaded list have been loaded; If the shared resource to be loaded is loaded, determining whether the shared resource to be loaded is loaded successfully; If the shared resource to be loaded is loaded successfully, the shared resource to be loaded is removed from the to-be-loaded list, and the reference relationship between the shared resource to be loaded and the reference to the shared resource to be loaded is stored in the preset resource relationship table.

8. The method according to claim 5, characterized in that The updating of the reference information of the second shared resource according to the first resource includes: Remove the reference relationship between the first resource and the second shared resource from the preset resource relationship table; Based on the number of resources in the removed preset resource relationship table that have a reference relationship with the second shared resource, updated reference information of the second shared resource is obtained.

9. The method according to claim 1, characterized in that: The method further comprises: If the total memory occupancy size does not exceed the remaining memory space, the target resource and the first shared resource are added to the cache space, and reference information of the first shared resource is determined based on the target resource.

10. The method according to claim 1, characterized in that The method further comprises: If the target resource does not exist in the cache space, and the first shared resource exists in the cache space, obtaining the remaining memory space of the current cache space, the third memory occupied size corresponding to the target resource, and the existing reference information of the first shared resource; If the third memory occupancy size exceeds the remaining memory space, remove the resources in the cache space until the third memory occupancy size does not exceed the remaining memory space of the cache space after the resources are removed; The target resource is added to the cache space, and the existing reference information of the first shared resource is updated based on the target resource.

11. A resource cache device, characterized in that: The device comprises: A receiving unit, configured to receive a resource access request, and determine whether a target resource to be accessed by the resource access request and a first shared resource to be referenced by the target resource exist in a cache space; A first acquisition unit, configured to acquire the remaining memory space of the current cache space and the total memory occupied size corresponding to the target resource and the first shared resource if the target resource and the first shared resource do not exist in the cache space; A first operating unit, configured to remove resources in the cache space if the total memory occupation size exceeds the remaining memory space, until the total memory occupation size does not exceed the remaining memory space of the cache space after the resources are removed; The first adding unit is used to add the target resource and the first shared resource to the cache space, and generate reference information of the first shared resource in the storage space, wherein the reference information is used to store and manage the first shared resource in the cache space.

12. A computer device comprising a memory, a processor and a computer program stored in the memory and running on the processor, wherein: When the processor executes the program, the resource caching method according to any one of claims 1 to 10 is implemented.

13. A storage medium, characterized in that: The storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the resource caching method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Static resource loading method and device, computer equipment and storage medium

    CN111198729A

  • Resource caching method and device

    CN113010551A

  • Resource Obtaining Method, Apparatus, and System

    US20200045588A1

  • Resource caching method and electronic device supporting the same

    US20210365366A1

  • Cache Management Method and Apparatus

    US20220188230A1