Page resource providing method of application program and page loading method of application program

By using Redis cache to store and query page resource information on the server side, the performance bottlenecks and inflexible cache strategies of traditional resource provision methods are solved, and fast resource loading and efficient user experience are achieved, suitable for applications with high concurrency and dynamic content Scene.

CN119128302APending Publication Date: 2024-12-13BEIJING XUEDIRUANJIAN DEVELOPMENT CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411354165.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

Traditional page resource provision methods have severe performance bottlenecks when providing high concurrent access and large number of resource requests, and the cache strategy is inflexible, resulting in inefficient resource loading and poor user experience.

Method used

Redis cache is used to store and query page resource information, reduce direct access to the database and file system, send target resource placement identifiers through the client to obtain required resource information, and dynamically adjust the cache strategy based on Redis's rich data structure.

Benefits of technology

Significantly improve resource loading speed and user experience, reduce server load, improve application response speed and flexibility, especially for modern web and mobile applications with high concurrent and dynamic content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119128302A_ABST
    Figure CN119128302A_ABST
Patent Text Reader

Abstract

The invention discloses a page resource providing method and device for an application program, a page loading method and device for the application program, a storage medium and computer equipment, and the method comprises the steps: receiving a resource obtaining request from a target application program in a client, the resource acquisition request carries a target resource display position identifier corresponding to a target page requested to be loaded in the client; target resource information corresponding to the target resource display position identifier is inquired in a Redis cache, and resource display position information of all resource display positions corresponding to the target application program is stored in the Redis cache; any resource display position information comprises a resource display position identifier and resource information corresponding to the corresponding resource display position; and sending the target resource information to the client, so that the client loads the target page based on the target resource information. Compared with the prior art, the cache management based on Redis provides higher flexibility and efficiency, and the load of the server is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of database technology, and in particular to a method for providing page resources of an application, a method, device, storage medium and computer equipment for loading pages of an application. Background Art

[0002] In the current field of web development and mobile application development, with the increasing complexity and functionality of applications, effective management and fast loading of page resources have become key factors in improving user experience. Traditional methods of providing page resources often rely on databases or file systems to directly query and transmit resources. This method faces significant performance bottlenecks when facing high concurrent access or a large number of resource requests. Specifically, the database query speed is limited by its complex data structure and query optimization, while the file system's I / O operations are limited by the disk read and write speed. Both are difficult to meet the high requirements of modern applications for resource response speed.

[0003] In addition, the traditional resource provision method also has the problem of inflexible resource caching strategy. Many systems use simple HTTP cache headers to control the caching behavior of resources, but this method cannot perform refined cache management based on the actual usage of resources or the personalized needs of users. Therefore, in application scenarios where resources are frequently updated or user behavior is changeable, traditional caching strategies often lead to low resource loading efficiency and greatly reduce user experience. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a method for providing page resources for an application, a method, device, storage medium and computer equipment for loading pages for an application, aiming to solve the performance bottleneck problem faced by traditional resource provision methods in high-concurrency access and a large number of resource requests, as well as the problem of low resource loading efficiency caused by the inflexibility of traditional caching strategies.

[0005] According to one aspect of the present application, a method for providing page resources of an application is provided, which is applied to a server, and the method includes:

[0006] Receiving a resource acquisition request from a target application in a client, wherein the resource acquisition request carries a target resource display location identifier corresponding to a target page requested to be loaded in the client;

[0007] Querying the target resource information corresponding to the target resource display location identifier in the Redis cache, wherein the Redis cache stores the resource display location information of each resource display location corresponding to the target application, and any resource display location information includes the resource display location identifier and resource information corresponding to the corresponding resource display location;

[0008] The target resource information is sent to the client, so that the client loads the target page based on the target resource information.

[0009] According to another aspect of the present application, a page loading method of an application is provided, which is applied to a client, and the method includes:

[0010] In response to a page loading instruction for a target page in a target application, determining a target resource display location identifier corresponding to the target page, and generating a resource acquisition request based on the target resource display location identifier;

[0011] Sending the resource acquisition request to the server corresponding to the target application, so that the server queries the Redis cache and returns the target resource information corresponding to the target resource display location identifier to the client, wherein the Redis cache stores the resource display location information of each resource display location corresponding to the target application, and any resource display location information includes the resource display location identifier and resource information corresponding to the corresponding resource display location;

[0012] The target page is loaded based on the target resource information.

[0013] According to another aspect of the present application, a device for providing page resources of an application is provided, which is applied to a server, and the device includes:

[0014] The request receiving module is used to receive resource acquisition requests from the target application in the client.

[0015] The resource acquisition request carries a target resource display location identifier corresponding to the target page requested to be loaded in the client;

[0016] A resource acquisition module, used for querying the target resource information corresponding to the target resource display location identifier in the Redis cache, wherein the Redis cache stores the resource display location information of each resource display location corresponding to the target application, and any resource display location information includes the resource display location identifier and resource information corresponding to the corresponding resource display location;

[0017] The information sending module is used to send the target resource information to the client, so that the client loads the target page based on the target resource information.

[0018] According to another aspect of the present application, a page loading device of an application is provided, which is applied to a client, and the device includes:

[0019] A request generation module, configured to respond to a page loading instruction for a target page in a target application, determine a target resource display location identifier corresponding to the target page, and generate a resource acquisition request based on the target resource display location identifier;

[0020] A request sending module, used for sending the resource acquisition request to the server corresponding to the target application, so that the server queries the Redis cache and returns the target resource information corresponding to the target resource display location identifier to the client, wherein the Redis cache stores the resource display location information of each resource display location corresponding to the target application, and any resource display location information includes the resource display location identifier and resource information corresponding to the corresponding resource display location;

