A resource calling method and apparatus

By pre-cacheting external resources in the local intranet and intercepting duplicate requests, the bandwidth usage and waiting time problems of devices when downloading external resources are solved, and faster download speed and lower waiting time are achieved.

CN115460197BActive Publication Date: 2025-05-27BEIJING CENTURY TAL EDUCATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211261933.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-14
Publication Date
2025-05-27
Estimated Expiration
2042-10-14

AI Technical Summary

Technical Problem

In the same network environment, when the device downloads or loads external resources, repeated downloads of resources lead to unnecessary bandwidth usage and waiting time, especially when the bandwidth is limited, the download speed is slow and the waiting time is long.

Method used

By pre-cacheting external resources in the local intranet and intercepting repeated requests to the local out-of-site network, pre-cache resources are loaded or downloaded directly from the local intranet's local storage.

Benefits of technology

It improves the download speed or loading speed of the required resources by the device, reduces the use of external bandwidth, reduces the resource waiting time, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115460197B_ABST
    Figure CN115460197B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a resource calling method and apparatus. The resource calling method is applied to a first device in a local intranet, and includes: sending first request information to a local extranet and receiving first response information generated by the local extranet according to the first request information, where the first request information is used to request header information of a target resource; obtaining second response information, where the second response information is response information of the target resource in a second device that is in the same local intranet as the first device; if at least some of the header information is the same between the first response information and the second response information, then intercepting second request information sent to the local extranet and sending the modified second request information to the second device to call the target resource pre-cached in the second device. The method provided by the present disclosure improves the download speed or loading speed of the required resources by the first device, reduces the occupation of the bandwidth of the local extranet, and further reduces the resource waiting time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of network technologies, and in particular, to a resource calling method and apparatus. Background Art

[0002] Currently, when one or more devices in the same network environment need to download or load external resources, if the resources are downloaded repeatedly, it will cause unnecessary occupation of external bandwidth and download waiting problems. In the case of limited bandwidth, when the device is in use and the downloaded resource file is relatively large, the download speed is relatively slow and the resource waiting time is relatively long when downloading files through a public network. Summary of the Invention

[0003] To solve the above technical problems, the present disclosure provides a resource calling method and apparatus, which improve the download speed or loading speed of the resources required by the device, reduce the occupation of the local external network bandwidth, and further reduce the resource waiting time.

[0004] According to one aspect of the present disclosure, there is provided a resource calling method, which is applied to a first device in a local area internal network. The method includes:

[0005] Sending first request information to a local area external network and receiving first response information generated by the local area external network according to the first request information, where the first request information is used to request header information of a target resource;

[0006] Obtaining second response information, where the second response information is response information of the target resource in a second device in the same local area internal network as the first device;

[0007] If at least some of the header information between the first response information and the second response information is the same, intercepting second request information sent to the local area external network and sending the modified second request information to the second device to call the target resource pre-cached in the second device.

[0008] According to another aspect of the present disclosure, there is provided a resource calling method, which is applied to a second device in the same local area internal network as the first device. The method includes:

[0009] Receiving second request information sent by the first device for requesting a target resource;

[0010] Determining the target resource pre-cached in the local storage according to a first address in the second request information for the first device to call.

[0011] According to another aspect of the present disclosure, there is provided a resource calling apparatus, which is applied to a first device in a local area internal network. The apparatus includes:

[0012] A first receiving module, configured to send first request information to a local external network and receive first response information generated by the local external network according to the first request information, where the first request information is used to request header information of a target resource;

[0013] An obtaining module, configured to obtain second response information, where the second response information is response information of the target resource in a second device that is in the same local internal network as the first device;

[0014] An invoking module, configured to, if at least some of the header information is the same between the first response information and the second response information, intercept second request information sent to the local external network and send the modified second request information to the second device, so as to invoke the target resource pre-cached in the second device.

[0015] According to another aspect of the present disclosure, there is provided a resource invoking device, which is applied to a second device that is in the same local internal network as a first device. The device includes:

[0016] A second receiving module, configured to receive second request information sent by the first device and used to request a target resource;

[0017] A determining module, configured to determine the target resource pre-cached in a local storage according to a first address in the second request information, for the first device to invoke.

[0018] According to another aspect of the present disclosure, there is provided an electronic device, where the electronic device includes: a processor; and a memory storing a program, where the program includes instructions that, when executed by the processor, cause the processor to execute the resource invoking method according to the above.

[0019] According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to cause a computer to execute the resource invoking method.

[0020] According to another aspect of the present disclosure, there is provided a computer program product, including a computer program that, when executed by a processor, implements the above resource invoking method.

