A resource caching method and device, computer equipment and storage medium

By using the LRU algorithm to determine resource access requests and obtain memory usage, and removing unsuitable resources to add new resources, the problem of inaccurate measurement of cache space memory usage in existing technologies is solved, thus improving the efficiency of resource caching.

CN119690646BActive Publication Date: 2025-12-09NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, the LRU algorithm uses the number of resources as a cache space threshold, which cannot accurately measure the actual memory usage, leading to resource caching failure.

Method used

Upon receiving a resource access request, the system determines whether the target resource and shared resource exist in the cache space, obtains the remaining memory space and total memory usage of the cache space, and removes cache space resources if they exceed the limit until the memory usage is appropriate. Then, the target resource and shared resource are added to the cache space, and reference information is generated for storage management.

Benefits of technology

It improves the resource caching efficiency of storage space and enables precise control over cache space memory usage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690646B_ABST
    Figure CN119690646B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a resource caching method and device, computer equipment and a storage medium. The present application determines whether the target resource and the first shared resource exist in the cache space by receiving a resource access request, determining the target resource indicated by the resource access request, and determining whether the first shared resource referenced by the target resource exists in the cache space. If the target resource and the first shared resource do not exist in the cache space, the remaining memory space of the current cache space is obtained, and the total memory occupation size corresponding to the target resource and the first shared resource is obtained. If the total memory occupation size exceeds the remaining memory space, a removal operation is performed on the resources in the cache space until the total memory occupation size does not exceed the remaining memory space of the cache space after removing the resources. 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. In this way, 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 technical field of computer, in particular to a resource caching method and device, computer equipment and storage medium. BACKGROUND

[0002] LRU (Least Recently Used) algorithm is a commonly used cache eviction strategy. Its core idea is that if the data has been accessed recently, the probability of future access is also higher, so when the cache space is full, the least recently used cache data will be preferentially evicted.

[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 stored resources. However, using the number of resources as the threshold often cannot accurately measure the actual memory size of the current cache space, thereby leading to the failure of resource caching. SUMMARY

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

[0005] The embodiments of the present application provide a resource caching method, which comprises:

[0006] receiving a resource access request, determining whether the target resource indicated by the resource access request needs to access a first shared resource, and whether the first shared resource exists in the 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 size corresponding to the target resource and the first shared resource;

[0008] If the total memory size exceeds the remaining memory space, performing a removal operation on the resources in the cache space until the total memory size does not exceed the remaining memory space of the cache space after removing the resources;

[0009] 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 being used for storage management of the first shared resource in the cache space.

[0010] Correspondingly, the embodiments of the present application also provide a resource caching device, which comprises:

[0011] receive a resource access request, determine whether a target resource indicated by the resource access request needs to reference a first shared resource which does not exist in a cache space;

[0012] a first obtaining unit, configured to, if the target resource and the first shared resource do not exist in the cache space, obtain a remaining memory space of the cache space, and obtain a total memory occupation size corresponding to the target resource and the first shared resource;

[0013] a first operating unit, configured to, if the total memory occupation size exceeds the remaining memory space, perform a removal operation on resources in the cache space until the total memory occupation size does not exceed a remaining memory space of the cache space after the removal of the resources;

[0014] a first adding unit, configured 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, the reference information being used for storage management of the first shared resource in the cache space.

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

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

[0017] The embodiment of the present application receives a resource access request, determines whether a target resource indicated by the resource access request needs to reference a first shared resource which does not exist in a cache space, if the target resource and the first shared resource do not exist in the cache space, obtains a remaining memory space of the cache space, and obtains a total memory occupation size corresponding to the target resource and the first shared resource, if the total memory occupation size exceeds the remaining memory space, performs a removal operation on resources in the cache space until the total memory occupation size does not exceed a remaining memory space of the cache space after the removal of the resources, 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, the reference information being used for storage management of the first shared resource in the cache space. In this way, the resource caching efficiency of the storage space can be improved. BRIEF DESCRIPTION OF DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort based on these drawings.

[0019] Figure 1 The flowchart of another resource caching method provided by the embodiments of the present application.

[0020] Figure 2 The flowchart of another resource caching method provided by the embodiments of the present application.

[0021] Figure 3 The flowchart of another resource caching method provided by the embodiments of the present application.

[0022] Figure 4 The structural block diagram of a resource caching device provided by the embodiments of the present application.

[0023] Figure 5 The structural diagram of a computer device provided by the embodiments of the present application. DETAILED DESCRIPTION

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

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

[0026] For example, the computer device can be a server that can receive a resource access request, determine that the resource access request indicates a target resource to be accessed, and whether a first shared resource referenced by the target resource exists in a cache space; if the target resource and the first shared resource do not exist in the cache space, obtain a remaining memory space of the current cache space, and obtain a total memory occupation size corresponding to the target resource and the first shared resource; if the total memory occupation size exceeds the remaining memory space, perform a removal operation on resources in the cache space until the total memory occupation size does not exceed the remaining memory space of the cache space after the removal of the resources; 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 first resource caching method, device, computer device and storage medium provided by the embodiments of the present application can improve the resource caching efficiency of the storage space.

[0028] The following will be described in detail. It should be noted that the order of the following embodiments is not limited as the preferred order of the embodiments.

[0029] The embodiments of the present application provide a resource caching method, which can be executed by a terminal or a server. The embodiments of the present application will be described by taking the execution of the resource caching method by the server as an example.

[0030] As shown in Figure 1 , Figure 1 a flowchart of a resource caching method provided by the embodiments of the present application. The specific process of the resource caching method can be as follows:

[0031] 101, receiving a resource access request, determining that the resource access request indicates a target resource to be accessed, and whether a first shared resource referenced by the target resource exists in a cache space.

[0032] The resource access request is a request sent by a user or a system entity to a resource provider or manager, aiming to obtain access permission to a specific resource or perform an operation.

[0033] The resource can include a file, a database, an API interface, a network service, etc.

[0034] In the embodiments of the present application, the resource access request can be used to indicate the access target resource.

[0035] The first shared resource refers to a resource used by reference by the target resource, that is, the first shared resource has a reference relationship with the target resource.

[0036] Specifically, the reference relationship between resources refers to the mutual dependence or association between different resources. Resource reference generally refers to explicitly mentioning or depending on another resource in a resource. Such reference can be direct or indirect. Direct reference refers to directly referencing the name or identifier of another resource in a resource; while indirect reference refers to referencing the target resource through one or more intermediate resources. The reference relationship between resources can be divided into various types, including but not limited to: dependency relationship, association relationship, containment relationship, etc.

[0037] Among them, the dependency relationship refers to the fact that one resource must depend on another resource to work normally or exist. For example, in software development, an application program may depend on a specific library or framework to run; the association relationship refers to the fact that there is some logical connection between two resources, but it is not necessarily a direct dependency. For example, two database tables may establish an association relationship through a foreign key; the containment relationship refers to the fact that one resource contains another resource as its child resource. For example, a folder may contain multiple files and subfolders.

[0038] For example, the target resource can be a user interface node resource A, which references a texture resource B and a material resource C, then the texture resource B and the material resource C can be taken as the first shared resource 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] Among them, the cache space refers to a storage space used to store temporary data, usually located in memory or cache. The role of cache space can include: reducing data access time, improving system performance. By storing frequently accessed data in cache, the system can quickly access these data when needed without retrieving from slower storage media (such as hard disk).

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

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