[0021] A page loading module is used to load the target page based on the target resource information.

[0022] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the page resource providing method of the above-mentioned application program is implemented.

[0023] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the page resource providing method of the above-mentioned application program when executing the program.

[0024] By means of the above technical scheme, the embodiment of the present application provides a method for providing page resources of an application, a method for loading a page of an application, a device, a storage medium and a computer device, receiving a resource acquisition request from a client, the request including a target resource display location identifier; querying the resource information corresponding to the identifier in the Redis cache; sending the queried resource information to the client so that it can load the target page. The embodiment of the present application avoids directly querying and transmitting resources from a database or file system by utilizing the high-speed memory storage and access characteristics of Redis. By storing resource information in the Redis cache, the number of direct accesses to the back-end database and file system is reduced, the load on the server is reduced, and the time overhead of I / O operations and database queries is significantly reduced. This performance improvement is particularly obvious in scenarios with high concurrent access and a large number of resource requests. The fast resource loading speed directly reduces the user's waiting time and improves the responsiveness and fluency of the user interface. Especially for modern Web and mobile applications that need to respond quickly to user operations or display a large amount of dynamic content, it can greatly improve the response speed of the application and user experience. Compared with the traditional HTTP cache header control strategy, Redis-based cache management provides higher flexibility and efficiency. Redis supports rich data structures, allowing developers to dynamically adjust cache strategies based on actual resource usage, user personalized needs, or resource update frequency, thereby maintaining efficient resource loading efficiency.

[0025] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0027] Figure 1 A schematic diagram showing a flow chart of a method for providing page resources of an application program provided in an embodiment of the present application;

[0028] Figure 2 A schematic diagram showing a flow chart of another method for providing page resources of an application program provided in an embodiment of the present application;

[0029] Figure 3 A schematic diagram showing a flow chart of another method for providing page resources of an application program provided in an embodiment of the present application;

[0030] Figure 4A schematic diagram showing a flow chart of another method for providing page resources of an application program provided in an embodiment of the present application;

[0031] Figure 5 A schematic diagram showing a flow chart of another method for providing page resources of an application program provided in an embodiment of the present application;

[0032] Figure 6 A schematic diagram showing a flow chart of a page loading method of an application provided in an embodiment of the present application;

[0033] Figure 7 A schematic diagram showing the structure of a device for providing page resources for an application program provided in an embodiment of the present application is shown;

[0034] Figure 8 A schematic diagram of the structure of a page loading device for an application provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0035] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0036] In this embodiment, a method for providing page resources of an application is provided, which is applied to a server, such as Figure 1 As shown, the method includes:

[0037] Step 101: receiving a resource acquisition request from a target application in a client, wherein the resource acquisition request carries a target resource display location identifier corresponding to a target page requested to be loaded in the client.

[0038] In this embodiment, an efficient method for providing application page resources is provided, which mainly relies on Redis cache to optimize the resource loading process. First, the server receives a resource acquisition request from a client (such as a web browser or mobile application). The resource acquisition request contains a target resource display location identifier corresponding to the target page, which helps the server identify which resources the client needs to load specifically. Resource types may include pictures, videos, etc. For example, when a user uses an application on a learning machine device, he needs to open a page that contains multiple resource display locations. Then the client can generate a resource acquisition request based on the user's request to open the page. The resource acquisition request contains the resource display location identifier of each resource display location in the page, so that the server can clearly know which resource display location the client needs to load based on the identifier.

[0039] Step 102, querying the target resource information corresponding to the target resource display location identifier in the Redis cache, wherein the Redis cache stores the resource display location information of each resource display location corresponding to the target application, and any resource display location information includes the resource display location identifier and resource information corresponding to the corresponding resource display location.

[0040] In this embodiment, the server searches the Redis cache for resource information that matches each resource display location identifier in the resource acquisition request. Redis is a high-performance key-value storage system known for its extremely fast read and write speed and rich data structure support. In an embodiment of the present application, Redis is used to store each resource display location information in the target application, including resource display location identifiers and resource information, where the resource information can be the resource content itself or a reference to the resource content, such as a URL corresponding to the resource content. By using the Redis cache, directly querying and transmitting resources from the database or file system is avoided, thereby significantly reducing the time overhead of I / O operations and database queries. Redis's memory storage and high-speed access characteristics greatly increase the speed of resource loading, especially in scenarios with high concurrent access or a large number of resource requests, this advantage is particularly obvious. Compared with traditional HTTP cache header control strategies, cache management based on Redis is more flexible and efficient. Redis supports a rich data structure, which can easily implement complex cache logic, such as dynamically adjusting cache strategies based on actual resource usage, user personalized needs, or resource update frequency, which helps maintain efficient resource loading efficiency in scenarios where resources are frequently updated or user behavior is changeable (for example, different resource display locations on each page of the target application frequently update resource content). By storing resource information in the Redis cache, direct access to the backend database and file system is reduced, thereby reducing the server load and improving the overall performance and stability of the server.

[0041] Optionally, the resource display location information is stored in a key-value pair format, the key information is determined according to the resource display location identifier, and the value information is determined according to the resource information. For example, a page of an application has a resource display location A, and the resource content to be displayed in location A is image X, then the key information Key in the resource display location information of location A can be {fixed prefix}:{location A identifier}, and the value information Value can be the URL of image X.

[0042] Step 103: Send the target resource information to the client, so that the client loads the target page based on the target resource information.