[0021] The technical solution provided by the embodiments of the present disclosure has the following advantages compared with the prior art:

[0022] An embodiment of the present disclosure provides a resource calling method, which is applied to a first device in a local intranet, and includes: sending first request information to a local extranet and receiving first response information generated by the local extranet according to the first request information, where the first request information is used to request the header information of a target resource; obtaining second response information, where the second response information is the response information of the target resource in a second device that is in the same local intranet as the first device; if at least some of the header information is the same between the first response information and the second response information, intercepting second request information sent to the local extranet and sending the modified second request information to the second device to call the target resource pre-cached in the second device. The method provided by the present disclosure improves the download speed or loading speed of the resources required by the device, reduces the occupation of external bandwidth, and further reduces the resource waiting time. Description of the Drawings

[0023] The drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present disclosure and, together with the specification, are used to explain the principles of the present disclosure.

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0025] Figure 1 It is a schematic diagram of the application scenario provided by the embodiment of the present disclosure;

[0026] Figure 2 It is a flowchart of the resource calling method provided by the embodiment of the present disclosure;

[0027] Figure 3 It is a flowchart of the resource calling method provided by the embodiment of the present disclosure;

[0028] Figure 4 It is a schematic structural diagram of the resource caching service provided by the embodiment of the present disclosure;

[0029] Figure 5 It is a schematic structural diagram of the resource calling device provided by the embodiment of the present disclosure;

[0030] Figure 6 It is a schematic structural diagram of the resource calling device provided by the embodiment of the present disclosure;

[0031] Figure 7 It is a schematic structural diagram of the electronic device provided by the embodiment of the present disclosure. Detailed Embodiments

[0032] To more clearly understand the above objects, features, and advantages of the present disclosure, embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Instead, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.

[0033] It should be understood that the various steps recited in the method embodiments of the present disclosure can be executed in a different order and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.

[0034] The term "including" and its variations used herein are open-ended, that is, "including but not limited to". The term "based on" is "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description. It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules, or units, and are not used to limit the order or interdependence relationship of the functions performed by these devices, modules, or units.

[0035] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive. Those skilled in the art should understand that unless clearly stated otherwise in the context, it should be understood as "one or more".

[0036] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.

[0037] Before describing the resource invocation method provided by the embodiments of the present disclosure, the professional terms involved will be explained first, where:

[0038] Local Area Network (LAN): A regional network formed in a local area. Its characteristics are that the distribution area is limited, generally using private network addresses. The network transmission speed between multiple devices in the local area network is relatively faster than that of other networks, the performance is more stable, the framework is simple, and it is closed. The security of data transmission within the network is relatively good.

[0039] Wide Area Network (WAN): A wide area network, also known as an external network, public network, or outside network, is a remote network that connects computers in different local area networks or metropolitan area networks.

[0040] In view of the above technical problems, embodiments of the present disclosure provide a resource calling method. When one or more devices in the same network environment (the same local area network) need to use external (wide area network) resources, the required external resources are pre-cached in the local storage of the local area network when the local area network is idle. When the resources required by the device have not been updated, the resources stored locally are directly downloaded or loaded through the local file service deployed in the local area network, that is, the second request information sent to the wide area network is intercepted and redirected to the local area network. Here, calling resources can be understood as loading resources and / or downloading resources. The method provided by the present disclosure can quickly download or load the resources required by the device based on the characteristics of the local area network, effectively saving external bandwidth and traffic. Moreover, resource pre-caching is performed when the local area network is idle, reasonably utilizing network resources and reducing waste of network resources. Since the resources are cached in the local area network, it can also prevent the device from downloading repeatedly and directly use the resources cached in the local area network. The method provided by the present disclosure can be effectively applied to a teaching tutoring base in an online live broadcast scenario. The teaching tutoring base has a local area network deployed, but the overall network bandwidth is limited. The courseware used during teaching live broadcasts is large. By pre-caching resources in the local area network in advance, when the device uses the visible resources, it directly obtains them from the local storage of the local area network, improving the acquisition speed of the courseware resources and reducing the waiting time.

[0041] Exemplarily, Figure 1 is a schematic diagram of the application scenario provided by embodiments of the present disclosure, Figure 1 including a local area network 110 and a wide area network 120. Among them, the local area network 110 includes a plurality of first devices 111 and at least one second device 112. The first device 111 is a client for users within the local area network, and the client can be a portable mobile terminal, a personal computer (PC), and / or a tablet computer, etc. The second device 112 is a server deployed with a custom resource caching service. The second device 112 can manage and perform task scheduling for the local area network. The wide area network 120 includes a server 121 that interacts with the second device 112.