[0043] Among them, 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 occupation size refers to the sum of the memory occupation size of the target resource and the memory occupation size of the first shared resource. For example, if the memory occupation size of the target resource is m and the memory occupation size of the first shared resource is n, the total memory occupation size is m+n.

[0045] The memory occupation 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 head 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 occupation size exceeds the remaining memory space, the resources in the cache space are removed until the total memory occupation size does not exceed the remaining memory space of the cache space after removing the resources.

[0049] If the total memory occupation size exceeds the remaining memory space, it 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 to enable the cache space to support the storage of the target resource and the first shared resource.

[0050] In some embodiments, in order to accurately control the memory occupation size of the cache space, the step of "removing the resources in the cache space" can include the following operations:

[0051] determining a first resource located at the tail position in the cache space and a first memory occupation size of the first resource;

[0052] moving the first resource out of the cache space, and determining the remaining memory space of the cache space after removal based on the first memory occupation size and the current remaining memory space;

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

[0054] In the embodiments of the present application, since the cache space is managed based on the LRU algorithm, the resources in the cache space can be removed from the tail position of the cache space.

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

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

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

[0058] Further, the total memory occupation size is continuously compared with the remaining memory space of the cache space after removal. If the total memory occupation size still exceeds the remaining memory space of the cache space after removal, a new first resource located at the end position in the cache space can be continuously determined and removed.

[0059] Then, the remaining memory space of the cache space after removal is added to the memory occupation size of the new first resource to obtain a new remaining memory space, until the total memory occupation size does not exceed the new remaining memory space, and the removal operation of the resources in the cache space can be ended.

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

[0061] If the second shared resource referenced by the first resource exists in the cache space, the reference information of the second shared resource is obtained.

[0062] After the first resource is removed from 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 used by the first resource in the cache space, that is, the second shared resource has a reference relationship with the first resource.

[0064] In the embodiments of the present application, the reference information of the shared resource can include a reference count corresponding to the shared resource, and the reference count refers to the number of other resources in the cache space that reference the shared resource.