[0043] In this embodiment, once the server finds the corresponding resource information in the Redis cache, the server sends the resource information to the client, and the client can use the resource information to load and render the target page, thereby completing the user's request. Among them, when the resource information is the resource content itself, the client can directly load the page, and when the resource information is a reference to the resource content, the client can first obtain the resource content based on the resource information and then load the page. The fast resource loading speed directly improves the responsiveness and smoothness of the user interface, reduces the user's waiting time, and thus improves the overall user experience, which has obvious advantages for modern Web and mobile applications that need to respond quickly to user operations or display a large amount of dynamic content.

[0044] By applying the technical solution of this embodiment, a resource acquisition request from a client is received, the request includes a target resource display location identifier; the resource information corresponding to the identifier is queried in the Redis cache; and the queried resource information is sent to the client so that it can load the target page. The embodiment of the present application avoids directly querying and transmitting resources from the database or file system by utilizing the high-speed memory storage and access characteristics of Redis. By storing resource information in the Redis cache, the number of direct accesses to the back-end database and file system is reduced, the server load is reduced, and the time overhead of I / O operations and database queries is significantly reduced. This performance improvement is particularly obvious in scenarios with high concurrent access and a large number of resource requests. The fast resource loading speed directly reduces the user's waiting time and improves the responsiveness and smoothness of the user interface. Especially for modern Web and mobile applications that need to respond quickly to user operations or display a large amount of dynamic content, it can greatly improve the application's response speed and user experience. Compared with the traditional HTTP cache header control strategy, Redis-based cache management provides higher flexibility and efficiency. Redis supports rich data structures, allowing developers to dynamically adjust cache strategies based on actual resource usage, user personalized needs, or resource update frequency, thereby maintaining efficient resource loading efficiency.

[0045] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another method for providing page resources of an application is provided, such as Figure 2 As shown, the method includes:

[0046] Step 201, when the target application is started, based on the resource configuration table of the target application, the resource display location information of the target application is initialized into the Redis cache, and the resource display location information in the Redis cache is set to never expire, wherein the resource configuration table includes the resource display location identifier and resource information of each resource display location corresponding to the target application.

[0047] In this embodiment, when the target application is started, that is, when the server starts the service of the application, the server reads the resource configuration table of the target application from the preset storage location. The resource configuration table is a table or data structure containing information related to each resource display location in the application, mainly including: resource display location identification: a unique identification of each resource display location, used to distinguish different display areas or components; resource information: resource information associated with each resource display location, such as resource URL. After parsing the resource configuration table, these information are initialized into the Redis cache. In this step, the information of each resource display location (including its identification and resource information) is stored in Redis as a key-value pair. By default, the cache item in Redis will have an expiration time. After this time, the cache item will be automatically deleted to release memory. However, in the embodiment of the present application, since the resource display location information is static and frequently accessed during the operation of the application, it is set to never expire to avoid frequent database access due to cache failure. This can be achieved by setting the corresponding key in Redis to not expire (or setting a very long expiration time, such as hundreds of years later). This step is completed when all resource placement information is successfully initialized into the Redis cache and set to never expire. At this point, the target application can efficiently read resource placement information from the Redis cache to quickly build a user interface and display resources.

[0048] Step 202: monitor the resource configuration table of the target application, wherein the resource configuration table is dynamically updated based on the configuration of the resource display location of the target application and the resource information of the resource display location by the content producer; when a change event occurs in the resource configuration table, the resource display location information stored in the Redis cache is changed based on the monitored change event.

[0049] In this embodiment, after the target application is started and the resource configuration table is initialized to the Redis cache, the server can configure a monitoring mechanism to continuously monitor the changes in the resource configuration table. For example, the resource configuration table can be a Binlog file, and the server configures the Binlog module to implement monitoring of the resource configuration table. Binlog is the abbreviation of Binary Log, which is a binary log file in the MySQL database. It records all SQL statements that change the database, including operations such as insert, update, and delete. The monitoring mechanism will monitor the storage location of the resource configuration table in real time (which may be a database table, configuration file, remote service, etc.). Once a modification operation on the resource configuration table is detected (such as adding, deleting, or updating the resource display location and its resource information), the monitoring mechanism will trigger a change event. When the resource configuration table changes, the monitoring mechanism will capture this change event, parse the captured change event content, and determine which resource display location information needs to be updated, such as which resource display location information has changed (such as the changed resource display location identifier, old value and new value, etc.). Based on the parsed change content, the resource display location information in the Redis cache is synchronously updated to ensure the consistency of the Redis cache and the resource configuration table. If a resource placement is deleted, the corresponding key-value pair is deleted from the Redis cache. If the resource information of a resource placement is updated, the value of the corresponding key-value pair in the Redis cache is modified. If a new resource placement is added, a new key-value pair is added to the Redis cache. Figure 3 As shown in the figure, taking the application as the learning machine software as an example, the content producer can produce and configure resource content through the content production platform, synchronize the configuration information to the MySQL database and record it through the binlog file. After the server monitors the change event, it creates a consumption task for updating the Redis cache based on the change event, and writes the consumption task into the consumption queue, so that the consumption task can be executed based on the consumption queue to realize the asynchronous update of the Redis cache, so that the server Redis cache and the MySQL database maintain data consistency. After that, when the learning machine needs to obtain resources, the server can directly query the resource information in the Redis cache without frequent access to the database.