[0042] Figure 2 is a flowchart of the resource calling method provided by embodiments of the present disclosure, which is applied to the first device in the local area network and is applicable to Figure 1 the application scenario shown. The first device can be a personal computer connected to the local area network, and specifically includes the following steps S210 to S230 as shown in Figure 2 :

[0043] S210. Send the first request message to the local external network and receive the first response message generated by the local external network according to the first request message.

[0044] Wherein, the second device and the first device are in the same local internal network. The first request message is used to request the header information of the target resource.

[0045] Understandably, the first device sends a request message to the local external network for the first time. This request message is denoted as the first request message. The first request message is used to request the header information of the target resource. The request message includes a request line, request headers, and a request body. The request line is composed of information such as the request method, the Uniform Resource Identifier (URI) of the target resource, and the version of the Hyper Text Transfer Protocol (HTTP). Among them, the URI is a string used to identify the name of a certain Internet resource. Uniform Resource Locators (URLs) and Uniform Resource Names (URNs) that are used to identify resources also belong to URIs; the request headers are used to record the basic information of the first device. For example, the operating system used by the first device, the domain name information of the current request, etc.; in the case where the first device needs to send user information, the user information will be sent through the request body. Subsequently, the first device sends the first request message to the local external network. After receiving the first request message, the local external network will generate a response message according to the request message. This response message is denoted as the first response message. Subsequently, the first response message is returned to the first device. Among them, the first response message includes a response line, response headers (header information), and a response body. The response line includes the protocol version and the status code. If an error occurs, the server in the local external network will return the corresponding processing result through the status code of the request line. For example: a status code of 200 indicates successful processing, a status code of 404 indicates that the page was not found, and a status code of 500 indicates a server error; the header information includes the time when the return message was generated, the return type, and an attribute tag of Last-Modified. Last-Modified is used to mark the time when the target resource was last modified in the local external network. For example, the attribute tag of Last-Modified is Last-Modified: Fri, 12 May 2006 18:53:33 GMT; the response body usually contains the actual content of the web page.

[0046] S220. Obtain a second response message, where the second response message is the response message of the target resource in a second device that is in the same local internal network as the first device.

[0047] Optionally, the obtaining of the second response information in S120 above may be specifically implemented through the following steps:

[0048] Determine whether the target resource is called for the first time. If not, obtain the second response information from the local storage.

[0049] If so, send the first request information to the second device and receive the second response information generated by the second device according to the first request information.

[0050] It can be understood that, based on S210 above, the second response information is obtained, and the second response information reflects the state of the target resource in the second device. The second response information can be obtained through the following two methods. Among them, in the first case: the first device will pre-store the second response information. In this case, the second response information can be directly obtained from the local storage. When the first device calls the target resource for the first time, it will send the first request information to the local area network and the second device respectively. When at least some of the header information of the first response information and the second response information is the same, the second response information will be stored. When the target resource is called non-first time, only the second response information needs to be directly obtained. In the second case, the first device obtains the second response information generated by the second device according to the first request information. The first device calls the target resource for the first time, or it is determined that the stored second response information is different from the first response information when the target resource was called last time, that is, when the target resource on the local area network was modified last time and the second device has not yet synchronized the modified target resource. In this case, the stored second response information is not valuable for reference and the second response information needs to be re-obtained.

[0051] It is understandable that while the second device pre-caches resources, it also records the original information of each pre-cached resource, such as the resource name, type, last modified time, etc. After receiving the first request information sent by the first device, the second device will also generate a response information according to the first request information, which is recorded as the second response information. The second response information also includes header information, that is, the first response information and the second response information have the same structure, but the actual data may be different. If the second device pre-caches the target resource in the local storage of the local area network, then the second response information reflects the cache information of the target resource in the local area network, and the first response information reflects the real-time information of the target resource in the wide area network. The information about the target resource between the two may not be synchronized. Generally speaking, the information update time of the target resource in the wide area network is earlier than that in the local area network. After the target resource in the wide area network is updated, the local area network will also update the target resource through the wide area network during idle time; if the local area network does not pre-store the target resource, then the returned second response information will have a mark indicating that the target resource does not exist. In this case, the first device can directly load or download the target resource from the wide area network.

[0052] S230. If at least some of the header information between the first response information and the second response information is the same, intercept the second request information sent to the wide area network, and send the modified second request information to the second device to call the target resource pre-cached in the second device.