[0065] Then, obtaining the reference information of the second shared resource can include: determining the number of resources in the cache space that reference the second shared resource to obtain the reference count of the second shared resource.

[0066] Specifically, after the first resource is removed from the cache space, the number of resources in the cache space that reference the second shared resource decreases by one, and the reference count of the second shared resource can 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 referencing the shared resource is 5. After the first resource is removed from the cache space, the number 5 in the reference information of the second shared resource can be reduced by 1, and the updated reference information of the second shared resource is: the number of other resources in the cache space referencing the shared resource is 4.

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

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

[0070] The 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 removal is determined.

[0071] The number in the updated reference information of the second shared resource is zero, indicating that there is no other resource in the cache space referencing the second shared resource. At this time, in order to save the memory occupation of the cache space, the second shared resource can be removed from the cache space.

[0072] Since the second shared resource is removed from 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, 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 removal can include: adding the current remaining memory space to the second memory occupation size and the second memory occupation size to obtain the remaining memory space of the cache space after removal.

[0075] In some embodiments, for some resources, multi-threading is used to implement asynchronous loading. In order to avoid the case that when the memory occupation size of the shared resource is obtained, the shared resource has not been loaded out and the accurate memory occupation size cannot be obtained, the method can obtain the state of the shared resource before obtaining the memory occupation size of the shared resource, that is, the method can include the following steps:

[0076] Determine whether the second shared resource is loaded;

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

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