[0050] In an embodiment of the present application, optionally, step 202, based on the monitored change event, changes the resource display location information stored in the Redis cache, including: in the resource configuration table, obtaining the resource display location identifier and the resource information to be changed corresponding to the monitored change event, and generating the resource display location information to be changed based on the resource display location identifier and the resource information to be changed; synchronizing the Redis cache with the resource display location information to be changed, and obtaining a data synchronization result; if the data synchronization result is a failure, generating a data synchronization retry task based on the resource display location information to be changed, adding the data synchronization retry task to the task queue, and performing a data synchronization retry operation on the Redis cache by executing the data synchronization retry task in the task queue until the data synchronization result of the data synchronization retry task is successful or the number of retries exceeds the retry threshold.

[0051] In the above embodiment, if Figure 4As shown, when a change event of the resource configuration table is monitored, the event is first parsed to obtain the resource display location identifier to be changed (i.e., key information) and the resource information to be changed (i.e., value information), which are the basis for the subsequent update of the Redis cache. According to the parsed resource display location identifier to be changed and the resource information to be changed, the resource display location information to be changed is generated, that is, the key information and the value information are organized into a key-value pair. Try to synchronize the generated resource display location information to be changed to the Redis cache, for example, find the corresponding key existing in Redis, and update the value to the new resource information. After the synchronization operation is completed, check the data synchronization result. If the data is successfully written to the Redis cache, the synchronization is successful. If the data synchronization result is a failure (possibly due to network problems, Redis server failures, concurrency conflicts, etc.), a retry process is required. Specifically, a data synchronization retry task can be generated based on the resource display location information to be changed, and the task includes the resource display location identifier to be changed, the resource information to be changed, etc. Add the generated data synchronization retry task to the task queue, take out the task from the task queue and execute it. When taking out the data synchronization retry task, retry to synchronize the resource display location information to the Redis cache according to the information in the task. When executing the retry task, you can also record the number of attempts for each retry. If the retry succeeds, update the Redis cache and remove the corresponding task in the task queue. If the retry fails, perform the next retry according to the preset retry strategy (such as fixed time interval retry, exponential backoff retry, etc.). In order to prevent infinite retries from causing resource waste or excessive system load, you can also set a retry threshold. When the number of retries exceeds this threshold, stop the retry operation and record the corresponding error log or alarm information for manual intervention or other recovery measures. The above task retry mechanism helps to efficiently handle resource configuration table change events and ensure that the data in the Redis cache is consistent with the latest resource configuration table. Even if a failure occurs during data synchronization, it can be recovered through the retry mechanism.

[0052] Step 203, in the event of a change event in the resource configuration table, determine whether the monitored change event meets the memory cache condition, wherein the memory cache condition is used to characterize the resource display location for memory cache storage, and the memory cache stores resource display location information corresponding to the resource display location that meets the memory storage condition; if it does, change the resource display location information in the memory cache based on the monitored change event.

[0053] In this embodiment, in order to further improve the efficiency and speed of resource access and reduce the pressure on the Redis cache. After detecting a change event in the resource configuration table, it can also be determined whether the change event involves a resource display location that meets the memory cache conditions. The memory cache conditions can be based on a variety of factors, such as resource access frequency, resource size, resource importance, etc. These factors jointly determine which resource display location information can be stored in the memory to speed up access. If the change event affects the resource display location information in the memory cache (i.e., there is a matching resource display location identifier), the corresponding information in the memory cache is updated according to the content of the change event, such as modifying the value of an existing entry, deleting entries that are no longer needed, or adding new entries. The above steps can intelligently manage the resource display location information in the memory cache, ensuring that when the resource configuration table changes, the memory cache can maintain consistency with the latest configuration, thereby improving the efficiency and speed of resource access.

[0054] In an embodiment of the present application, based on the above-mentioned memory cache, accordingly, querying the target resource information corresponding to the target resource display location identifier in the Redis cache includes: querying the target resource information corresponding to the target resource display location identifier in the memory cache; if the target resource information corresponding to the target resource display location identifier exists in the memory cache, reading the target resource information in the memory cache and sending it to the client; if the target resource information corresponding to the target resource display location identifier does not exist in the memory cache, executing the step of querying the target resource information corresponding to the target resource display location identifier in the Redis cache.

[0055] In this embodiment, when the server is provided with a memory cache for storing resource display location information, when querying the target resource information according to the target resource display location identifier, the query is first performed in the memory cache. If the target resource information corresponding to the target resource display location identifier exists in the memory cache, it is directly read in the memory cache to improve the efficiency and speed of resource access. If it does not exist in the memory cache, it is further queried in the Redis cache.

[0056] In an embodiment of the present application, optionally, the target resource display location identifiers carried in the resource acquisition requests received within a recent preset number of times or a preset duration are counted to obtain resource display location statistical information; based on the resource display location statistical information, the resource display location information stored in the memory cache is eliminated and the memory cache condition is updated.

[0057] In the above embodiment, the server can monitor and collect all resource acquisition requests entering the system, extract the target resource display location identifier from each request, count the collected target resource display location identifiers according to a preset number of times or a preset duration, and generate resource display location statistical information according to the statistical results, so as to eliminate information from the memory cache. Specifically, according to business needs, the elimination strategy of the memory cache can be set, such as the least recently used (LRU), least frequently used (LFU), etc., and based on the resource display location statistical information, a customized elimination strategy can also be set, such as preferentially eliminating resource display location information with a small number of accesses. Further, according to the set elimination strategy, the resource display location information in the memory cache is eliminated, and those resource display location information that no longer meet the cache conditions or have a low access frequency are removed or replaced. In addition, the resource display location statistical information can be further analyzed to identify resource display locations with high access frequency and high user attention, and the storage conditions of the memory cache can be adjusted according to the analysis results. For example, new conditions can be added to ensure that the resource display location information with high frequency of access is always cached in the memory. Furthermore, the updated memory cache conditions are applied to the system to ensure that the memory cache can be managed according to the new conditions during the subsequent resource acquisition request processing. The above method helps to dynamically optimize the use of memory cache according to user access behavior, ensuring that the cache stores the resource display location information that users care about most and access most frequently, thereby improving the overall performance of the system and user experience.