[0053] Understandably, based on the above S220, after the first device receives the first response message and obtains the second response message, it compares whether at least part of the header information in them is the same. If they are the same, it means that the latest version of the target resource is pre-stored in the local intranet. Then, it intercepts the second request message sent to the local extranet and modifies the second request message, that is, redirects the target resource to the local intranet, and downloads or loads the target resource pre-cached in the local intranet. This method can improve the download speed and reduce the waiting time. The second request message includes a first address, and the first address is the access address of the target resource in the local extranet. Specifically, the first address refers to the URL. After the first device sends the first request message, it will send an access request (the second request message) based on the URL to the local extranet again. That is, it is necessary to intercept the access request sent by the first device to the local extranet and redirect the URL to the local intranet where the target resource is stored. Redirection means redirecting the network request to another location. For example, the redirection of web pages and domain names. Specifically, after redirecting the URL to the local file service of the second device, the target resource pre-stored can be called (downloaded or loaded) from the local storage of the local intranet through the custom local file service in the second device. The local file service is used to provide the ability to download externally for the local storage in the local intranet, so that the first device can download resources from the local storage later.

[0054] Among them, the header information includes a time attribute and a message length.

[0055] Optionally, the above S230 is specifically implemented through the following steps:

[0056] If the time attribute and the message length in the first response message and the second response message are the same, then intercept the second request message sent to the local extranet, where the second request message includes a first address, and the first address includes the domain name of the local extranet.

[0057] Modify the domain name of the local extranet in the first address to the domain name of the local intranet to obtain the modified second request message, and send the modified second request message to the second device.

[0058] It is understandable that after the first device receives the first response message and obtains the second response message, it determines whether the time attribute and message length (content-length) of the target resource included in the response headers of the first response message and the second response message are the same. If so, it intercepts the second request message sent to the local area wide area network, that is, it does not access the local area wide area network. Among them, the time attribute includes the last modified time. The second request message includes a first address, and the first address includes the domain name of the local area wide area network and other identifiers related to the target resource. The first address refers to the download address of the target resource on the local area wide area network. The download address includes the domain name of the local area wide area network and the identifier of the target resource, etc. The download address can be regarded as the original address. Subsequently, it modifies the domain name of the local area wide area network in the first address to the domain name of the local area network, and sends the obtained modified second request message to the second device to redirect the first address to the local file service in the second device. When customizing the local file service, an invocation name identical to the domain name of the local area network needs to be applied for the local file service, so that the invocation name of the local file service is the same as the domain name of the local area network. Based on the invocation name of the local file service, the local file service can be invoked to download the cached resource from the local storage. Subsequently, the first device will re-navigate based on the modified first address and invoke the target resource pre-cached in the local area network.

[0059] It is understandable that the invocation names of the local file services deployed in different local area networks are the same as the domain names of their corresponding local area networks. This method can be applied to different local area networks, and the parameters that need to be adjusted or modified are relatively few, and the feasibility is relatively strong.

[0060] Optionally, in the case of the first invocation and at least partial header information being the same between the target resource, the first response message, and the second response message, store the second response message in the local storage.

[0061] It is understandable that if the first device determines that the first response message and the second response message have at least partial identical header information, that is, when the last modified time and message length of the target resource are the same, it indicates that the target resources in the local area wide area network and the local area network are synchronized. In this case, directly store the second response message. Since the resources pre-cached in the local area network will not be updated actively, only when the resources in the local area wide area network are updated, the resources in the local area network will be updated passively. Therefore, the second response message stored by the first device mainly records the information of the resources currently cached in the local area network, and the update situation of the resources in the local area wide area network cannot be controlled.

[0062] Optionally, if the first device determines that the header information included in the first response message and the second response message is different, the following steps can be executed:

[0063] If the header information of the first response message and the second response message is different, the second request message is sent to the local external network to invoke the target resource in the local external network.

[0064] It can be understood that if the first device determines that the header information included in the first response message and the second response message is different, the second request message is sent to the local external network, and the target resource is used from the local external network based on the first address in the second request message, that is, the target resource in the local external network is accessed based on the first address for loading or downloading the target resource, and there is no need to redirect the first address. In one possible case, the target resource in the local external network has been updated, while the target resource pre-cached in the local internal network has not been updated accordingly, resulting in differences in the time when the target resource was last modified (last-modify) and / or the message length in the first response message and the second response message, indicating that the target resource pre-cached in the local internal network is not the latest version; in another possible case, the local internal network does not pre-cache the target resource. In the above two possible cases, the first device does not need to intercept and redirect the first address, and can directly download or load the target resource through the local external network based on the first address.

[0065] It can be understood that when a user loads a resource through a browser in the first device, URL interception is performed. If a resource file is matched in the local internal network according to the header information, and the time when the resource file was last modified during the local internal network request is the same as the time when the resource file was last modified and the message length returned by the local external network request, the corresponding URL request is redirected to the local file service in the local internal network for loading through the local internal network; otherwise, it is loaded through the local external network.