[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 a preset resource memory table.

[0080] Wherein, the loading completion of the resource means that the resource loading process has ended, that is, the resource has been loaded into the system or application. When the resource loading is completed, the resource may be in a usable state, but it may also need further initialization or processing before it can be used. Whether the resource is loaded can be determined by listening to the loading event or checking the loading state to determine whether the resource is loaded.

[0081] Wherein, the successful loading of the resource means that the resource is not only loaded into the system or application, but also no error or exception occurs during the loading process, and the resource can be normally used. The successfully loaded resource has usually passed all necessary verification and initialization steps and can be directly used by the application. In addition to detecting the loading completion state, it is also necessary to check whether the resource is complete, valid and meets the expectations to determine whether the resource is successfully loaded.

[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, at this time, 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, at this time, the resource is not successfully loaded.

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

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

[0085] For example, the preset resource relationship table includes: the reference relationship of resource A1 to shared resource A; the reference relationship of resource B1 to shared resource A, etc.

[0086] Wherein, the preset resource memory table can be used to store the memory occupation size of the shared resource in the cache space.

[0087] For example, the preset resource memory table includes: memory occupation size of shared resource A: m; memory occupation size of shared resource B: n, etc.

[0088] For example, please refer to Figure 2 , Figure 2 The flowchart of another resource caching method provided by the embodiment of the present application is shown. The step of obtaining the state of the shared resource can include: first, traversing the shared resource referenced by the resource, that is, determining the shared resource for which the state information needs to be obtained, for example, the second shared resource referenced by the first resource; then, judging whether the shared resource is loaded, if the shared resource is loaded, further judging whether the shared resource is successfully loaded, if the shared resource is successfully loaded, the application relationship between the shared resource and the resource referencing the shared resource can be stored in the preset resource relationship table, and the memory occupation size corresponding to the shared resource can be stored in the preset resource memory table.

[0089] In some embodiments, when the shared resource is successfully loaded, the reference relationship between the shared resource and the resource referencing the shared resource is stored in the preset resource relationship table, which can facilitate subsequent obtaining of the reference information of the shared resource from the preset resource relationship table and updating of the reference information.

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

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

[0092] Waiting for loading of the second shared resource.

[0093] The to-be-loaded list is used to store the shared resource which is not loaded.

[0094] In the embodiment of the present application, the to-be-loaded list can be used to store the shared resource which is not loaded in the cache space.

[0095] For example, please continue to refer to Figure 2 When the shared resource is not loaded, the shared resource can be added to the to-be-loaded list. The loading of the shared resource can be continued until the shared resource is successfully loaded, 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 be loaded, the information of the shared resource is removed from the cache space. At the same time, the resource referencing the shared resource can be stored in the resource list corresponding to the shared resource, so as to facilitate subsequent calculation of the reference information of the shared resource.

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

[0097] In some embodiments, the step of "obtaining a second memory occupation size corresponding to the second shared resource" can include the following operations:

[0098] Obtaining the second memory occupation size corresponding to the second shared resource from a preset resource memory table.

[0099] In the embodiments of the present application, the shared resource stored in the preset resource memory table is a successfully loaded shared resource, and thus the memory occupation size of the shared resource 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 to-be-loaded shared resource in the process of updating the reference information of the shared resource, the method can update the to-be-loaded resource list before each access to the resource, and can include the following steps:

[0101] Traversing the to-be-loaded list to determine whether the to-be-loaded shared resource in the to-be-loaded list is loaded.

[0102] If the to-be-loaded shared resource is loaded, it is determined whether the to-be-loaded shared resource is successfully loaded.

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

[0104] For example, please refer to Figure 3 , Figure 3 The flowchart of another resource caching method provided by the embodiments of the present application is shown. The step of obtaining the state of the shared resource can include: first, traversing the to-be-loaded shared resource in the to-be-loaded list; then, determining whether the shared resource is loaded, if the shared resource is loaded, further determining whether the shared resource is successfully loaded, if the shared resource is successfully loaded, the to-be-loaded shared resource can be removed from the to-be-loaded list, and the to-be-loaded shared resource and the reference relationship of the to-be-loaded shared resource are stored in the preset resource relationship table according to the resource list corresponding to the shared resource in the above step.

[0105] If the to-be-loaded shared resource is not loaded, it can continue to wait for loading; if the to-be-loaded shared resource is loaded but not successfully loaded, it indicates that the shared resource does not exist, and thus the shared resource can be ignored and not processed.

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

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

[0108] Removing 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 that have a reference relationship with the second shared resource in the removed preset resource relationship table, the updated reference information of the second shared resource is obtained.

[0110] Specifically, since the first resource is removed from 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 removed preset resource relationship table, that is, the number of resources that have a reference relationship with the second shared resource is obtained from the removed preset resource relationship table as the updated reference information of the second shared resource.

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

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

[0114] Among them, the total memory usage size does not exceed the remaining memory space, that is, it means that the cache space currently supports the storage of the target resource and the first shared resource, so 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 scheme is based on the LRU algorithm to manage the cache space, adding the target resource and the first shared resource to the cache space can include: adding the target resource and the first shared resource to the head position in the cache space.

[0116] The reference information of the first shared resource is determined based on the target resource. The reference information of the first shared resource can be determined based on the number of references of the first shared resource in the cache space. The number of references of the first shared resource in the cache space is 1, and the reference count of the first shared resource is 1.

[0117] In some embodiments, the method can 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, 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 are obtained.

[0119] If the third memory occupation size exceeds the remaining memory space, a removal operation is performed on the resources in the cache space until the third memory occupation 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] If the first shared resource exists in the cache space, it means that the first shared resource has corresponding reference information in the cache space. That is, the existing reference information of the first shared resource includes the number of references of the first shared resource in the cache space, that is, the reference count corresponding to the first shared resource.

[0122] In some embodiments, the resources having a reference relationship with the first shared resource can be obtained from a preset resource relationship table, and the reference count corresponding to the first shared resource is determined to obtain the existing reference information of 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 occupation size can be compared with the remaining memory space of the cache space. If the third memory occupation size exceeds the remaining memory space, that is, the buffer space currently does not support the storage of the target resource, a removal operation needs to be performed on the resources in the cache space.

[0125] In some embodiments, the step of performing a removal operation on the resources in the cache space until the third memory occupation size does not exceed the remaining memory space of the cache space after the resources are removed can include the following operations:

[0126] A second resource located at the end position in the cache space is determined, and a fourth memory occupation size of the second resource is determined.

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

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

[0129] In the embodiments of the present application, the LRU algorithm can be used to manage the cache space, that is, when the resources in the cache space are removed, the resources can be removed from the tail position of the cache space.

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

[0131] In some embodiments, since the present scheme is based on the LRU algorithm to manage the cache space, adding the target resource to the cache space can include adding the target resource to the head position in the cache space.

[0132] The updating of the existing reference information of the first shared resource based on the target resource can include saving the reference relationship between the target resource and the first shared resource in a preset resource relationship table, and then reacquiring 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、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, and the reference information is used for storage management of the first shared resource in the cache space.

[0134] Specifically, when the resources in the cache space are removed, the remaining memory space of the cache space exceeds the total memory occupation size of the target resource and the first shared resource, which indicates that the cache space supports the storage of the target resource and the first shared resource. Further, the target resource and the first shared resource can be added to the cache space.

[0135] In some embodiments, since the present scheme is based on the LRU algorithm to manage the cache space, adding the target resource and the first shared resource to the cache space can include adding the target resource and the first shared resource to the head position in the cache space.

[0136] The generating of the reference information of the first shared resource in the storage space can include: determining that the resource in the cache space referencing the first shared resource includes a target resource, that is, the number of references of the first shared resource is 1, and then generating the reference count of the first shared resource as 1 as the reference information of the first shared resource.

[0137] Specifically, the resource caching method provided in the scheme can realize accurate control of the memory space of the cache space by calculating the memory occupation size of the resource and adding the reference count of the shared resource on the basis of the LRU algorithm.

[0138] The embodiment of the application discloses a resource caching method, which comprises the following steps: receiving a resource access request, determining whether a target resource indicated by the resource access request and a first shared resource referenced by the target resource exist in a cache space, obtaining a remaining memory space of the cache space and a total memory occupation 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, removing resources in the cache space until the total memory occupation size does not exceed the remaining memory space of the cache space if the total memory occupation size exceeds the remaining memory space, 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, wherein the reference information is used for storage management of the first shared resource in the cache space. In this way, the resource caching efficiency of the storage space can be improved.

[0139] To better implement the resource caching method provided in the embodiment of the application, the embodiment of the application further provides a resource caching device based on the above-mentioned resource caching method. The meanings of the terms are the same as those in the above-mentioned resource caching method, and the specific implementation details can be referred to the description in the method embodiment.

[0140] Please refer to Figure 4 , Figure 4 The structure block diagram of the resource caching device provided in the embodiment of the application comprises the following components:

[0141] The receiving unit 301 is configured to receive a resource access request, determine a target resource indicated by the resource access request and whether a first shared resource referenced by the target resource exists in a cache space.

[0142] The first obtaining unit 302 is configured to obtain a remaining memory space of the cache space and a total memory occupation 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] The first operation unit 303 is configured to, if the total memory occupation size exceeds the remaining memory space, perform a removal operation on the resources in the cache space until the total memory occupation size does not exceed the remaining memory space of the cache space after the resources are removed.