[0058] In an embodiment of the present application, optionally, in step 203, when a change event occurs in the resource configuration table, determining whether the monitored change event satisfies the memory cache condition includes: subscribing to the data synchronization information of the Redis cache through a pre-created memory cache model, wherein the Redis cache publishes a data synchronization success signal when data synchronization is successful; when the memory cache model receives the data synchronization success signal, determining whether the changed resource display location information corresponding to the data synchronization success signal satisfies the memory cache condition.

[0059] In the above embodiment, in order to more accurately control the update of the memory cache and ensure that it is consistent with the data in the Redis cache, a pre-created memory cache model can be used to subscribe to the data synchronization information of the Redis cache. Specifically, a memory cache model can be designed, which is responsible for storing resource display location information that meets specific memory cache conditions, has the ability to subscribe to Redis cache data synchronization information, and can update the memory cache according to the received information. A subscription mechanism is implemented in the memory cache model to subscribe to the data synchronization information published by the Redis cache. After the Redis cache completes the data synchronization operation (i.e., synchronizing the changes in the resource configuration table to the Redis cache), a data synchronization success signal is issued. This signal can be a specific message containing detailed information about the successful completion of the synchronization operation, such as a list of synchronized resource display location identifiers. When the memory cache model receives a data synchronization success signal from the Redis cache, the information contained in the signal is parsed to determine which resource display location information has been updated to the Redis cache, and the memory cache model further determines whether the information meets the memory cache condition based on the resource display location information obtained by parsing. If the changed resource placement information meets the memory cache conditions, the memory cache model will update its internal storage and add the information to the memory cache. If the information already exists in the memory cache, the information will be updated. For resource placement information that does not meet the memory cache conditions, the memory cache model can choose to ignore it. Figure 5 As shown, taking the use of the LRU elimination strategy as an example, the client can send a resource acquisition request to the server through the business query interface. The server first performs a data query in the memory cache. If the requested data is hit in the memory cache, the data is directly returned. If the requested data is not hit in the memory cache, the data query continues to be performed in the Redis cache and the data is returned. Among them, if the server returns a certain piece of data (resource display location information) to the client based on the Redis cache, it can be considered that the data may be relatively popular data in the near future, and the data can also be asynchronously updated to the memory cache so that the data can be directly read from the memory cache later to improve the response efficiency. In addition, the least recently used data may no longer be used in the future, so it can be eliminated first. In the embodiment of the present application, the memory cache can use the LRU elimination strategy to eliminate data to avoid the memory cache occupying too much space and affecting the server operation. Furthermore, in order to ensure data consistency between the memory cache and the Redis cache, the memory cache model can subscribe to the return results of the Redis cache synchronization. After the signal of successful Redis cache synchronization is broadcast, the memory cache model can determine whether the relevant change information hits the memory cache condition based on the signal. If it hits, the memory cache is updated, otherwise the signal can be ignored.

[0060] In an embodiment of the present application, optionally, when the target application is started, the memory cache is initialized based on preset memory cache location information and a resource configuration table of the target application, so that resource display location information matching the preset memory cache location information is stored in the memory cache.

[0061] In this embodiment, when the target application is started, in order to improve the startup speed and operating efficiency of the application, the memory cache can be initialized based on the preset memory cache location information and the resource configuration table of the target application, so that the resource display location information that is expected to be frequently accessed can be pre-loaded into the memory, thereby reducing the number of real-time queries and loads of this information during the operation of the application. The preset memory cache location information can be specified by the content producer, or it can be determined based on the resource display locations of each page of the same type as the multiple pages in the target application by counting the access frequency of each page in the same application and screening multiple pages with higher access frequencies. In this way, initializing the memory cache when the target application is started can significantly improve the startup speed and operating efficiency of the application, especially for those application scenarios with high performance requirements.

[0062] In this embodiment, a method for loading a page of an application is provided, which is applied to a client. Figure 6 As shown, the method includes:

[0063] Step 601, in response to a page loading instruction for a target page in a target application, determining a target resource display location identifier corresponding to the target page, and generating a resource acquisition request based on the target resource display location identifier;

[0064] Step 602: Send the resource acquisition request to the server corresponding to the target application, so that the server queries the Redis cache and returns the target resource information corresponding to the target resource display location identifier to the client, wherein the Redis cache stores the resource display location information of each resource display location corresponding to the target application, and any resource display location information includes the resource display location identifier and resource information corresponding to the corresponding resource display location;

[0065] Step 603: Load the target page based on the target resource information.

[0066] In the above embodiment, optionally, the Redis cache in the server is determined in the following manner: when the target application is started, based on the resource configuration table of the target application, the resource display location information of the target application is initialized into the Redis cache, and the resource display location information in the Redis cache is set to never expire, wherein the resource configuration table includes the resource display location identifier and resource information of each resource display location corresponding to the target application.

[0067] In the above embodiment, optionally, the Redis cache in the server is determined in the following manner: monitoring the resource configuration table of the target application, wherein the resource configuration table is dynamically updated based on the content producer's configuration of the resource display location of the target application and the resource information of the resource display location; when a change event occurs in the resource configuration table, the resource display location information stored in the Redis cache is changed based on the monitored change event.

