CN110688596B - Static webpage updating method, device, computer equipment and storage medium - Google Patents

Static webpage updating method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN110688596B
CN110688596B CN201910847138.8A CN201910847138A CN110688596B CN 110688596 B CN110688596 B CN 110688596B CN 201910847138 A CN201910847138 A CN 201910847138A CN 110688596 B CN110688596 B CN 110688596B
Authority
CN
China
Prior art keywords
cache
cache file
time
static
hash value
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
CN201910847138.8A
Other languages
Chinese (zh)
Other versions
CN110688596A (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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN201910847138.8A priority Critical patent/CN110688596B/en
Publication of CN110688596A publication Critical patent/CN110688596A/en
Application granted granted Critical
Publication of CN110688596B publication Critical patent/CN110688596B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • 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/953Querying, e.g. by the use of web search engines
    • G06F16/9538Presentation of query results
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The present application relates to the field of data processing technologies, and in particular, to a static web page updating method, device, computer equipment, and storage medium, including: obtaining a cache file of a static webpage, and inquiring a hash value of the cache file of the static webpage; if the cache file of the static webpage contains a hash value, determining a cache time threshold according to a time node of the hash value; if the cache file of the static webpage does not contain the hash value, acquiring a service scene parameter corresponding to the cache file of the static webpage, and determining a cache time threshold according to the service scene parameter; and determining a time node for updating the cache file of the static webpage according to the cache time threshold. According to the method and the device, whether the cache file contains the hash value is subjected to classification analysis, and the cache time threshold meeting the requirement is set, so that the problem of bandwidth waste is avoided.

Description

Static webpage updating method, device, computer equipment and storage medium
Technical Field
The present invention relates to the field of data processing, and in particular, to a static web page updating method, device, computer device, and storage medium.
Background
With the popularity of the internet, much information is presented to users in HTML (HyperText Markup Language ) style. The user opens a web page at a client (such as a computer, a mobile phone and the like), the browser sends a web page request to the server through HTTP (HyperText Transfer Protocol ), and the server sends corresponding web pages and other resources contained in the web pages, such as cascading style sheets CSS, script languages JS, pictures and the like, to the browser according to the web page request, and the browser displays the web page information to the user.
At present, a large max-age value needs to be set when static webpage caching is carried out, and the resource content is kept unchanged for a long time. It is apparent that if the resources above the server are updated within a certain second, the client sees what is still old without forced refreshing. Meanwhile, if the new version is released, the background interface is synchronously updated. The user with the cache is still using the old interface, and that interface is not already in the background, the page will be misplaced. And server authentication is always required. Therefore, the validity needs to be verified to the server every time, and the waste of bandwidth is very serious.
Disclosure of Invention
Based on the method, the device, the computer equipment and the storage medium for updating the static webpage are provided for solving the problem that the waste of bandwidth is very serious because the validity is verified to the server every time the webpage is cached at present.
A static webpage updating method comprises the following steps:
obtaining a cache file of a static webpage, and inquiring a hash value of the cache file of the static webpage;
if the cache file of the static webpage contains a hash value, determining a cache time threshold according to a time node of the hash value;
if the cache file of the static webpage does not contain the hash value, acquiring a service scene parameter corresponding to the cache file of the static webpage, and determining a cache time threshold according to the service scene parameter;
and determining a time node for updating the cache file of the static webpage according to the cache time threshold.
In one possible embodiment, the obtaining the cached file of the static web page, and performing the hash value query on the cached file of the static web page includes:
obtaining a cache file of the static webpage, and extracting an extension field in the cache file of the static webpage;
comparing the extension field with a preset extension classification table to obtain the type attribute of the cache file of the static webpage;
and determining whether the cache file of the static webpage contains a hash value according to the type attribute.
In one possible embodiment, if the cache file of the static web page includes a hash value, determining the cache time threshold according to a time node in which the hash value changes includes:
dividing the detail information of the cache file into a plurality of sub-information segments, and respectively calculating the hash value of each sub-information segment;
combining the hash values of the sub-information segments to obtain the hash values of the cache files of the static webpage;
and acquiring each time node of the static webpage, wherein the hash value of the cache file of the static webpage is changed, and acquiring the cache time threshold according to the time interval of each time node.
In one possible embodiment, if the cache file of the static webpage does not include a hash value, acquiring a service scene parameter corresponding to the cache file of the static webpage, and determining the cache time threshold according to the service scene parameter includes:
acquiring scene feature words of a service scene in a cache file of the static webpage, and acquiring a service rule corresponding to the service scene according to the scene feature words;
acquiring a service information tree corresponding to the service rule, wherein a root node or a child node in the service information tree contains at least one service scene parameter;
traversing each node on the service information tree to obtain service scene parameters corresponding to the cache file of the static webpage;
and extracting time-related parameters from the service scene parameters, and taking the minimum value of the time-related parameters as the buffer time threshold.
In one possible embodiment, the determining, according to the buffering time threshold, a time node of the update of the buffering file of the static web page includes:
when the time of locally storing the cache file of the static webpage exceeds the cache time threshold, sending a new file resource acquisition instruction to a server side;
receiving feedback information of the server, and if the feedback information contains new file resources, taking a time node corresponding to the cache time threshold as a time node for updating the cache file of the static webpage;
otherwise, the time node of the resource updating instruction sent by the server side is used as the time node of the cache file updating of the static webpage.
In one possible embodiment, the determining, according to the buffering time threshold, a time node of the update of the buffering file of the static web page includes:
when the preservation time of the cache file of the static webpage exceeds the cache time threshold, sending an instruction for verifying the entity value Etag of the requested variable and the last modified time last-modified to a server side;
receiving feedback information of the server side on the entity value eta of the requested variable and the numerical condition of the last modified time last-modified;
if one of the entity value Etag or the last modified time last-modified in the feedback information is changed in value, a time node corresponding to the cache time threshold is used as a time node for updating the cache file of the static webpage;
otherwise, continuing to use the cache file of the static webpage until the entity value Etag or the post-modified time changes.
In one possible embodiment, the merging the hash values of the sub-information segments to obtain the hash value of the cached file of the static web page includes:
acquiring byte lengths of the sub-information segments, and correcting hash values of the sub-information segments by taking the byte lengths as coefficients;
and adding the corrected hash values of the sub-information segments to obtain the hash value of the cache file of the static webpage.
A static webpage updating device comprises the following modules:
the hash value acquisition module is used for acquiring a cache file of the static webpage and carrying out hash value inquiry on the cache file of the static webpage;
the processing module during hash value is configured to determine a cache time threshold according to a time node when the hash value changes if the cache file of the static webpage contains the hash value; if the cache file of the static webpage does not contain the hash value, acquiring a service scene parameter corresponding to the cache file of the static webpage, and determining a cache time threshold according to the service scene parameter;
and the updating node determining module is used for determining the time node of the updating of the cache file of the static webpage according to the cache time threshold.
A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the static web page update method described above.
A storage medium storing computer readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the static web page update method described above.
Compared with the existing mechanism, the method and the device have the advantages that whether the cache file of the static webpage contains the hash value or not is subjected to classification analysis, and the cache time threshold meeting the requirements is set, so that the problem of bandwidth waste is avoided.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application.
FIG. 1 is an overall flowchart of a static web page update method according to an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating a hash value obtaining process in a static web page update method according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating a processing procedure when there is a hash value in a static web page update method according to an embodiment of the present application;
FIG. 4 is a schematic diagram illustrating a processing procedure without hash value in a static web page update method according to an embodiment of the present application;
fig. 5 is a block diagram of a static web page updating device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Fig. 1 is an overall flowchart of a static web page updating method according to an embodiment of the present application, and the static web page updating method includes the following steps:
s1, obtaining a cache file of a static webpage, and inquiring a hash value of the cache file of the static webpage;
specifically, the cache file mainly includes two file types, the first is a cache file which does not include a hash value, the file of the type is represented by an html file, and the other is a cache file which includes a hash value, and the file of the type is represented by a file in js/css/img or the like. When two different types of files need to be updated, different updating mechanisms are adopted, so that the bandwidth can be effectively saved. Specifically, when the message header is configured, the update time of the cache file can be obtained in a targeted manner by setting max-age values with different lengths.
In this step, for the query of the hash value of the cache file, all the values in the cache file message may be extracted first, then each value is referred to the hash function to perform calculation, and then, according to the operation result of the hash value, whether the hash value exists in the cache file is determined. That is, a hash threshold may be set first, if a value extracted from a certain cache file is smaller than the hash threshold after the value is calculated by a hash function, the cache file includes a hash value, otherwise, the cache file does not include a hash value.
S2, if the cache file of the static webpage contains a hash value, determining a cache time threshold according to a time node of the hash value;
specifically, a preset hash value extraction task is obtained, the preset hash value extraction task comprises a plurality of time nodes for hash value extraction, when the hash value extraction time node arrives, a hash value is extracted from the cache file information, and if the hash value extracted at the last time and the hash value extracted at the previous time are changed, the cache file needs to be updated. The preset hash value extraction task is generated after statistics according to historical data. The hash value of the cache file is changed because the weback performs a new package, that is, when the webpage information accessed by the user needs to be updated, the weback receives an instruction sent by the user or the server to perform the new package on the cache content.
S3, if the cache file of the static webpage does not contain a hash value, acquiring a service scene parameter corresponding to the cache file of the static webpage, and determining a cache time threshold according to the service scene parameter;
specifically, a business scenario is a process or sub-process of a business, including a goal, a participant, an operational flow, and an information delivery process. The business scenario may be a high concurrency test scenario, a stability test scenario, etc. Each service scenario corresponds to a different service scenario parameter, for example, the core parameter in the high concurrency test service scenario is the concurrency number and response time.
When the service scene parameters are acquired, the service rule corresponding to the service scene can be acquired first, and then the service scene parameters corresponding to the cache file can be acquired according to the characteristic information in the service rule. Taking a high concurrency test scenario as an example, a large number of passengers need to rob the train ticket to return home during spring festival, and the service scenario is the train ticket ordering high concurrency scenario, wherein the characteristic information is as follows: the corresponding business scene parameters can be obtained according to the characteristic information of the ticket playing time, such as the ticket playing time, the ticket playing quantity and the like, for example, the ticket playing time is 13:00, and the corresponding buffer time threshold value of the business scene can be obtained only by carrying out the maximum retention time of the buffer file corresponding to the high concurrency test at the moment of the parameter of 13:00.
And S4, determining a time node for updating the cache file of the static webpage according to the cache time threshold.
Specifically, when the storage time of the cache file in the local storage container is greater than the cache time threshold, the cache file needs to be updated, otherwise, the webpage information obtained by the user is not the latest information, so that inconvenience is caused to the use of the user. Taking a spring festival train ticket as an example, the local cache time threshold is 5s, and when the local cache time threshold exceeds 5s, the local cache needs to be updated, otherwise, ticket information is already available, and no ticket is available at the local end, so that a user cannot purchase the train ticket.
In this step, the time node for updating the cache file may be modified according to the bandwidth or the network speed of the actual network, that is, the bandwidth is increased, so that the time node for updating the original cache file needs to be advanced, that is, the frequency of updating the local cache file is increased.
In this embodiment, by performing classification analysis on whether the cache file includes the hash value, a cache time threshold meeting the requirement is set, so that the problem of bandwidth waste is avoided.
Fig. 2 is a schematic diagram of a hash value obtaining process in a static web page updating method in an embodiment of the present application, where as shown in the drawing, S1, obtaining a cache file of a static web page, and performing hash value query on the cache file of the static web page includes:
s11, acquiring a cache file of the static webpage, and extracting an extension field in the cache file of the static webpage;
specifically, the cached file information contains file content information and file name information, the ".", in the cached file information is queried, character segments behind all ".", characters segments behind the ".", and the character segments behind the "." arecompared with the content in an extension name table stored in a database, so that character segments with consistent comparison are obtained. If the number of the identical character segments is two or more, the character segments in front of the symbol are obtained, the association degree between the character segments in front of the symbol and the character segments behind the symbol is calculated, if the association degree is smaller than 10%, the character segments behind the symbol are extension names, otherwise, the character segments are not extension names. Wherein the character segment before the symbol or the character segment length after the symbol is determined according to special symbols, and the special symbols comprise punctuation division symbols such as ", and the like.
S12, comparing the extension field with a preset extension classification table to obtain the type attribute of the cache file of the static webpage;
in the preset extension classifying table, the extensions are classified into two types, wherein one type is an extension with a hash value, and the other type is an extension without a hash value. And if the extension field is in the extension part with the hash value, the cached file is a file with the hash value, otherwise, the cached file is a file without the hash value.
S13, determining whether the cache file of the static webpage contains a hash value according to the type attribute.
In this embodiment, the cache file is correctly classified by analyzing the extension of the cache file, so that when the cache file is updated, a correct file updating mode can be obtained according to whether the cache file has a hash value.
Fig. 3 is a schematic diagram of a processing procedure when a hash value is included in a static web page update method in an embodiment of the present application, as shown in the drawing, S2, if a cache file of the static web page includes the hash value, determining a cache time threshold according to a time node where the hash value changes, including:
s21, dividing the detail information of the cache file into a plurality of sub-information segments, and respectively calculating the hash value of each sub-information segment;
specifically, when the cache file information is divided into a plurality of sub-information segments, the number of bytes contained in each information segment may be the same, or the number of bytes contained in each sub-information segment may be different. The MD5 algorithm can also be used for calculating when calculating the hash value of each sub-information segment, the SHA-12 algorithm can also be used for calculating, and if the two algorithms are adopted for calculating the hash value at the same time, the hash values obtained by the two algorithms can be compared. If the difference value of the hash values obtained by the two algorithms is within a preset error threshold value, the hash value obtained by the MD5 algorithm is used as the hash value of the sub-information segment. Otherwise, the sub-information segment is divided again, so that the number of bytes in the sub-information segment is changed. Wherein the preset error threshold is typically 1%.
S22, combining the hash values of the sub-information segments to obtain the hash value of the cache file of the static webpage;
specifically, when hash values of sub-information segments are combined, verification is required to be performed on the accuracy of the hash values, namely, the hash values of all the sub-information segments are connected according to the position of the sub-information segments in a cache information file as an abscissa, the hash values are used as an ordinate, a hash value curve is established after the hash values are connected, then the hash value curve is divided into a plurality of curve segments, and if the curvature radius of a certain curve segment is greater than a preset curvature radius threshold value, abnormal hash values corresponding to the curve segment are deleted to obtain the hash values to be combined. And adding the hash values of the sub-information segments with the abnormal hash values removed to obtain the hash value of the cache file information.
S23, obtaining each time node with the hash value of the cache file of the static webpage changed, and obtaining the cache time threshold according to the time interval of each time node.
Specifically, when the cached file needs to be updated, the weback packages a new file and sends the new file to the local, and at this time, the hash value of the cached file changes. When the hash value of the cache file is monitored, the self-variable value of the hash function can be monitored, namely, the self-variable of the hash function is sent to the cache file at intervals of preset time, and if the self-variable is changed, the hash value is also changed.
According to the embodiment, the cache file information is obtained through the block hash value, so that the time threshold of the cache file needing to be updated is accurately obtained, and the optimal scheme of the residence time of the cache file is obtained.
Fig. 4 is a schematic diagram of a processing procedure when there is no hash value in a static web page updating method in an embodiment of the present application, as shown in the drawing, in S3, if a cache file of the static web page does not include a hash value, acquiring a service scene parameter corresponding to the cache file of the static web page, and determining a cache time threshold according to the service scene parameter includes:
s31, obtaining scene feature words of a service scene in a cache file of the static webpage, and obtaining service rules corresponding to the service scene according to the scene feature words;
specifically, the cache file information includes corresponding service scene information, for example, the cache file is train right and late information in spring transport, and the service scene feature words in the cache file are train and right and late. In this business scenario, the corresponding business rule information is: updated every 15 minutes. That is, each business scene feature word corresponds to a business rule in the database, and business rule information corresponding to a business scene can be obtained by searching whether the business rule contains the business scene feature word in the database.
S32, acquiring a service information tree corresponding to the service rule, wherein a root node or a child node in the service information tree contains at least one service scene parameter;
specifically, in the service information tree, service information is classified, or a service scenario that a train is at a late stage is taken as an example. In the service information tree, the root node is 'train time', the secondary slave node is 'just late', and the leaf node is 'spring transportation'. In this example, the characteristic node is a leaf node "spring". Since the addition of temporary passenger trains during spring transit can lead to a situation where the trains are late more easily than flat.
S33, traversing each node on the service information tree to obtain service scene parameters corresponding to the cache file of the static webpage;
specifically, after traversing the service information tree, converting the character information in each character node into a multi-dimensional word vector, and then performing dimension reduction processing on the multi-dimensional word vector to obtain a two-dimensional word vector. And solving the eigenvalue of the two-dimensional word vector to obtain the service scene parameters corresponding to each characteristic node, and then summarizing the parameters of each characteristic node to obtain the service scene parameters.
S34, extracting time-related parameters from the service scene parameters, and taking the minimum value of the time-related parameters as the buffer time threshold.
Specifically, node information of each characteristic node is obtained, for example, the node information of the node a is train time, and then the parameter corresponding to the node is a time-related parameter. The information of the characteristic node in the step is compared with a preset time-related vocabulary, if the information of the characteristic node is on the preset time-related vocabulary, the information is a time-related parameter, otherwise, the information is not. The preset time-related vocabulary is obtained by statistics according to historical data.
In this embodiment, the tree model is used to analyze the service scene parameters so as to obtain the buffer time threshold, so that the buffer file can be updated in time, and the system tasks can be reasonably arranged.
In one embodiment, the step S4 of determining, according to the buffering time threshold, a time node of the update of the buffering file of the static web page includes:
when the time of locally storing the cache file of the static webpage exceeds the cache time threshold, sending a new file resource acquisition instruction to a server side;
specifically, the latest file information of the web page is stored in the server, and the cached file needs to be updated after the storage time exceeds the caching time threshold so as to meet the browsing requirement of the user.
Receiving feedback information of the server, and if the feedback information contains new file resources, taking a time node corresponding to the cache time threshold as a time node for updating the cache file of the static webpage;
otherwise, the time node of the resource updating instruction sent by the server side is used as the time node of the cache file updating of the static webpage.
Specifically, the generation time marked by the information of the webpage file sent to the server side is compared with the generation time of the cache file, if the generation time and the generation time are consistent, the webpage of the server side is not updated, the storage time of the cache file can be prolonged at the moment, if the generation time and the generation time are inconsistent, the generation time of the webpage file sent to the server side is indicated to have been updated, and at the moment, the cache file needs to be updated. And in the time period for prolonging the preservation time of the cache file, if the server side generates the webpage update, a resource update instruction is sent out, and the time node of the resource update instruction is recorded and used as the cache file update time node. And simultaneously, the event is recorded into a database as a log, and the time interval of two resource updating time nodes is used as a buffer time threshold next time when the same kind of buffer files are used.
According to the embodiment, the buffer time threshold is revised through the server side, so that bandwidth resources are better utilized, and bandwidth waste is avoided.
In one embodiment, the step S4 of determining, according to the buffering time threshold, a time node of the update of the buffering file of the static web page includes:
when the preservation time of the cache file of the static webpage exceeds the cache time threshold, sending an instruction for verifying the entity value Etag of the requested variable and the last modified time last-modified to a server side;
wherein the HTTP protocol specification defines ETag as "entity value of requested variable". Stated another way, the ETag is a token that can be associated with a Web resource. A typical Web resource may be a Web page, but may also be a JSON or XML document. The server is solely responsible for determining what the token is and its meaning and transmitting it to the client in the HTTP response header, the following is the format returned by the server: the query update format of the "50b1c1d4f775c61:df3" client is as follows: if the ETag does not change, then the return state 304 is not returned, as is the case with Last-Modified. Testing Etag is useful mainly when breakpoint downloads.
When a browser requests a URL for the first time, the return status of the server will be 200, the content is the resource requested by the client, and a Last-Modified attribute marks the Last time the file was Modified at the server.
The Last-Modified format is similar to this:
Last-Modified:Fri,12May 2006 18:53:33GMT
when the client requests the URL for the second time, the browser transmits an If-Modified-nonce header to the server according to the HTTP protocol, asking whether the file has been Modified after that time:
If-Modified-Since:Fri,12May 2006 18:53:33GMT
if the resources of the server side are Not changed, an HTTP 304 (Not changed) status code is automatically returned, and the content is empty, so that the transmission data quantity is saved. When the server-side code changes or the server is restarted, then the resource is reissued, similar to the return at the first request. Therefore, the resource is not repeatedly sent to the client, and the client can obtain the latest resource when the server changes.
Receiving feedback information of the server side on the entity value eta of the requested variable and the numerical condition of the last modified time last-modified;
if one of the entity value Etag or the last modified time last-modified in the feedback information is changed in value, a time node corresponding to the cache time threshold is used as a time node for updating the cache file of the static webpage;
otherwise, continuing to use the cache file of the static webpage until the entity value Etag or the post-modified time changes.
In this embodiment, etag has a higher priority than Last-Modified, and if only Last-Modified is verified, there are a series of problems: the file may change periodically, but his content does not change, and it is not desirable for the client to regget; some servers are not able to get the last modification time of the file accurately. Both must be turned on at the same time to maintain the accuracy of the verification result.
In this embodiment, the update time node of the cache file is determined by using Etag and Last-Modified, so that the storage time of the cache file is accurately obtained, and the bandwidth utilization rate is further improved.
In one embodiment, the step S22 of merging the hash values of the sub-information segments to obtain a hash value of the cached file of the static web page includes:
acquiring byte lengths of the sub-information segments, and correcting hash values of the sub-information segments by taking the byte lengths as coefficients;
specifically, if there are 512 bytes in the a sub-information segment and 256 bytes in the B sub-information segment, then when the hash value correction is performed, the hash value of the a sub-information segment is 30, the hash value of the B sub-information segment is 50, when the hash value correction is performed, the hash value of the a is still 30, and the hash value of the B sub-information segment is 50×0.5=25.
And adding the corrected hash values of the sub-information segments to obtain the hash value of the cache file of the static webpage.
In one embodiment, a static web page updating device is provided, as shown in fig. 5, including the following modules:
the hash value acquisition module is used for acquiring a cache file of the static webpage and carrying out hash value inquiry on the cache file of the static webpage;
the processing module during hash value is configured to determine a cache time threshold according to a time node when the hash value changes if the cache file of the static webpage contains the hash value; if the cache file of the static webpage does not contain the hash value, acquiring a service scene parameter corresponding to the cache file of the static webpage, and determining a cache time threshold according to the service scene parameter;
and the updating node determining module is used for determining the time node of the updating of the cache file of the static webpage according to the cache time threshold.
In one embodiment, a computer device is provided, where the computer device includes a memory and a processor, where computer readable instructions are stored in the memory, and when executed by the processor, cause the processor to perform the steps of the static web page updating method in the foregoing embodiments.
In one embodiment, a storage medium storing computer readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the static web page update method in the above embodiments is presented. Wherein the storage medium may be a non-volatile storage medium.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program to instruct related hardware, the program may be stored in a computer readable storage medium, and the storage medium may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
The technical features of the above-described embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above-described embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above-described embodiments represent only some exemplary embodiments of the present application, wherein the description is more specific and detailed, but are not, therefore, to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (8)

1. A static web page updating method, comprising:
obtaining a cache file of a static webpage, and inquiring a hash value of the cache file of the static webpage;
if the cache file of the static webpage contains a hash value, determining a cache time threshold according to a time node of the hash value;
if the cache file of the static webpage does not contain the hash value, acquiring a service scene parameter corresponding to the cache file of the static webpage, and determining a cache time threshold according to the service scene parameter;
determining a time node for updating the cache file of the static webpage according to the cache time threshold;
if the cache file of the static webpage contains a hash value, determining a cache time threshold according to a time node where the hash value changes, including:
dividing the detail information of the cache file into a plurality of sub-information segments, and respectively calculating the hash value of each sub-information segment;
combining the hash values of the sub-information segments to obtain the hash values of the cache files of the static webpage;
obtaining each time node of the change of the hash value of the cache file of the static webpage, and obtaining the cache time threshold according to the time interval of each time node;
if the cache file of the static webpage does not contain the hash value, acquiring a service scene parameter corresponding to the cache file of the static webpage, and determining a cache time threshold according to the service scene parameter, wherein the method comprises the following steps of:
acquiring scene feature words of a service scene in a cache file of the static webpage, and acquiring a service rule corresponding to the service scene according to the scene feature words;
acquiring a service information tree corresponding to the service rule, wherein a root node or a child node in the service information tree contains at least one service scene parameter;
traversing each node on the service information tree to obtain service scene parameters corresponding to the cache file of the static webpage;
and extracting time-related parameters from the service scene parameters, and taking the minimum value of the time-related parameters as the buffer time threshold.
2. The method for updating a static web page according to claim 1, wherein the obtaining the cache file of the static web page, and performing the hash value query on the cache file of the static web page, includes:
obtaining a cache file of the static webpage, and extracting an extension field in the cache file of the static webpage;
comparing the extension field with a preset extension classification table to obtain the type attribute of the cache file of the static webpage;
and determining whether the cache file of the static webpage contains a hash value according to the type attribute.
3. The method for updating a static web page according to claim 1, wherein the determining a time node of the update of the cache file of the static web page according to the cache time threshold comprises:
when the time of locally storing the cache file of the static webpage exceeds the cache time threshold, sending a new file resource acquisition instruction to a server side;
receiving feedback information of the server, and if the feedback information contains new file resources, taking a time node corresponding to the cache time threshold as a time node for updating the cache file of the static webpage;
otherwise, the time node of the resource updating instruction sent by the server side is used as the time node of the cache file updating of the static webpage.
4. The method for updating a static web page according to claim 1, wherein the determining a time node of the update of the cache file of the static web page according to the cache time threshold comprises:
when the preservation time of the cache file of the static webpage exceeds the cache time threshold, sending an instruction for verifying the entity value Etag of the requested variable and the last modified time last-modified to a server side;
receiving feedback information of the server side on the entity value eta of the requested variable and the numerical condition of the last modified time last-modified;
if one of the entity value Etag or the last modified time last-modified in the feedback information is changed in value, a time node corresponding to the cache time threshold is used as a time node for updating the cache file of the static webpage;
otherwise, continuing to use the cache file of the static webpage until the entity value Etag or the post-modified time changes.
5. The method for updating a static web page according to claim 1, wherein the merging the hash values of the sub-information segments to obtain the hash value of the cache file of the static web page comprises:
acquiring byte lengths of the sub-information segments, and correcting hash values of the sub-information segments by taking the byte lengths as coefficients;
and adding the corrected hash values of the sub-information segments to obtain the hash value of the cache file of the static webpage.
6. The static webpage updating device is characterized by comprising the following modules:
the hash value acquisition module is used for acquiring a cache file of the static webpage and carrying out hash value inquiry on the cache file of the static webpage;
the processing module during hash value is configured to determine a cache time threshold according to a time node when the hash value changes if the cache file of the static webpage contains the hash value; if the cache file of the static webpage does not contain the hash value, acquiring a service scene parameter corresponding to the cache file of the static webpage, and determining a cache time threshold according to the service scene parameter;
the updating node determining module is used for determining a time node for updating the cache file of the static webpage according to the cache time threshold;
the processing module is specifically configured to divide the detail information of the cache file into a plurality of sub-information segments, and calculate the hash value of each sub-information segment respectively; combining the hash values of the sub-information segments to obtain the hash values of the cache files of the static webpage; obtaining each time node of the change of the hash value of the cache file of the static webpage, and obtaining the cache time threshold according to the time interval of each time node;
acquiring scene feature words of a service scene in a cache file of the static webpage, and acquiring a service rule corresponding to the service scene according to the scene feature words; acquiring a service information tree corresponding to the service rule, wherein a root node or a child node in the service information tree contains at least one service scene parameter; traversing each node on the service information tree to obtain service scene parameters corresponding to the cache file of the static webpage; and extracting time-related parameters from the service scene parameters, and taking the minimum value of the time-related parameters as the buffer time threshold.
7. A computer device, the device comprising:
at least one processor, memory, and transceiver;
wherein the memory is configured to store program code and the processor is configured to invoke the program code stored in the memory to perform the static web page update method of any of claims 1-5.
8. A computer storage medium comprising instructions which, when run on a computer, cause the computer to perform the steps of the static web page updating method of any of claims 1-5.
CN201910847138.8A 2019-09-09 2019-09-09 Static webpage updating method, device, computer equipment and storage medium Active CN110688596B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910847138.8A CN110688596B (en) 2019-09-09 2019-09-09 Static webpage updating method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910847138.8A CN110688596B (en) 2019-09-09 2019-09-09 Static webpage updating method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110688596A CN110688596A (en) 2020-01-14
CN110688596B true CN110688596B (en) 2024-03-15

Family

ID=69108862

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910847138.8A Active CN110688596B (en) 2019-09-09 2019-09-09 Static webpage updating method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110688596B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111626618A (en) * 2020-05-27 2020-09-04 北京金山云网络技术有限公司 Job flow file saving method and device and electronic equipment
CN113157690A (en) * 2020-12-28 2021-07-23 北京金万维科技有限公司 Statistical-oriented running water log data organization method
CN113297525B (en) * 2021-06-17 2023-12-12 恒安嘉新(北京)科技股份公司 Webpage classification method, device, electronic equipment and storage medium
CN116389254A (en) * 2023-06-05 2023-07-04 天津金城银行股份有限公司 Resource version control method, popup confirmation method, device, equipment and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104104707A (en) * 2013-04-12 2014-10-15 腾讯科技(深圳)有限公司 Webpage data update method, terminal, cache server and system
CN104933054A (en) * 2014-03-18 2015-09-23 上海帝联信息科技股份有限公司 Uniform resource locator (URL) storage method and device of cache resource file, and cache server
CN109634925A (en) * 2019-02-20 2019-04-16 平安科技(深圳)有限公司 Resource file downloading method, device, computer equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8402049B2 (en) * 2010-05-27 2013-03-19 International Business Machines Corporation Metadata cache management
US20140280293A1 (en) * 2013-03-12 2014-09-18 Mckesson Financial Holdings Method and apparatus for retrieving cached database search results

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104104707A (en) * 2013-04-12 2014-10-15 腾讯科技(深圳)有限公司 Webpage data update method, terminal, cache server and system
CN104933054A (en) * 2014-03-18 2015-09-23 上海帝联信息科技股份有限公司 Uniform resource locator (URL) storage method and device of cache resource file, and cache server
CN109634925A (en) * 2019-02-20 2019-04-16 平安科技(深圳)有限公司 Resource file downloading method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN110688596A (en) 2020-01-14

Similar Documents

Publication Publication Date Title
CN110688596B (en) Static webpage updating method, device, computer equipment and storage medium
US10979213B2 (en) Blockchain compression using summary and padding blocks
US6356906B1 (en) Standard database queries within standard request-response protocols
US7146422B1 (en) Method and apparatus for validating documents based on a validation template
US8543731B2 (en) Method for content responding and content requesting, content responder and content requestor
US20130339526A1 (en) Method and system for generating and using an augmented bloom filter
CN105337735B (en) The method and apparatus of digital certificate processing and verification
US8713368B2 (en) Methods for testing OData services
US20080147875A1 (en) System, method and program for minimizing amount of data transfer across a network
CN102882974A (en) Method for saving website access resource by website identification version number
US20150006623A1 (en) Method and System for Transmitting Network File
CN110377579A (en) File memory method, device and server
US20140006933A1 (en) Verifying content of resources in markup language documents
US20230336368A1 (en) Block chain-based data processing method and related apparatus
US11138287B1 (en) System for reducing size of transmitted content
CN103139298B (en) Method for transmitting network data and device
CN109063142B (en) Webpage resource pushing method, server and storage medium
US8386507B2 (en) Efficient caching for dynamic webservice queries using cachable fragments
US20210287181A1 (en) Method and apparatus for processing time records
US20210289019A1 (en) Method and device for transmitting list information
US7246131B2 (en) Dialog fragmentation for mobile devices
CN102821040A (en) Network transmission flow compression unit and network transmission flow compression method
CN112491939A (en) Multimedia resource scheduling method and system
CN107707328B (en) Abstract information transmission method and device
CN109344344A (en) Identification method, server and the computer readable storage medium of webpage client

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