[0144] The first adding unit 304 is configured 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, where the reference information is used for storage management of the first shared resource in the cache space.

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

[0146] The first determining sub-unit is configured to determine a first resource located at an end position in the cache space and a first memory occupation size of the first resource.

[0147] The first moving-out sub-unit is configured to move the first resource out of the cache space, and determine a remaining memory space of the cache space after the first resource is removed based on the first memory occupation size and the current remaining memory space.

[0148] The first removing sub-unit is configured to, if the total memory occupation size exceeds the remaining memory space of the cache space after the first resource is removed, continue to select a new first resource located at an end position from the cache space for removal until the total memory occupation size does not exceed the remaining memory space of the cache space after the new first resource is removed.

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

[0150] The second obtaining unit is configured to, if the second shared resource referenced by the first resource exists in the cache space, obtain reference information of the second shared resource.

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

[0152] In some embodiments, the reference information of the second shared resource includes a quantity of resources in the cache space that reference the second shared resource.

[0153] The apparatus can further include:

[0154] The second moving-out sub-unit is configured to, if the quantity in the updated reference information of the second shared resource is zero, move the second shared resource out of the cache space.

[0155] The obtaining subunit is configured to obtain a second memory occupation size corresponding to the second shared resource, and determine a remaining memory space of the post-removal cache space based on the second memory occupation size, the first memory occupation size, and a current remaining memory space.

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

[0157] The first determining unit is configured to determine whether the second shared resource is loaded completely.

[0158] The second determining unit is configured to determine whether the second shared resource is loaded successfully if the second shared resource is loaded completely.

[0159] The third obtaining unit is configured to obtain a second memory occupation size of the second shared resource if the second shared resource is loaded successfully.

[0160] The storage unit is configured to store a reference relationship between the first resource and the second shared resource into a preset resource relationship table, and store the second memory occupation size of the second shared resource into a preset resource memory table, wherein the preset resource relationship table is configured to store reference relationships between resources, and the preset resource memory table is configured to store memory occupation sizes of resources.

[0161] In some embodiments, the obtaining subunit can be specifically configured to:

[0162] Obtain the second memory occupation size corresponding to the second shared resource from the preset resource memory table.

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

[0164] The second adding unit is configured to add the second shared resource into a to-be-loaded list if the second shared resource is not loaded completely, wherein the to-be-loaded list is configured to store shared resources that are not loaded completely.

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

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

[0167] The traversing unit is configured to traverse the to-be-loaded list to determine whether a to-be-loaded shared resource in the to-be-loaded list is loaded completely.

[0168] The third determining unit is configured to determine whether the to-be-loaded shared resource is loaded successfully if the to-be-loaded shared resource is loaded completely.

[0169] A moving unit is configured to move the to-be-loaded shared resource out of the to-be-loaded list and store the to-be-loaded shared resource and a reference relationship referring to the to-be-loaded shared resource in the preset resource relationship table if the to-be-loaded shared resource is successfully loaded.

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

[0171] A second removing sub-unit is configured to remove the reference relationship between the first resource and the second shared resource from the preset resource relationship table.