[0068] In the above embodiment, optionally, based on the monitored change event, the resource display location information stored in the Redis cache is changed, including: in the resource configuration table, obtaining the resource display location identifier and the resource information to be changed corresponding to the monitored change event, and generating the resource display location information to be changed based on the resource display location identifier and the resource information to be changed; synchronizing the Redis cache with the resource display location information to be changed, and obtaining the data synchronization result; if the data synchronization result is a failure, generating a data synchronization retry task based on the resource display location information to be changed, adding the data synchronization retry task to the task queue, and performing a data synchronization retry operation on the Redis cache by executing the data synchronization retry task in the task queue until the data synchronization result of the data synchronization retry task is successful or the number of retries exceeds the retry threshold.

[0069] In the above embodiment, optionally, after monitoring the resource configuration table of the target application, the method further includes: in the case of a change event of the resource configuration table, determining whether the monitored change event satisfies a memory cache condition, wherein the memory cache condition is used to characterize a resource display location for memory cache storage, and the memory cache stores resource display location information corresponding to the resource display location that satisfies the memory storage condition; if yes, then changing the resource display location information in the memory cache based on the monitored change event; accordingly, the server queries the Redis cache and returns the target resource information corresponding to the target resource display location identifier to the client, including: the server queries the memory cache for the target resource information corresponding to the target resource display location identifier; if the target resource information corresponding to the target resource display location identifier exists in the memory cache, then reading the target resource information in the memory cache and sending it to the client; if the target resource information corresponding to the target resource display location identifier does not exist in the memory cache, then querying the Redis cache for the target resource information corresponding to the target resource display location identifier.

[0070] In the above embodiment, optionally, in the event of a change event in the resource configuration table, determining whether the monitored change event meets the memory cache condition, including: subscribing to the data synchronization information of the Redis cache through a pre-created memory cache model, wherein the Redis cache publishes a data synchronization success signal when the data synchronization is successful; when the memory cache model receives the data synchronization success signal, determining whether the changed resource display location information corresponding to the data synchronization success signal meets the memory cache condition.

[0071] In the above embodiment, optionally, the memory cache in the server is determined in the following manner: counting the target resource display location identifiers carried in the resource acquisition requests received within the most recent preset number of times or a preset duration to obtain resource display location statistical information; based on the resource display location statistical information, eliminating the resource display location information stored in the memory cache and updating the memory cache conditions.

[0072] In the above embodiment, optionally, the memory cache in the server is determined in the following manner: when the target application is started, the memory cache is initialized based on preset memory cache location information and a resource configuration table of the target application so that resource display location information matching the preset memory cache location information is stored in the memory cache.

[0073] In the above embodiment, optionally, the resource display location information is stored in a key-value pair format, the key information is determined according to the resource display location identifier, and the value information is determined according to the resource information.

[0074] For the corresponding description of the page loading method of the above application, please refer to the corresponding description of the page resource providing method of the application, which will not be repeated here.

[0075] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a page resource providing device for an application, such as Figure 7 As shown, applied to a server, the device includes:

[0076] The request receiving module 701 is used to receive a resource acquisition request from a target application in a client, wherein the resource acquisition request carries a target resource display location identifier corresponding to a target page requested to be loaded in the client;

[0077] The resource acquisition module 702 is used to query the target resource information corresponding to the target resource display location identifier in the Redis cache, wherein the Redis cache stores the resource display location information of each resource display location corresponding to the target application, and any resource display location information includes the resource display location identifier and resource information corresponding to the corresponding resource display location;

[0078] The information sending module 703 is used to send the target resource information to the client, so that the client loads the target page based on the target resource information.

[0079] In an embodiment of the present application, optionally, the device also includes: a resource cache module 704, which is used to: when the target application is started, based on the resource configuration table of the target application, initialize the resource display location information of the target application to the Redis cache, and set the resource display location information in the Redis cache to never expire, wherein the resource configuration table includes the resource display location identifier and resource information of each resource display location corresponding to the target application.

[0080] In an embodiment of the present application, optionally, the resource cache module 704 is also used to: monitor the resource configuration table of the target application, wherein the resource configuration table is dynamically updated based on the content producer's configuration of the resource display location of the target application and the resource information of the resource display location; when a change event occurs in the resource configuration table, the resource display location information stored in the Redis cache is changed based on the monitored change event.

[0081] In an embodiment of the present application, optionally, the device also includes: the resource cache module 704, which is also used to: obtain the resource display location identifier and the resource information to be changed corresponding to the monitored change event in the resource configuration table, and generate the resource display location information to be changed based on the resource display location identifier and the resource information to be changed; synchronize the Redis cache with the resource display location information to be changed, and obtain the data synchronization result; if the data synchronization result is a failure, generate a data synchronization retry task based on the resource display location information to be changed, add the data synchronization retry task to the task queue, and perform data synchronization retry operations on the Redis cache by executing the data synchronization retry task in the task queue until the data synchronization result of the data synchronization retry task is successful or the number of retries exceeds the retry threshold.

[0082] In an embodiment of the present application, optionally, the resource cache module 704 is further used to: in the event of a change event in the resource configuration table, determine whether the monitored change event meets the memory cache condition, wherein the memory cache condition is used to characterize the resource display location for memory cache storage, and the memory cache stores resource display location information corresponding to the resource display location that meets the memory storage condition; if it does, then change the resource display location information in the memory cache based on the monitored change event; accordingly, the resource acquisition module 702 is further used to: query the memory cache for target resource information corresponding to the target resource display location identifier; if the target resource information corresponding to the target resource display location identifier exists in the memory cache, then read the target resource information in the memory cache and send it to the client; if the target resource information corresponding to the target resource display location identifier does not exist in the memory cache, then execute the step of querying the target resource information corresponding to the target resource display location identifier in the Redis cache.