[0066] Optionally, when the first device is not using the target resource for the first time and the first device has pre-stored the second response message of the target resource, that is, when the first device needs to load the target resource again, the following steps can be specifically executed:

[0067] When using the target resource next time, resend the first request message to the local external network and receive the third response message generated by the local external network according to the resent first request message.

[0068] If at least some of the header information between the third response message and the stored second response message of the target resource is the same, intercept the second request message and redirect the first address in the second request message to the local file service.

[0069] Understandably, when the first device needs to load the target resource again, it resends the first request message to the local external network and receives the third response message generated by the local external network based on the resent first request message. In this case, only the first request message needs to be sent to the local external network, and there is no need to send the first request message to the local internal network. Each time a resource is loaded, the second response message of the resource that has been cached by the local internal network is stored. Therefore, the stored second response message of this resource can be directly obtained. Determine whether the last modified time and the message length of the target resource in the header information included in the third response message are the same as those in the header information of the second response message of the target resource stored last time. If so, redirect the first address of the target resource to the local file service again, that is, modify the domain name of the local external network in the first address to the call name of the local file service (the domain name of the local internal network). Based on the modified first address, load the target resource through the local internal network; if not, directly load the target resource through the local external network. At the same time, notify the second device to update the cached target resource from the local external network when the local internal network is idle.

[0070] An embodiment of the present disclosure provides a resource calling method, which is applied to a first device in a local internal network. The first device sends the first request message to the local external network and receives the first response message returned by the local external network, and obtains the second response message of the second device. The second response message may be pre-stored or may be generated by the second device according to the first request message. Herein, the second device and the first device are in the same local internal network. Subsequently, it is determined whether at least some of the information in the header information included in the first response message and the second response message is the same. If so, it means that the local internal network has pre-cached the latest version of the target resource. In this case, intercept the second request message for the target resource to be sent to the local external network, and send the modified second request message to the second device. Specifically, modify the domain name of the local external network in the first address of the second request message to the domain name of the local internal network. Herein, the call name of the local file service is the same as the domain name of the local internal network, so as to complete the redirection of the first address, and download or load the pre-cached target resource from the local storage of the local internal network through the local file service, that is, use the target resource through the local internal network. According to the characteristics of the local internal network, the method provided by the present disclosure speeds up the download speed of the target resource, saves the occupation of the external bandwidth, reduces the download waiting time, improves the user experience. At the same time, cache resources during the idle time of the local internal network, making full and reasonable use of the network resources of the local internal network, and avoiding the problem of insufficient bandwidth during the peak network usage period of the local internal network.

[0071] Based on the above embodiment, Figure 3 The flowchart of the resource calling method provided by the embodiment of the present disclosure is applied to a second device in the same local internal network as the first device and can be applied inFigure 1 In the scenario, the second device may be a server, specifically including the following steps S310 to S330 as shown in Figure 3 the following:

[0072] Exemplarily, referring to Figure 4 , Figure 4 FIG. is a schematic structural diagram of a resource caching service provided by an embodiment of the present disclosure. The resource caching service 400 is deployed on the second device. The resource caching service 400 includes a task scheduling service 410, a resource downloading service 420, and a local file service 430. The task scheduling service 410 is used to obtain a resource list to be pre-cached from a custom backend service. Among them, the backend service is centrally deployed on the server. The server is connected to the second devices in each base local area network. Each base is distributed. The second device of each base will send a resource caching request with a resource tag to the backend service in the server. For example, the second device of base A sends a resource caching request A to the backend service. The resource caching request A includes the tags of all resources that need to be cached by base A. After receiving the resource caching request A, the backend service retrieves all resources in the resource caching request A in the backend database, generates a resource list A for the retrieved resources, and returns the resource list A to the second device of base A. The resource list includes the download addresses of the resources. Subsequently, the task scheduling service 410 distributes tasks when the network is idle according to the CPU running conditions of the second device, the network usage conditions of the local area network, and the time period, and distributes the caching tasks of each resource to the resource downloading service 420. At the same time, the task scheduling service 410 also manages the resource downloading situation in the resource downloading service 420. For example, tasks with failed resource downloads are redistributed, etc. The task scheduling service 410 also regularly clears the resource files cached in the local area network, clears the resource files that have existed for a long time and are not used for a long time, and releases the local storage space of the local area network. The resource downloading service 420 can execute multiple download tasks distributed by the task scheduling service 410 in parallel. For example, it simultaneously executes download task 1, download task 2, and download task 3 distributed by the task scheduling service 410. Each download task is used to execute the download of at least one resource. For example, download task 1 needs to download resource 1 and resource 2. Specifically, the number of resources downloaded by each task is not limited and can be determined according to user needs. Download the corresponding resources according to the download addresses in the download tasks and store them in the local storage of the local area network for use by the first device. The local file service 430, also known as the local area network file service, is used to provide a service for the first device to load or download resources from the local storage.

