CN106326489B - Method and device for updating network resources - Google Patents

Method and device for updating network resources Download PDF

Info

Publication number
CN106326489B
CN106326489B CN201610815770.0A CN201610815770A CN106326489B CN 106326489 B CN106326489 B CN 106326489B CN 201610815770 A CN201610815770 A CN 201610815770A CN 106326489 B CN106326489 B CN 106326489B
Authority
CN
China
Prior art keywords
file
network resource
preset network
cache
updated
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610815770.0A
Other languages
Chinese (zh)
Other versions
CN106326489A (en
Inventor
马展峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610815770.0A priority Critical patent/CN106326489B/en
Publication of CN106326489A publication Critical patent/CN106326489A/en
Application granted granted Critical
Publication of CN106326489B publication Critical patent/CN106326489B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention discloses a method and a device for updating network resources. The method provided by the embodiment of the invention comprises the following steps: the method comprises the steps that during the period from initialization of a page to closing of the page, an update file of preset network resources is obtained from a server at regular time; caching the update file into a browser cache; and when the preset network resource is refreshed or accessed, displaying the preset network resource according to the update file in the browser cache.

Description

Method and device for updating network resources
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a method and an apparatus for updating network resources.
Background
With the development of networks, people rely on the internet to obtain information, generally by sending various requests to a world wide Web (Web) server through a client browser, and displaying network resources sent from the server in pages.
In the prior art, acceleration of web page access is generally achieved through a hypertext Transfer Protocol (HTTP) caching technology. Specifically, when a user accesses a Uniform Resource Locator (URL) on a client using a browser, the browser sends request information to a server, where the request information includes the URL, the server returns response information including a page file to the URL to the browser of the client, and the browser caches the page file in a browser cache and displays the page according to the page file, where the response information also includes information indicating a cache deadline, and the page file is cached in the browser cache all the time within the cache deadline. When the user uses the browser to access the URL again, if the user is in the caching deadline currently, the browser reads an access file from the browser cache and does not send an http request to the server; if the cache period is exceeded, the browser requests the page file from the server.
However, since the problem of timely updating of the pagefile is to be considered, the cache term is generally set to be short, which results in a high probability that the user requests access to the file from the remote server when accessing the URL again using the browser. The time delay for obtaining the access file from the remote server is large, the access file is influenced by network environment factors, and particularly, the network resource loading is slow under the condition of poor network environment quality, so that the waiting time of a user is long.
Disclosure of Invention
The embodiment of the invention provides a method and a device for updating network resources, which can shorten the time for loading preset network resources.
In a first aspect, an embodiment of the present invention provides a method for updating a network resource, including:
the method comprises the steps that during the period from initialization of a page to closing of the page, an update file of preset network resources is obtained from a server at regular time;
caching the update file into a browser cache;
and when the preset network resource is refreshed or accessed, displaying the preset network resource according to the update file in the browser cache.
In a second aspect, an embodiment of the present invention provides an apparatus for updating a network resource, including:
the acquisition module is used for acquiring an update file of the preset network resource from the server at regular time during the period from the initiation of the page to the closing of the page;
the cache module is used for caching the update file into a browser cache;
and the display module is used for displaying the preset network resource according to the update file in the browser cache when the preset network resource is refreshed or accessed.
According to the technical scheme, the embodiment of the invention has the following advantages:
in the invention, because the updating file of the preset network resource is obtained from the server at regular time after the page is loaded, and is cached in the browser cache, compared with the prior art that the cache file is cached in the browser cache only when the cache file is loaded from the server after the preset network resource is accessed, when the preset network resource is accessed, the expiration probability of the preset network resource in the browser cache is smaller, namely the scheme of the invention can ensure that the probability of loading the preset network resource from the browser cache is larger when the preset network resource is loaded, in practical application, the time taken to load a file from a browser cache and the time taken to load a file from a server are typically two different orders of magnitude, therefore, the scheme of the invention can greatly shorten the time for loading the preset network resources, therefore, the time consumed by waiting when the user accesses the page is reduced, and the influence of network environment factors is reduced.
Drawings
FIG. 1 is a flow chart illustrating a method for updating network resources according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating an actual application scenario of the method for updating network resources according to the present invention;
FIG. 3 is a schematic diagram illustrating an embodiment of a network resource updating apparatus according to the present invention;
fig. 4 is a schematic structural diagram of an embodiment of the terminal of the present invention.
Detailed Description
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for updating network resources according to an embodiment of the present invention. In this embodiment, the method for updating network resources includes:
101. and during the period from the initialization of the page to the closing of the page, regularly acquiring an update file of the preset network resource from the server.
When a browser accesses page content through a Uniform Resource Locator (URL), the page content is downloaded from a server, and the page is initialized to display the page content and cached. In the period from the initiation of the page initialization to the closing of the page, the browser periodically acquires the update file of the preset network resource from the server, wherein the periodicity refers to every preset time or at a preset time, and is not limited herein. The preset network resource may be an update file of a currently opened page, or an update file of another page, or a related preset network resource (for example, a style or a scripting language) in the currently opened page, or a related preset network resource (for example, a style or a scripting language) in another page, which is not limited herein. The preset network resource may be a default network resource, or a network resource determined by receiving a setting of the preset network resource, which is not limited herein.
Since the browser can request the file from the server only when the page is open in the browser, in this embodiment, the update file of the preset network resource is periodically obtained from the server during the period from the initiation of the page to the closing of the page. Preferably, in this embodiment, the update file of the preset network resource is obtained from the server at regular time during the period from the completion of the initialization of the page to the closing of the page, so that the influence on the loading speed of the page can be avoided.
Among them, there are various methods for the browser to periodically obtain the update file of the preset network resource from the server. For example,
specifically, the browser sends an update request to the server periodically to obtain preset network resources stored by the current server from the server and cache the preset network resources. However, the preset network resource acquired by the browser from the server each time is not necessarily updated compared with the locally cached preset network resource.
Therefore, preferably, in this embodiment, when the browser periodically acquires the update file of the preset network resource from the server, specifically: the browser periodically sends a resource packet header request for the preset network resource to a server, and judges whether the preset network resource is updated or not according to the resource packet header information when receiving the resource packet header information responded by the server to the resource packet header request; and when the preset network resource is determined to be updated, acquiring an update file of the preset network resource from the server. Because the resource header request is sent to the server firstly, the server only needs to return the resource header information, and does not need to return the whole resource packet of the updated file, thereby greatly reducing the transmission quantity of data.
There are various methods for judging whether the preset network resource is updated according to the resource header information. For example, the resource header information includes an update time of the preset network resource. And when judging whether the preset network resource is updated according to the resource header information, judging whether the preset network resource is updated according to the updating time of the preset network resource. Specifically, the updating time of the locally cached preset network resource is obtained, if the updating time of the locally cached preset network resource is later than the updating time of the preset network resource in the resource header information, it can be determined that the preset network resource is updated, otherwise, it can be determined that the preset network resource is not updated.
For another example, the resource header information includes an update flag bit of a preset network resource, where the update flag bit is used to indicate the update content of the preset network resource. And when judging whether the preset network resource is updated according to the resource packet header information, judging whether the preset network resource is updated according to the update flag bit of the preset network resource. Specifically, an update flag bit of the locally cached preset network resource is obtained, if the update flag bit of the locally cached preset network resource is different from the update flag bit of the preset network resource in the resource header information, it is determined that the preset network resource is updated, otherwise, it is determined that the preset network resource is not updated.
In this embodiment, there are various sending methods for the browser to send the update request to the server periodically. Optionally, the browser sends an update request to the server through Asynchronous JavaScript And XML (english full name: Asynchronous JavaScript And XML, english abbreviation: AJAX), so as to obtain an update file of the preset network resource from the server. For example, the browser sends a get request or a post request to the server at preset time intervals to obtain an update file of the preset network resource.
Preferably, when the browser sends an update request to the server periodically, specifically, the browser sends a head request to the server periodically, and after receiving response header information responded by the server, when it is determined that the preset network resource is updated according to the response header information, the browser sends a get request or a post request to the server to obtain a complete file of the update file, and of course, the browser may also obtain the complete file by sending other requests, which is not limited herein.
102. And caching the update file into a browser cache.
And after the updating file of the preset network resource is acquired from the server, the browser caches the updating file of the preset network resource in the browser cache. In practical application, the preset network resource generally has a certain cache duration in the browser cache. When the browser acquires the data packet of the updated file from the server, the data packet also carries a cache deadline. The browser acquires the cache deadline from the data packet, and determines the cache deadline of the update file in the local according to the cache deadline. Specifically, the cache deadline carried in the data packet may be a cache duration or a cache deadline, which is not limited herein. The server mainly has two methods for setting the cache deadline, one method adopts default setting, the other method is that the browser sends a cache duration request when requesting a file from the server, and the server sets the cache deadline of the file in response header information according to the cache duration request.
103. And when the preset network resource is accessed, displaying the preset network resource according to the update file in the browser cache.
During the page display process, a refresh request for preset network resources may be received. When a refresh request of the preset network resource is received, the browser does not need to load an update file of the preset network resource from the server, but directly loads the update file from the browser cache, and displays the preset network resource.
After the page is closed, when an access request for the preset network resource is received, the update file of the preset network resource does not need to be loaded from the server, but the update file is directly loaded from the browser cache and the preset network resource is displayed.
Optionally, in this embodiment, when the preset network resource is displayed according to the update file cached by the browser, it is first detected whether the update file cached by the browser is expired, and specifically, whether the update file is expired may be determined only by comparing the cache deadline of the update file with the current time. And when the update file is not expired, reading the update file from the browser cache. When the update file has passed, the update file is loaded from the server.
In the embodiment, because the device for updating the preset network resource acquires the update file of the preset network resource from the server at regular time and caches the update file into the browser cache after the page is loaded, compared with the prior art that the update file is cached into the browser cache after the cache file is found to be expired when the preset network resource is accessed, the expiration probability of the preset network resource in the browser cache is smaller, namely the probability of loading the preset network resource from the browser cache is higher by adopting the scheme of the invention when the preset network resource is loaded, in practical application, the time consumed for loading the file from the browser cache and the time consumed for loading the file from the server are generally two different orders of magnitude, therefore, the time consumed for loading the preset network resource can be greatly shortened by adopting the scheme of the invention, therefore, the time consumed by waiting when the user accesses the page is reduced, and the influence of network environment factors is reduced. Particularly, in the single-page application in the prior art, the single-page application only has one page, and is characterized in that the page is not refreshed when the content of the page is switched, and the loading and the displaying are dynamically controlled by depending on the script, wherein the page is not refreshed, and the page is loaded and updated from the server only when a user actively refreshes or a browser restarts, and the single-page application is easily influenced by a network environment in the loading process and cannot cope with the situation that an emergency needs to be updated immediately. In the invention, the updated file of the page is regularly acquired from the server during the page display period, and the updated file can be immediately loaded from the cache when the updated file is refreshed in the single-page application or the browser is restarted, thereby avoiding the condition that the updated file is influenced by the network environment in the process of loading the updated file.
Optionally, in this embodiment, when the browser sends the update request to the server at regular time through the AJAX technology, the update request further includes a request for indicating a cache duration, so that the server sets a cache deadline of the update file in the browser cache according to the cache duration request. In this embodiment, since the update time of the update file of the page acquired by the browser is closer to the current time, the cache duration requested in the cache duration request sent by the browser may be longer than the cache duration in the prior art.
For convenience of understanding of the present invention, the method for updating network resources of the present invention is described below by way of example with reference to a practical application scenario.
Fig. 2 is a schematic structural diagram of another embodiment of a network resource updating method according to the present invention, as shown in fig. 2. In this embodiment, when a page is opened by a browser, when it is detected that there is no local cache of the page, or when a locally cached page file is expired, a request is sent to a server, and a response data packet of the server is received, where the response data packet includes the page file and an update flag bit of the page. And the browser initializes the page according to the response data packet returned by the server. The browser also caches the page file and the update flag bit of the page in the browser cache.
Starting from initialization of a page, the browser sends a head request to the server through AJAX at preset time intervals so as to detect whether the page file is updated or not at regular time. Specifically, the browser receives response header information from the server in response to the head request. Wherein, the response header information includes an update flag bit of the page, and the update flag bit is used for indicating the update content of the page. When the browser acquires response header information of the server responding to the head request every time, comparing an update flag bit in the response header information with an update flag bit of a page file currently cached in a browser cache, and when the two update flag bits are the same, indicating that the page is not updated, continuing waiting for sending the head request next time by the browser; when the two update flag bits are different, the page is updated, and then the browser sends a get request to the server through AJAX to acquire an update file of the page.
And when the browser receives a response data packet of the server to the get request, caching the response data packet. After waiting for the preset time, the browser sends the head request to the server again, and the process is repeated until the page is closed. Optionally, after the browser acquires the update file of the page, sending the head request to the server is stopped, which is not limited herein.
And when the page is refreshed or opened again after being closed, reading the page file from the browser cache, and loading the page. In practical application, the time spent on loading the page file from the browser cache is generally 10 ms-level time, the time spent on loading the page file from the remote server is generally 100 ms-level time, and the time spent is generally longer due to the influence of network quality.
The method for updating network resources of the present invention is described above, and the apparatus for updating network resources of the present invention is described below.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an apparatus for updating network resources according to an embodiment of the present invention. In this embodiment, the apparatus 300 for updating network resources includes:
an obtaining module 301, configured to obtain an update file of a preset network resource from a server at regular time during a period from initiation of a page to closing of the page;
a caching module 302, configured to cache the update file in a browser cache;
a display module 303, configured to display the preset network resource according to the update file in the browser cache when the preset network resource is refreshed or accessed.
In the embodiment, because the device for updating the preset network resource acquires the update file of the preset network resource from the server at regular time and caches the update file into the browser cache after the page is loaded, compared with the prior art that the update file is cached into the browser cache after the cache file is found to be expired when the preset network resource is accessed, the expiration probability of the preset network resource in the browser cache is smaller, namely the probability of loading the preset network resource from the browser cache is higher by adopting the scheme of the invention when the preset network resource is loaded, in practical application, the time consumed for loading the file from the browser cache and the time consumed for loading the file from the server are generally two different orders of magnitude, therefore, the time consumed for loading the preset network resource can be greatly shortened by adopting the scheme of the invention, and further, the time consumed by the user for waiting when the user accesses the preset network resource is reduced, and the influence of network environment factors is reduced.
Optionally, the display module 303 is specifically configured to:
detecting whether the update file cached by the browser is expired;
and when the update file is not expired, reading the update file from the browser cache.
Optionally, the obtaining module 301 is specifically configured to send an update request to a server at regular time through an AJAX technology, where the update request is used to request an update file of the preset network resource.
Optionally, the update request further includes a request for indicating a cache duration, so that the server sets a cache duration of the update file in the browser cache according to the cache duration request.
Optionally, the obtaining module 301 is specifically configured to:
sending a resource packet head request for the preset network resource to a server at regular time;
receiving resource packet header information of the server responding to the resource packet header request;
judging whether the preset network resource is updated or not according to the resource packet header information;
and when the preset network resource is determined to be updated, acquiring an update file of the preset network resource from the server.
Optionally, the obtaining module 301 is specifically configured to send a head request of the preset network resource to the server at regular time when sending the resource header request of the preset network resource to the server at regular time.
Optionally, the resource packet header information includes an update time and/or an update flag of the preset network resource, where the update flag is used to indicate an update content of the preset network resource;
the obtaining module 301 is specifically configured to determine whether the preset network resource is updated according to the update time and/or the update flag of the preset network resource when determining whether the preset network resource is updated according to the resource packet header information.
Another terminal is provided in the embodiment of the present invention, as shown in fig. 4, for convenience of description, only a part related to the embodiment of the present invention is shown, and details of the specific technology are not disclosed, please refer to the method part in the embodiment of the present invention. The terminal may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, etc., taking the terminal as the mobile phone as an example:
fig. 4 is a block diagram illustrating a partial structure of a mobile phone related to a terminal provided in an embodiment of the present invention. Referring to fig. 4, the handset includes: radio Frequency (RF) circuit 1010, memory 1020, input unit 1030, display unit 1040, sensor 1050, audio circuit 1060, wireless fidelity (WiFi) module 1070, processor 1080, and power source 1090. Those skilled in the art will appreciate that the handset configuration shown in fig. 4 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 4:
RF circuit 1010 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, for processing downlink information of a base station after receiving the downlink information to processor 1080; in addition, the data for designing uplink is transmitted to the base station. In general, RF circuit 1010 includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuitry 1010 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), and the like.
The memory 1020 can be used for storing software programs and modules, and the processor 1080 executes various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 1020 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 1030 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also referred to as a touch screen, may collect touch operations by a user (e.g., operations by a user on or near the touch panel 1031 using any suitable object or accessory such as a finger, a stylus, etc.) and drive corresponding connection devices according to a preset program. Alternatively, the touch panel 1031 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 1080, and can receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 may be implemented by various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 1030 may include other input devices 1032 in addition to the touch panel 1031. In particular, other input devices 1032 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a track ball, a mouse, a joystick, or the like.
The display unit 1040 may be used to display information input by a user or information provided to the user and various menus of the cellular phone. The Display unit 1040 may include a Display panel 1041, and optionally, the Display panel 1041 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 1031 can cover the display panel 1041, and when the touch panel 1031 detects a touch operation on or near the touch panel 1031, the touch operation is transmitted to the processor 1080 to determine the type of the touch event, and then the processor 1080 provides a corresponding visual output on the display panel 1041 according to the type of the touch event. Although in fig. 4, the touch panel 1031 and the display panel 1041 are two independent components to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 1031 and the display panel 1041 may be integrated to implement the input and output functions of the mobile phone.
The handset may also include at least one sensor 1050, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1041 according to the brightness of ambient light, and the proximity sensor may turn off the display panel 1041 and/or the backlight when the mobile phone moves to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the posture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
Audio circuitry 1060, speaker 1061, microphone 1062 may provide an audio interface between the user and the handset. The audio circuit 1060 can transmit the electrical signal converted from the received audio data to the speaker 1061, and the electrical signal is converted into a sound signal by the speaker 1061 and output; on the other hand, the microphone 1062 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1060 and converted into audio data, which is then processed by the audio data output processor 1080 and then sent to, for example, another cellular phone via the RF circuit 1010, or output to the memory 1020 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help the user to send and receive e-mail, browse web pages, access streaming media, etc. through the WiFi module 1070, which provides wireless broadband internet access for the user. Although fig. 4 shows the WiFi module 1070, it is understood that it does not belong to the essential constitution of the handset, and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 1080 is a control center of the mobile phone, connects various parts of the whole mobile phone by using various interfaces and lines, and executes various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 1020 and calling data stored in the memory 1020, thereby integrally monitoring the mobile phone. Optionally, processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor, which handles primarily the operating system, user interfaces, applications, etc., and a modem processor, which handles primarily the wireless communications. It is to be appreciated that the modem processor described above may not be integrated into processor 1080.
The handset also includes a power source 1090 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 1080 via a power management system to manage charging, discharging, and power consumption via the power management system.
Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which are not described herein.
In the embodiment of the present invention, the processor 1080 included in the terminal further has a function of controlling the above method flow executed by the device for updating network resources.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for updating network resources is applied to a terminal, and comprises the following steps:
the method comprises the steps that a head request is sent to a server periodically during the period from the beginning of page initialization to the closing of the page, after response head information responded by the server is received, whether preset network resources are updated or not is judged according to the response head information, under the condition that the preset network resources are updated according to the response head information, a get request or a post request is sent to the server to obtain a complete file of an updated file, and the head request also comprises a request for indicating cache duration so that the server can set the cache duration of the updated file in a browser cache according to the cache duration request;
caching the complete file of the updated file into a browser cache, wherein the complete file of the updated file also carries a cache deadline, the browser acquires the cache deadline from the complete file of the updated file, and the cache deadline of the updated file in the local is determined according to the cache deadline;
and when the preset network resource is refreshed or accessed, displaying the preset network resource according to the complete file of the update file in the browser cache.
2. The method for updating network resources according to claim 1, wherein the displaying the preset network resources according to the complete file of the update file cached by the browser comprises:
detecting whether a complete file of an updated file cached by the browser is expired;
and when the complete file of the updated file is not expired, reading the complete file of the updated file from the browser cache.
3. The method for updating network resources of claim 1, wherein the periodically sending a head request to the server comprises:
periodically sending a head request to the server by the AJAX technology.
4. The method for updating network resources according to claim 1, wherein the response header information includes an update time and/or an update flag bit of the preset network resource, and the update flag bit is used to indicate an update content of the preset network resource;
the judging whether the preset network resource is updated according to the response header information includes:
and judging whether the preset network resource is updated or not according to the updating time and/or the updating flag bit of the preset network resource.
5. An apparatus for network resource update, comprising:
the acquisition module is used for periodically sending a head request to the server during the period from the initiation of the page to the closing of the page, judging whether the preset network resources are updated or not according to the response head information after receiving the response head information responded by the server, and sending an acquisition get request or a transmission post request to the server to acquire a complete file of an update file under the condition that the preset network resources are updated according to the response head information;
the cache module is used for caching the complete file of the updated file into a browser cache, wherein the complete file of the updated file also carries a cache deadline, the browser acquires the cache deadline from the complete file of the updated file, and the cache deadline of the updated file in the local area is determined according to the cache deadline;
and the display module is used for displaying the preset network resource according to the complete file of the update file in the browser cache when the preset network resource is refreshed or accessed.
6. The apparatus for updating network resources of claim 5, wherein the presentation module is specifically configured to:
detecting whether a complete file of an updated file cached by the browser is expired;
and when the complete file of the updated file is not expired, reading the complete file of the updated file from the browser cache.
7. The apparatus for updating network resources of claim 5, wherein the obtaining module is specifically configured to periodically send a head request to the server through AJAX technology.
8. The apparatus for updating network resources according to claim 5, wherein the response header information includes an update time and/or an update flag bit of the preset network resource, and the update flag bit is used to indicate an update content of the preset network resource;
the obtaining module is specifically configured to determine whether the preset network resource is updated according to the update time and/or the update flag of the preset network resource when determining whether the preset network resource is updated according to the response header information.
9. A terminal, comprising: a memory and a processor;
the memory is used for storing a computer program;
the processor is configured to execute a computer program stored in the memory;
the computer program is for performing the method of network resource updating of any of claims 1-4.
10. A computer-readable storage medium, characterized in that the storage medium has stored therein a computer program for executing the method of network resource updating of any of claims 1-4.
CN201610815770.0A 2016-09-09 2016-09-09 Method and device for updating network resources Active CN106326489B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610815770.0A CN106326489B (en) 2016-09-09 2016-09-09 Method and device for updating network resources

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610815770.0A CN106326489B (en) 2016-09-09 2016-09-09 Method and device for updating network resources