[0083] Optionally, the resource cache module 704 is also used to: subscribe to the data synchronization information of the Redis cache through a pre-created memory cache model, wherein the Redis cache publishes a data synchronization success signal when the data synchronization is successful; when the memory cache model receives the data synchronization success signal, determine whether the changed resource display location information corresponding to the data synchronization success signal meets the memory cache condition.

[0084] Optionally, the resource cache module 704 is further used to: count the target resource display location identifiers carried in the resource acquisition requests received within the most recent preset number of times or preset duration to obtain resource display location statistical information; based on the resource display location statistical information, eliminate the resource display location information stored in the memory cache and update the memory cache conditions.

[0085] Optionally, the resource cache module 704 is also used to: when the target application is started, initialize the memory cache based on preset memory cache location information and the resource configuration table of the target application, so that resource display location information matching the preset memory cache location information is stored in the memory cache.

[0086] Optionally, the resource display location information is stored in a key-value pair format, the key information is determined according to the resource display location identifier, and the value information is determined according to the resource information.

[0087] It should be noted that for other corresponding descriptions of the functional units involved in the page resource providing device of an application provided in the embodiment of the present application, reference can be made to Figures 1 to 5 The corresponding description in the method will not be repeated here.

[0088] Further, as Figure 6 The specific implementation of the method, the embodiment of the present application provides a page loading device of an application program, such as Figure 8 As shown, applied to a client, the device includes:

[0089] The request generation module 801 is used to respond to a page loading instruction for a target page in a target application, determine a target resource display location identifier corresponding to the target page, and generate a resource acquisition request based on the target resource display location identifier;

[0090] The request sending module 802 is used to send the resource acquisition request to the server corresponding to the target application, so that the server queries the Redis cache and returns the target resource information corresponding to the target resource display location identifier to the client, wherein the Redis cache stores the resource display location information of each resource display location corresponding to the target application, and any resource display location information includes the resource display location identifier and resource information corresponding to the corresponding resource display location;

[0091] The page loading module 803 is used to load the target page based on the target resource information.

[0092] In an embodiment of the present application, optionally, the Redis cache in the server is determined in the following manner: when the target application is started, based on the resource configuration table of the target application, the resource display location information of the target application is initialized into the Redis cache, and the resource display location information in the Redis cache is set to never expire, wherein the resource configuration table includes the resource display location identifier and resource information of each resource display location corresponding to the target application.

[0093] In an embodiment of the present application, optionally, the Redis cache in the server is determined in the following manner: monitoring the resource configuration table of the target application, wherein the resource configuration table is dynamically updated based on the content producer's configuration of the resource display location of the target application and the resource information of the resource display location; when a change event occurs in the resource configuration table, the resource display location information stored in the Redis cache is changed based on the monitored change event.

[0094] In an embodiment of the present application, optionally, based on the monitored change event, the resource display location information stored in the Redis cache is changed, including: in the resource configuration table, obtaining the resource display location identifier and the resource information to be changed corresponding to the monitored change event, and generating the resource display location information to be changed based on the resource display location identifier and the resource information to be changed; synchronizing the Redis cache with the resource display location information to be changed, and obtaining a data synchronization result; if the data synchronization result is a failure, generating a data synchronization retry task based on the resource display location information to be changed, adding the data synchronization retry task to a task queue, and performing a data synchronization retry operation on the Redis cache by executing the data synchronization retry task in the task queue until the data synchronization result of the data synchronization retry task is successful or the number of retries exceeds a retry threshold.

[0095] In an embodiment of the present application, optionally, after monitoring the resource configuration table of the target application, in the event of a change event in the resource configuration table, it is determined whether the monitored change event satisfies a memory cache condition, wherein the memory cache condition is used to characterize a resource display location for memory cache storage, and the memory cache stores resource display location information corresponding to the resource display location that satisfies the memory storage condition; if yes, the resource display location information in the memory cache is changed based on the monitored change event; accordingly, the server queries the Redis cache and returns the target resource information corresponding to the target resource display location identifier to the client, including: the server queries the memory cache for the target resource information corresponding to the target resource display location identifier; if the target resource information corresponding to the target resource display location identifier exists in the memory cache, the target resource information in the memory cache is read and sent to the client; if the target resource information corresponding to the target resource display location identifier does not exist in the memory cache, the target resource information corresponding to the target resource display location identifier is queried in the Redis cache.

[0096] In an embodiment of the present application, optionally, in the event of a change event in the resource configuration table, determining whether the monitored change event meets the memory cache condition, including: subscribing to the data synchronization information of the Redis cache through a pre-created memory cache model, wherein the Redis cache publishes a data synchronization success signal when the data synchronization is successful; when the memory cache model receives the data synchronization success signal, determining whether the changed resource display location information corresponding to the data synchronization success signal meets the memory cache condition.

[0097] In an embodiment of the present application, optionally, the memory cache in the server is determined in the following manner: counting the target resource display location identifiers carried in the resource acquisition requests received within the most recent preset number of times or within a preset duration to obtain resource display location statistical information; based on the resource display location statistical information, eliminating the resource display location information stored in the memory cache and updating the memory cache conditions.

[0098] In an embodiment of the present application, optionally, the memory cache in the server is determined in the following manner: when the target application is started, based on preset memory cache location information and a resource configuration table of the target application, the memory cache is initialized so that resource display location information matching the preset memory cache location information is stored in the memory cache.

[0099] In an embodiment of the present application, optionally, the resource display location information is stored in a key-value pair format, the key information is determined according to the resource display location identifier, and the value information is determined according to the resource information.

[0100] It should be noted that for other corresponding descriptions of the functional units involved in the page loading device of an application provided in an embodiment of the present application, reference can be made to the corresponding descriptions in the above method and will not be repeated here.

[0101] The embodiment of the present application also provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a bus, a processor, a memory and a communication interface, and can also include an input and output interface and a display device. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store location information. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in each method embodiment are implemented.

[0102] Those skilled in the art will appreciate that the structure of the above-mentioned computer device is only a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components, or combine certain components, or have a different arrangement of components.

[0103] In one embodiment, a computer-readable storage medium is provided. The computer-readable storage medium may be non-volatile or volatile, and stores a computer program thereon. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0104] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0105] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0106] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0107] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0108] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for providing page resources of an application, characterized in that: Applied to a server, the method comprises: Receiving a resource acquisition request from a target application in a client, wherein the resource acquisition request carries a target resource display location identifier corresponding to a target page requested to be loaded in the client; Querying the target resource information corresponding to the target resource display location identifier in the Redis cache, wherein the Redis cache stores the resource display location information of each resource display location corresponding to the target application, and any resource display location information includes the resource display location identifier and resource information corresponding to the corresponding resource display location; The target resource information is sent to the client, so that the client loads the target page based on the target resource information.

2. The method according to claim 1, characterized in that Before receiving a resource acquisition request from a target application in a client, the method further includes: When the target application is started, based on the resource configuration table of the target application, the resource display location information of the target application is initialized to the Redis cache, and the resource display location information in the Redis cache is set to never expire, wherein the resource configuration table includes the resource display location identifier and resource information of each resource display location corresponding to the target application.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: Monitoring the resource configuration table of the target application, wherein the resource configuration table is dynamically updated based on the configuration of the resource display location of the target application and the resource information of the resource display location by the content producer; When a change event occurs in the resource configuration table, the resource display location information stored in the Redis cache is changed based on the monitored change event.

4. The method according to claim 3, characterized in that Based on the monitored change event, the resource display location information stored in the Redis cache is changed, including: In the resource configuration table, obtaining the to-be-changed resource display position identifier and the to-be-changed resource information corresponding to the monitored change event, and generating the to-be-changed resource display position information based on the to-be-changed resource display position identifier and the to-be-changed resource information; Synchronize the Redis cache data based on the display location information of the resource to be changed, and obtain the data synchronization result; If the data synchronization result is a failure, a data synchronization retry task is generated based on the display location information of the resource to be changed, and the data synchronization retry task is added to the task queue. By executing the data synchronization retry task in the task queue, a data synchronization retry operation is performed on the Redis cache until the data synchronization result of the data synchronization retry task is successful or the number of retries exceeds the retry threshold.

5. The method according to claim 3, characterized in that: After monitoring the resource configuration table of the target application, the method further includes: In the case of a change event in the resource configuration table, determining whether the monitored change event satisfies a memory cache condition, wherein the memory cache condition is used to characterize a resource display location for memory cache storage, and the memory cache stores resource display location information corresponding to the resource display location that satisfies the memory storage condition; If yes, then changing the resource display location information in the memory cache based on the monitored change event; Accordingly, before querying the Redis cache for the target resource information corresponding to the target resource display location identifier, the method further includes: Querying the memory cache for target resource information corresponding to the target resource display location identifier; If the target resource information corresponding to the target resource display location identifier exists in the memory cache, the target resource information in the memory cache is read and sent to the client; If the target resource information corresponding to the target resource display location identifier does not exist in the memory cache, the step of querying the Redis cache for the target resource information corresponding to the target resource display location identifier is performed.

6. A page loading method for an application, characterized in that: Applied to a client, the method comprises: In response to a page loading instruction for a target page in a target application, determining a target resource display location identifier corresponding to the target page, and generating a resource acquisition request based on the target resource display location identifier; Sending the resource acquisition request to the server corresponding to the target application, so that the server queries the Redis cache and returns the target resource information corresponding to the target resource display location identifier to the client, wherein the Redis cache stores the resource display location information of each resource display location corresponding to the target application, and any resource display location information includes the resource display location identifier and resource information corresponding to the corresponding resource display location; The target page is loaded based on the target resource information.

7. A device for providing page resources for an application, characterized in that: Applied to a server, the device comprises: A request receiving module, used to receive a resource acquisition request from a target application in a client, wherein the resource acquisition request carries a target resource display location identifier corresponding to a target page requested to be loaded in the client; A resource acquisition module, used for querying the target resource information corresponding to the target resource display location identifier in the Redis cache, wherein the Redis cache stores the resource display location information of each resource display location corresponding to the target application, and any resource display location information includes the resource display location identifier and resource information corresponding to the corresponding resource display location; The information sending module is used to send the target resource information to the client, so that the client loads the target page based on the target resource information.

8. A page loading device for an application, characterized in that: Applied to a client, the device comprises: A request generation module, configured to respond to a page loading instruction for a target page in a target application, determine a target resource display location identifier corresponding to the target page, and generate a resource acquisition request based on the target resource display location identifier; A request sending module, used for sending the resource acquisition request to the server corresponding to the target application, so that the server queries the Redis cache and returns the target resource information corresponding to the target resource display location identifier to the client, wherein the Redis cache stores the resource display location information of each resource display location corresponding to the target application, and any resource display location information includes the resource display location identifier and resource information corresponding to the corresponding resource display location; A page loading module is used to load the target page based on the target resource information.

9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

10. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Cited By

  • Equipment resource decryption method and device, electronic equipment and storage medium

    CN119312372A