[0073] S310. Receive second request information sent by the first device for requesting a target resource.

[0074] Understandably, the second device receives the second request information sent by the first device for requesting the target resource.

[0075] S320. Determine the pre-cached target resource in the local storage according to the first address in the second request information for the first device to call.

[0076] Understandably, the second request information includes the first address (URL) of the target resource. Based on the first address, the second device locates the target resource in the local storage through the deployed local file service and returns the data with the target resource to the first device. The first device can directly download or load the target resource based on the received data.

[0077] Optionally, before receiving the second request information sent by the first device for requesting the target resource, the second device may also receive the first request information sent by the first device, which specifically includes the following steps:

[0078] Receive the first request information sent by the first device for requesting the header information of the target resource;

[0079] Return the second response information generated according to the first request information to the first device.

[0080] Understandably, the second device generates the second response information according to the first request information. The second response information has the same structure as the first response information. When the target resource is cached in the local storage, the header information including the last modification time and the message length of the target resource will also be generated and the second response information will be returned to the first device.

[0081] Optionally, the second device can pre-cache the resource through the following steps:

[0082] Obtain the download request for downloading the target resource, where the download request includes the download address of the target resource on the local area wide area network.

[0083] When the local area network is idle, download the target resource from the local area wide area network to the local storage of the second device according to the download address and synchronize the resource information of the target resource to the local storage.

[0084] Delete the domain name of the local area wide area network included in the download address and determine the deleted download address as the storage path of the target resource in the second device.

[0085] Understandably, the task scheduling service in the second device obtains a resource list sent by the backend service, which includes download requests for resources to be cached. The resource list includes download requests for resources to be cached, and the resources to be cached at least include target resources. Among them, the download request includes the download address of the resource to be cached in the local area wide area network. Subsequently, when the local area network is idle, the task scheduling module generates corresponding download tasks according to the download requests of each resource to be cached, and distributes the download tasks to the resource download service. The resource download service processes multiple download tasks in parallel, downloads the resources to be cached, and stores them in the local storage of the resource intranet. During the process of resource download, the original information of the resource will also be synchronized to the local area network for storage. The original information is also the resource information, including the resource name, resource type, the last modification time of the resource, and the length information, etc., which is convenient for the subsequent second device to generate the second response information according to the first request information. After the resource download is completed, the domain name of the local area wide area network included in the download address will be removed, and the remaining part of the download address will be used as the storage path of the resource in the second device, which is convenient for the subsequent second device to locate the resource according to the modified first address.

[0086] A resource calling method provided by an embodiment of the present disclosure is applied to a second device in the same local area intranet as the first device. In one possible case, the second device receives the first request information sent by the first device and returns the second response information generated according to the first request information to the first device. When the latest version of the target resource is pre-cached in the local area intranet, the first device will send the modified second request information to the second device. The second request information includes a first address, and the domain name of the local area wide area network in the first address has been modified to the domain name of the local area intranet. Subsequently, based on the first address, the second device provides the target resource for the first device from the local storage of the local area intranet through a custom local file service. The first device can download / call the target resource from the local storage. In another possible case, when the first device calls the target resource for non-first time and stores the second response information on it, when it is determined that at least part of the header information of the first response information and the second response information is the same, the second request information with the modified first address can be directly sent to the second device without sending the first request information, and the second device directly receives the second request information. The method provided by the embodiment of the present disclosure also returns the second response information with the same structure as the first response information in the local area intranet for the first device to judge the situation of the resource. At the same time, a custom analog http server is defined, which can provide a service for devices in the local area network to download resource files from the local storage, mount the resource files to the local file service, and provide the ability to download externally, providing support for the resource calling method provided by the present disclosure.

[0087] Based on the above embodiments, Figure 5Schematic diagram of the resource calling device provided by the embodiments of the present disclosure. The resource calling device 500 is applied to the first device in the local intranet. The resource calling device 500 includes a first receiving module 510, an obtaining module 520, and a calling module 530, where:

[0088] The first receiving module 510 is configured to send the first request information to the local extranet and receive the first response information generated by the local extranet according to the first request information. The first request information is used to request the header information of the target resource.

[0089] The obtaining module 520 is configured to obtain the second response information, where the second response information is the response information of the target resource in the second device in the same local intranet as the first device.