Publications (2)

Publication Number Publication Date
CN106326489A CN106326489A (en) 2017-01-11
CN106326489B true CN106326489B (en) 2021-08-27

Family

ID=57787723

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610815770.0A Active CN106326489B (en) 2016-09-09 2016-09-09 Method and device for updating network resources

Country Status (1)

Country Link
CN (1) CN106326489B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108228210B (en) * 2017-12-08 2021-06-04 平安科技(深圳)有限公司 Resource updating method and system
CN108170771B (en) * 2017-12-26 2022-04-12 福建星瑞格软件有限公司 Automatic cancellation method for database high-time-consumption query
CN108848173A (en) * 2018-06-25 2018-11-20 郑州云海信息技术有限公司 A kind of data-updating method, device, equipment and readable storage medium storing program for executing
CN109213560B (en) * 2018-09-12 2020-11-27 南京尚网网络科技有限公司 Method and equipment for displaying information page
CN109408150A (en) * 2018-10-30 2019-03-01 维沃移动通信有限公司 It is a kind of to apply loading method and mobile terminal fastly

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001086510A1 (en) * 2000-05-08 2001-11-15 Verity, Inc. Application caching system and method
CN105279034A (en) * 2015-10-26 2016-01-27 北京皮尔布莱尼软件有限公司 Consistency cache control system and method
WO2016094286A1 (en) * 2014-12-08 2016-06-16 Amazon Technologies, Inc. Intelligent browser-based display tiling
CN105893429A (en) * 2015-12-08 2016-08-24 乐视云计算有限公司 Method and system for optimizing WEB cache

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001086510A1 (en) * 2000-05-08 2001-11-15 Verity, Inc. Application caching system and method
WO2016094286A1 (en) * 2014-12-08 2016-06-16 Amazon Technologies, Inc. Intelligent browser-based display tiling
CN105279034A (en) * 2015-10-26 2016-01-27 北京皮尔布莱尼软件有限公司 Consistency cache control system and method
CN105893429A (en) * 2015-12-08 2016-08-24 乐视云计算有限公司 Method and system for optimizing WEB cache

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
How effective is mobile browser cache?;Zhen Wang 等;《S3 "11: Proceedings of the 3rd ACM workshop on Wireless of the students, by the students, for the students》;20110919;17–20 *
嵌入式浏览器缓存的设计与实现;孟飞;《中国优秀硕士学位论文全文数据库 信息科技辑》;20140115(第 01 期);I139-185 *