[0172] A second determining sub-unit is configured to obtain updated reference information of the second shared resource based on a number of resources having reference relationships with the second shared resource in the preset resource relationship table after the removal.

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

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

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

[0176] A fourth obtaining unit is configured to obtain a remaining memory space of the cache space, a third memory occupation size corresponding to the target resource, and existing reference information of the first shared resource if the target resource does not exist in the cache space and the first shared resource exists in the cache space.

[0177] A second operating unit is configured to perform a removal operation on resources in the cache space until the third memory occupation size does not exceed a remaining memory space of the cache space after the removal of the resources if the third memory occupation size exceeds the remaining memory space.

[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 caching device. A resource access request is received by a receiving unit 301. It is determined whether a target resource indicated by the resource access request and a first shared resource required to be referenced by the target resource exist in a cache space. A first obtaining unit 302 obtains a remaining memory space of the cache space and a total memory occupation 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 303 removes 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. A 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 cache space. The reference information is used for storage management of the first shared resource in the cache space. In this way, the resource caching efficiency of the storage space can be improved.

[0180] Correspondingly, the embodiment of the present application further provides a computer device, which can be a server. As shown in Figure 5 Figure 5 The computer device provided by the embodiment of the present application is shown in a structural diagram. 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. Those skilled in the art can understand that the computer device structure shown in the figure does not constitute a limitation on the computer device, and can include more or fewer components than the figure, or combine certain components, or different component arrangements.

[0181] The processor 401 is the control center of the computer device 400, which connects various parts of the computer device 400 through various interfaces and lines, executes various functions and processes data of the computer device 400 by running or loading software programs and / or modules stored in the memory 402 and calling data stored in the memory 402, and thus monitors 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 the instructions corresponding to the processes of one or more application programs into the memory 402, and run the application programs stored in the memory 402 by the processor 401, so as to realize various functions:

[0183] ​Receive a resource access request, determine the target resource indicated by the resource access request, and whether the first shared resource that the target resource needs to reference exists 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 usage of the target resource and the first shared resource;

[0185] If the total memory usage exceeds the remaining memory space, resources in the cache space will be 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. The reference information is used to manage the storage of the first shared resource in the cache space.

[0187] This embodiment of the application receives a resource access request, determines the target resource requested by the resource access request, and whether the first shared resource referenced by the target resource exists in the cache space. If the target resource and the first shared resource do not exist in the cache space, the remaining memory space of the current cache space and the total memory usage corresponding to the target resource and the first shared resource are obtained. 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 removal of resources. 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. The reference information is used for storage management of the first shared resource in the cache space. In this way, the resource caching efficiency of the storage space can be improved.

[0188] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0189] Optional, such as Figure 5 As shown, the computer device 400 also includes: a touch screen display 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 display 403, the radio frequency circuit 404, the audio circuit 405, the input unit 406, and the power supply 407. Those skilled in the art will understand that... Figure 5 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0190] The touch display screen 403 can be used to display a graphical user interface and receive operation instructions generated by user acting on the graphical user interface. The touch display screen 403 can include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user and various graphical user interfaces of the computer device, which can be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. The touch panel can be used to collect touch operations (such as user operations on or near the touch panel using a finger, a stylus or any suitable object or accessory) of the user thereon or therearound, and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel can include two parts of a touch detection device and a touch controller. The touch detection device detects the touch position of the user and detects signals generated by the touch operation, and transmits the signals to the touch controller; the touch controller receives the touch information from the touch detection device, and converts it into touch coordinates, and then sends it to the processor 401, and can receive commands from the processor 401 and execute them. The touch panel can cover the display panel, and when the touch panel detects a touch operation thereon or therearound, it transmits to the processor 401 to determine the type of touch event, and then the processor 401 provides corresponding visual output on the display panel according to the type of touch event. In the embodiments 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 realize the input and output functions as two independent components. That is, the touch display screen 403 can also realize the input function as part of the input unit 406.

[0191] In the embodiments of the present application, the processor 401 executes the game application to generate a graphical user interface on the touch display screen 403, and 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 display screen 403 is used to present the graphical user interface and receive operation instructions generated by user acting on the graphical user interface.

[0192] The radio frequency circuit 404 can be used to transceive radio frequency signals to establish wireless communication with network devices or other computer devices, and transceive signals between network devices or other computer devices.

[0193] The audio circuit 405 can be used to provide an audio interface between a user and the computer device through a speaker and a microphone. The audio circuit 405 can convert received audio data into an electrical signal and transmit the electrical signal to the speaker for conversion into an audible signal. On the other hand, the microphone can collect a sound signal and convert the sound signal into an electrical signal, which is received by the audio circuit 405 and converted into audio data. The audio data is then output to the processor 401 for processing and transmitted to another computer device via the radio frequency circuit 404 or stored in the memory 402 for further processing. The audio circuit 405 can also include a jack for a headset to provide communication between the headset and the computer device.

[0194] The input unit 406 can be used to receive inputted numbers, character information or user feature information (e.g., fingerprint, iris, face information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[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 be used to manage charging, discharging and power consumption management, etc. The power supply 407 can also include one or more direct current or alternating current power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, etc.

[0196] Although Figure 5 The computer device 400 can also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which are not shown in the embodiments.

[0197] In the above embodiments, the description of each embodiment focuses on different aspects, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0198] As can be seen from the above, the computer device provided in the embodiments can receive a resource access request, determine whether a target resource indicated by the resource access request and a first shared resource referenced by the target resource exist in a cache space, obtain a remaining memory space of the cache space and a total memory occupation 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, remove resources in the cache space until the total memory occupation size does not exceed a remaining memory space of the cache space after the resources are removed if the total memory occupation size exceeds the remaining memory space, add the target resource and the first shared resource to the cache space, and generate reference information of the first shared resource in the cache space, where the reference information is used for storage management of the first shared resource in the cache space.

[0199] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by related hardware controlled by the instructions, which can be stored in a computer readable storage medium and loaded and executed by a processor.

[0200] To this end, the embodiments of the present application provide a computer readable storage medium, which stores a plurality of computer programs capable of being loaded by a processor to execute the steps in any of the resource caching methods provided by the embodiments of the present application. For example, the computer program can execute the following steps:

[0201] receiving a resource access request, determining a target resource indicated by the resource access request to be accessed, and whether a first shared resource referenced by the target resource exists in a cache space;

[0202] if the target resource and the first shared resource do not exist in the cache space, obtaining a remaining memory space of the cache space, and obtaining a total memory occupation size corresponding to the target resource and the first shared resource;

[0203] if the total memory occupation size exceeds the remaining memory space, performing a removal operation on resources in the cache space until the total memory occupation size does not exceed the remaining memory space of the cache space after the removal of the resources;

[0204] 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 being used for storage management of the first shared resource in the cache space.

[0205] The embodiments of the present application can improve the resource caching efficiency of the storage space by receiving a resource access request, determining a target resource indicated by the resource access request to be accessed, and whether a first shared resource referenced by the target resource exists in a cache space; if the target resource and the first shared resource do not exist in the cache space, obtaining a remaining memory space of the cache space, and obtaining a total memory occupation size corresponding to the target resource and the first shared resource; if the total memory occupation size exceeds the remaining memory space, performing a removal operation on resources in the cache space until the total memory occupation size does not exceed the remaining memory space of the cache space after the removal of the resources; 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 being used for storage management of the first shared resource in the cache space.

[0206] The specific implementation of each operation can be referred to the foregoing embodiments, which will not be described here.

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

[0208] The computer program stored in the storage medium can execute the steps of any of the resource caching methods provided by the embodiments of the present application, thus achieving the beneficial effects of any of the resource caching methods provided by the embodiments of the present application. Details are described above, and will not be repeated here.

[0209] The above describes in detail a resource caching method, device, storage medium, and computer device provided by the embodiments of the present application. The principles and implementation manners of the present application are described by applying specific examples. The above description of the embodiments is only used to help understand the method and its core idea of the present application. Meanwhile, for those skilled in the art, the specific implementation manners and application ranges can be changed according to the idea of the present application. In summary, the content of the specification should not be understood as a limitation of the present application.

Claims

1. A resource caching method, characterized by, The method comprises: receiving a resource access request, determining that the resource access request indicates a target resource to be accessed, and whether a first shared resource referenced by the target resource exists in a cache space; if the target resource and the first shared resource do not exist in the cache space, obtaining a remaining memory space of the cache space, and obtaining a total memory occupation size corresponding to the target resource and the first shared resource; if the total memory occupation size exceeds the remaining memory space, performing a removal operation on resources in the cache space until the total memory occupation size does not exceed the remaining memory space of the cache space after removing the resources; adding the target resource and the first shared resource to the cache space, and generating reference information of the first shared resource in the cache space, the reference information being used for storage management of the first shared resource in the cache space; the removal operation on the resources in the cache space comprises: determining a first resource located at an end position in the cache space, and a first memory occupation size of the first resource; removing the first resource from the cache space, and determining a remaining memory space of the cache space after removal based on the first memory occupation size and the current remaining memory space; if the total memory occupation size exceeds the remaining memory space of the cache space after removal, continue to select a new first resource located at an end position from the cache space for removal until the total memory occupation size does not exceed the remaining memory space of the cache space after removal.

2. The method of claim 1, wherein, The method further comprises: if the cache space exists a second shared resource referenced by the first resource, obtaining reference information of the second shared resource; after removing the first resource from the cache space, updating the reference information of the second shared resource according to the first resource.

3. The method of claim 2, wherein, The reference information of the second shared resource comprises a quantity corresponding to resources in the cache space referencing the second shared resource; The method further comprises: if the quantity in the updated reference information of the second shared resource is zero, removing the second shared resource from the cache space; obtaining a second memory occupation size corresponding to the second shared resource, and determining a remaining memory space of the cache space after removal based on the second memory occupation size, the second memory occupation size and the current remaining memory space.

4. The method of claim 3, wherein, The method further comprises: determining whether the second shared resource is loaded completely; if the second shared resource is loaded completely, determining whether the second shared resource is loaded successfully; if the second shared resource is loaded successfully, obtaining a second memory occupation size of the second shared resource; storing a reference relationship between the first resource and the second shared resource into a preset resource relationship table, and storing the second memory occupation size of the second shared resource into a preset resource memory table, wherein the preset resource relationship table is used for storing reference relationships between resources, and the preset resource memory table is used for storing memory occupation sizes of resources; the obtaining of the second memory occupation size corresponding to the second shared resource comprises: Obtaining a second memory occupation size corresponding to the second shared resource from the preset resource memory table.

5. The method of claim 4, wherein, The method further includes: If the second shared resource is not loaded completely, adding the second shared resource to a to-be-loaded list, wherein the to-be-loaded list is used to store shared resources that are not loaded completely. Waiting for loading of the second shared resource.

6. The method of claim 5, wherein, The method further includes: Traversing the to-be-loaded list to determine whether a to-be-loaded shared resource in the to-be-loaded list is loaded completely; If the to-be-loaded shared resource is loaded completely, determining whether the to-be-loaded shared resource is loaded successfully; If the to-be-loaded shared resource is loaded successfully, removing the to-be-loaded shared resource from the to-be-loaded list and storing the to-be-loaded shared resource and a reference relationship of referencing the to-be-loaded shared resource in the preset resource relationship table.

7. The method of claim 4, wherein, The method further includes: Removing the reference relationship of the first resource and the second shared resource from the preset resource relationship table; Obtaining updated reference information of the second shared resource based on a quantity of resources that have a reference relationship with the second shared resource in the preset resource relationship table after removal.

8. The method of claim 1, wherein, The method further includes: If the total memory occupation size does not exceed the remaining memory space, adding the target resource and the first shared resource to the cache space and determining reference information of the first shared resource based on the target resource.

9. The method of claim 1, wherein, The method further includes: If the target resource does not exist in the cache space and the first shared resource exists in the cache space, obtaining a remaining memory space of the cache space at present, a third memory occupation size corresponding to the target resource, and existing reference information of the first shared resource; If the third memory occupation size exceeds the remaining memory space, performing a removal operation on resources in the cache space until the third memory occupation size does not exceed the remaining memory space of the cache space after removal of the resources; Adding the target resource to the cache space and updating the existing reference information of the first shared resource based on the target resource.

10. A resource caching apparatus, characterized by, The apparatus includes: A receiving unit configured to receive a resource access request, determine a target resource indicated by the resource access request, and whether a first shared resource referenced by the target resource exists in a cache space; A first obtaining unit configured to, if the target resource and the first shared resource do not exist in the cache space, obtain a remaining memory space of the cache space at present and obtain a total memory occupation size corresponding to the target resource and the first shared resource; A first operation unit configured to, if the total memory occupation size exceeds the remaining memory space, perform a removal operation on resources in the cache space until the total memory occupation size does not exceed the remaining memory space of the cache space after removal of the resources; A first adding unit, configured to add the target resource and the first shared resource into the cache space, and generate reference information of the first shared resource in the cache space, the reference information being used for storage management of the first shared resource in the cache space; The first operation unit comprises: A first determining sub-unit, configured to determine a first resource located at a tail position in the cache space, and a first memory occupation size of the first resource; A first moving-out sub-unit, configured to move the first resource out of the cache space, and determine a remaining memory space of the cache space after removal based on the first memory occupation size and a current remaining memory space; A first removing sub-unit, configured to, if the total memory occupation size exceeds the remaining memory space of the cache space after removal, continue to select a new first resource located at the tail position from the cache space for removal until the total memory occupation size does not exceed the remaining memory space of the cache space after removal.

11. A computer device comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein, The processor implements the resource caching method in any one of claims 1 to 9 when executing the program.

12. A storage medium, characterized by The storage medium stores a plurality of instructions, which are adapted to be loaded by the processor to execute the resource caching method in any one of claims 1 to 9.

Citation Information

Patent Citations

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

    CN111198729A

  • Resource caching method and device

    CN113010551A