[0090] The calling module 530 is configured to intercept the second request information sent to the local extranet and send the modified second request information to the second device to call the target resource pre-cached in the second device if at least some of the header information between the first response information and the second response information is the same.

[0091] Optionally, the calling module 530 is specifically configured to:

[0092] Determine whether the target resource is called for the first time. If not, obtain the second response information from the local storage.

[0093] If so, send the first request information to the second device and receive the second response information generated by the second device according to the first request information.

[0094] Optionally, the header information includes the time when the target resource was last modified and the message length.

[0095] Optionally, the calling module 530 is specifically configured to:

[0096] If the time attribute and the message length in the first response information and the second response information are the same, intercept the second request information sent to the local extranet, where the second request information includes a first address, and the first address includes the domain name of the local extranet.

[0097] Modify the domain name of the local extranet in the first address to the domain name of the local intranet to obtain the modified second request information, and send the modified second request information to the second device.

[0098] Optionally, the device 500 is further configured to:

[0099] If the header information of the first response message and the second response message is different, send the second request message to the local external network to invoke the target resource in the local external network.

[0100] Optionally, the apparatus 500 is further configured to:

[0101] In the case of the first invocation and at least some of the header information between the target resource, the first response message, and the second response message being the same, store the second response message in the local storage.

[0102] The apparatus provided in this embodiment has the same implementation principle and the same technical effects as the foregoing method embodiment. For the sake of brief description, for the parts not mentioned in the apparatus embodiment, reference may be made to the corresponding content in the foregoing method embodiment.

[0103] Based on the above embodiment, Figure 6 FIG. is a schematic structural diagram of a resource invocation apparatus provided in an embodiment of the present disclosure. The resource invocation apparatus 600 is applied to a second device in the same local internal network as the first device. The resource invocation apparatus 600 includes a second receiving module 610 and a determination module 620, where:

[0104] The second receiving module 610 is configured to receive the second request message for requesting the target resource sent by the first device;

[0105] The determination module 620 is configured to determine the target resource cached in advance in the local storage according to the first address in the second request message for the first device to invoke.

[0106] Optionally, the apparatus 600 is further configured to:

[0107] Receive the first request message for the header information of the target resource sent by the first device;

[0108] Return the second response message generated according to the first request message to the first device.

[0109] Optionally, the apparatus 600 is further configured to:

[0110] Obtain a download request for downloading the target resource, where the download request includes the download address of the target resource in the local external network;

[0111] In the case that the local internal network is idle, download the target resource from the local external network to the local storage of the second device according to the download address, and synchronize the resource information of the target resource to the local storage;

[0112] Delete the domain name of the local external network included in the download address, and determine the download address after deletion as the storage path of the target resource in the second device.

[0113] The device provided in this embodiment has the same implementation principle and the same technical effects as the foregoing method embodiment. For a brief description, for the parts not mentioned in the device embodiment, reference may be made to the corresponding content in the foregoing method embodiment.

[0114] An exemplary embodiment of the present disclosure further provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program that can be executed by the at least one processor, and when the computer program is executed by the at least one processor, it is used to cause the electronic device to execute the method according to the embodiment of the present disclosure.

[0115] An exemplary embodiment of the present disclosure further provides a computer program product, including a computer program, wherein when the computer program is executed by a processor of a computer, it is used to cause the computer to execute the method according to the embodiment of the present disclosure.

[0116] Reference Figure 7 , the structural block diagram of the electronic device 700 that can be used as the server or client of the present disclosure will now be described. It is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are only examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0117] As Figure 7 shown, the electronic device 700 includes a computing unit 701, which can execute various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 702 or the computer program loaded from the storage unit 708 into the random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. The input / output (I / O) interface 705 is also connected to the bus 704.

[0118] Multiple components in the electronic device 700 are connected to the I / O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 can be any type of device capable of inputting information into the electronic device 700. The input unit 706 can receive input numerical or character information, and generate key signal inputs related to user settings and / or function controls of the electronic device. The output unit 707 can be any type of device capable of presenting information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 704 can include but is not limited to a magnetic disk and an optical disc. The communication unit 709 allows the electronic device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a BluetoothTM device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0119] The computing unit 701 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include but are not limited to a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 executes the various methods and processes described above. For example, in some embodiments, the resource invocation method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 700 via the ROM 702 and / or the communication unit 709. In some embodiments, the computing unit 701 can be configured to execute the resource invocation method by any other suitable means (e.g., by means of firmware).

[0120] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowchart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, executed as an independent software package partially on the machine and partially on a remote machine, or executed entirely on a remote machine or server.

[0121] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0122] As used in this disclosure, the terms “machine-readable medium” and “computer-readable medium” refer to any computer program product, electronic device, and / or apparatus (e.g., a disk, an optical disk, a memory, a programmable logic device (PLD)) that can be used to provide machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term “machine-readable signal” refers to any signal that can be used to provide machine instructions and / or data to a programmable processor.

[0123] To provide for interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide for interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, speech input, or tactile input).

[0124] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.

[0125] A computer system can include clients and servers. The clients and servers are generally remote from each other and typically interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other.

[0126] The above are only specific embodiments of the present disclosure, enabling those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to these embodiments described herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.

Claims

1. A resource invocation method, characterized in that, it is applied to a first device in a local intranet, and the method includes: sending first request information to a local extranet and receiving first response information generated by the local extranet according to the first request information, wherein the first request information is used to request header information of a target resource; obtaining second response information, wherein the second response information is response information of the target resource in a second device that is in the same local intranet as the first device; if at least some of the header information is the same between the first response information and the second response information, intercept second request information sent to the local extranet, and send the modified second request information to the second device to invoke the target resource pre-cached in the second device.

2. The method according to claim 1, characterized in that, the obtaining of the second response information includes: determining whether the target resource is invoked for the first time, if not, obtaining the second response information from local storage; if so, sending the first request information to the second device and receiving second response information generated by the second device according to the first request information.

3. The method according to claim 2, characterized in that, the method further includes: when invoking for the first time and at least some of the header information is the same between the target resource, the first response information and the second response information, storing the second response information in the local storage.

4. The method according to claim 1, characterized in that, the header information includes the time attribute and message length of the target resource; the if at least some of the header information is the same between the first response information and the second response information, intercept second request information sent to the local extranet, and send the modified second request information to the second device, includes: if the time attribute and the message length are the same in the first response information and the second response information, intercept the second request information sent to the local extranet, wherein the second request information includes a first address, and the first address includes the domain name of the local extranet; modify the domain name of the local extranet in the first address to the domain name of the local intranet to obtain modified second request information, and send the modified second request information to the second device.

5. The method according to claim 1, characterized in that, the method further includes: if the header information of the first response information and the second response information is different, send the second request information to the local extranet to invoke the target resource in the local extranet.

6. A resource invocation method, characterized in that, it is applied to a second device that is in the same local intranet as the first device, and the method includes: Receive the second request information for requesting a target resource sent by the first device; wherein, the second request information is intercepted and modified by the first device and then forwarded after determining that the target resource is pre-cached in the second device after comparing the header information, and the original second request information sent to the local area wide area network is intercepted. Determine the pre-cached target resource in the local storage according to the first address in the second request information for the first device to call.

7. The method according to claim 6, wherein, Before receiving the second request information for requesting a target resource sent by the first device, the method further includes: Receive the first request information for requesting the header information of the target resource sent by the first device; Return the second response information generated according to the first request information to the first device.

8. The method according to claim 6, wherein, Before receiving the second request information for requesting a target resource sent by the first device, the method further includes: Obtain a download request for downloading the target resource, wherein the download request includes the download address of the target resource on the local area wide area network; When the local area network is idle, download the target resource from the local area wide area network to the local storage of the second device according to the download address, and synchronize the resource information of the target resource to the local storage; Delete the domain name of the local area wide area network included in the download address, and determine the download address after deletion as the storage path of the target resource in the second device.

9. A resource calling device, wherein, Applied to the first device in the local area network, the device includes: A first receiving module, configured to send the first request information to the local area wide area network and receive the first response information generated by the local area wide area network according to the first request information, wherein the first request information is used to request the header information of the target resource; An obtaining module, configured to obtain the second response information, wherein the second response information is the response information of the target resource in the second device in the same local area network as the first device; A calling module, configured to intercept the second request information sent to the local area wide area network and send the modified second request information to the second device to call the target resource pre-cached in the second device if at least some of the header information between the first response information and the second response information is the same.

10. A resource calling device, wherein, Applied to the second device in the same local area network as the first device, the device includes: A second receiving module, configured to receive the second request information for requesting the target resource sent by the first device; wherein, the second request information is intercepted and modified by the first device and then forwarded after determining that the target resource is pre-cached in the second device after comparing the header information, and the original second request information sent to the local area wide area network is intercepted. A determination module, configured to determine the target resource cached in advance in a local storage according to a first address in the second request information for the first device to call.

Citation Information

Patent Citations

  • Resource file loading method, network equipment, electronic equipment and storage medium

    CN112751917A

  • Request information response method and device, communication equipment and storage medium

    CN114500510A