Also Published As

Publication number Publication date
CN106326489A (en) 2017-01-11

Similar Documents

Publication Publication Date Title
CN106326489B (en) Method and device for updating network resources
CN110716850B (en) Page testing method, device and system and storage medium
CN108241703B (en) Webpage data transmission method and device
CN110569078B (en) Method and device for preloading webpage-level program
CN109948090B (en) Webpage loading method and device
WO2015043476A1 (en) Devices and methods for webpage display
US9497565B1 (en) Interface display method, device, terminal, server and system
CN109284144B (en) Fast application processing method and mobile terminal
CN108600516B (en) Data acquisition method, mobile terminal and computer readable storage medium
WO2015067142A1 (en) Webpage display method and device
WO2017161994A1 (en) Method and device for displaying page, and computer storage medium
CN104750730B (en) Browser display method and device
EP2876539A1 (en) Method, device and terminal apparatus for responding to a sliding operation
CN105227598B (en) Resource sharing method, device and system based on cloud storage
CN107765954B (en) Application icon updating method, mobile terminal and server
CN110460862B (en) Live broadcast processing method, terminal equipment and storage medium
CN110445746B (en) Cookie obtaining method and device and storage equipment
CN108268232B (en) Picture display method, device, system and storage medium
CN112612552B (en) Application resource loading method and device, electronic equipment and readable storage medium
EP3550790B1 (en) Streaming media data processing method and mobile terminal
CN106230919B (en) File uploading method and device
CN110809186B (en) Video processing method and electronic equipment
WO2019084753A1 (en) Information processing method, storage medium, and mobile terminal
CN111241436A (en) Data request processing method and device, terminal equipment and storage medium
CN112445967A (en) Information push method and device, readable storage medium and information push system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant