CN113703807B - Method and system for real-time detection and update of static resource version - Google Patents

Method and system for real-time detection and update of static resource version Download PDF

Info

Publication number
CN113703807B
CN113703807B CN202110988918.1A CN202110988918A CN113703807B CN 113703807 B CN113703807 B CN 113703807B CN 202110988918 A CN202110988918 A CN 202110988918A CN 113703807 B CN113703807 B CN 113703807B
Authority
CN
China
Prior art keywords
static resource
version number
page
file
resource version
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
CN202110988918.1A
Other languages
Chinese (zh)
Other versions
CN113703807A (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.)
Shanghai Datatom Information Technology Co ltd
Original Assignee
Shanghai Datatom Information Technology 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 Shanghai Datatom Information Technology Co ltd filed Critical Shanghai Datatom Information Technology Co ltd
Priority to CN202110988918.1A priority Critical patent/CN113703807B/en
Publication of CN113703807A publication Critical patent/CN113703807A/en
Application granted granted Critical
Publication of CN113703807B publication Critical patent/CN113703807B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a method and a system for real-time detection and update of a static resource version, wherein the method comprises the following steps of obtaining all static resource files, and processing all the static resource files to obtain a static resource version number text file; when the page is initialized, the stored static resource version number file is loaded from the server; judging whether the page is in an active state or not; if the page is not in an active state, not performing any operation; if the page is in an active state, acquiring a static resource version number file and extracting a version number in the static resource version number file; comparing the version number with the static resource version number in the static resource version number text file to judge whether the version number is consistent with the static resource version number; if the static resource files are consistent, judging that the static resource files are not changed, and returning to the execution step A3; if the static resource files are inconsistent, judging that the static resource files are updated, and prompting a user to refresh the page through a notification bar displayed in a resident mode; the system comprises a construction module, a state detection module, a comparison module and a prompt module.

Description

Method and system for real-time detection and update of static resource version
Technical Field
The application relates to the field of static resource version real-time detection and updating, in particular to a method and a system for static resource version real-time detection and updating.
Background
When the web-side application is used, the static resources often use a caching strategy to reduce bandwidth consumption and accelerate request speed, and for the static resources using strong caching, the web front-end browser can preferentially read the static resource copy stored this time, even if the program version of the server is updated, the browser cannot sense the static resources of the old version, once the page is not refreshed, the problem is caused, the front-end program version and the back-end program version are inconsistent, page fault reporting and functional error occur if the page fault occurs slightly, dirty data are generated again, even system breakdown is caused, and in order to avoid running errors caused by the difference of the front-end version and the back-end version, the method and the system for detecting and updating the static resource version in real time are provided for solving the problem.
Disclosure of Invention
The application provides a real-time detection and update method of static resource version, which can generate static resource version number text file for static resource file in construction period, and detect the version of static resource version number in server static resource file at regular time in operation period if page is active, and compare with loaded version number of current page, if version is inconsistent, prompt user to refresh page, and avoid a series of error and crash caused by untimely update of static resource file, and avoid waste of performance and bandwidth.
The application provides the following technical scheme for solving the technical problems:
in a first aspect, a method for real-time detecting and updating a static resource version includes the following steps:
step A1: acquiring all static resource files, and processing all the static resource files to obtain static resource version number text files;
step A2: when the page is initialized, the stored static resource version number file is loaded from the server;
step A3: judging whether the page is in an active state or not;
if the page is not in an active state, not performing any operation;
if the page is in an active state, acquiring a static resource version number file and extracting a version number in the static resource version number file;
step A4: comparing the version number with the static resource version number in the static resource version number text file to judge whether the version number is consistent with the static resource version number;
if the static resource files are consistent, judging that the static resource files are not changed, and returning to the execution step A3;
if the static resource files are inconsistent, judging that the static resource files are updated, and prompting a user to refresh the page through a notification bar displayed in a resident mode.
The method for detecting and updating the static resource version in real time comprises the following specific steps of processing all static resource files in the step A1 to obtain static resource version number text files:
step B1: operating a summary algorithm on all the static resource files to obtain all the static resource version numbers;
step B2: arranging all static resource version numbers according to the name sequence of the static resource file to obtain a static resource version number text;
step B3: and running a summary algorithm on the static resource version number text to obtain a static resource version number text file.
The method for detecting and updating the static resource version in real time is characterized in that the abstract algorithm is an SHA256 abstract algorithm.
The method for detecting and updating the static resource version in real time comprises the step A2 of storing the obtained static resource version number file into a browser.
In the method for detecting and updating the static resource version in real time, in the step A3, whether the page is in an active state is triggered and judged according to a set timer;
the judging step of whether the page is in an active state is as follows:
step C1: the initial state of the page is an active state, monitoring is carried out on the mouse and the keyboard, and time data of each operation of the mouse and the keyboard are recorded;
step C2: setting a timer, and judging whether the interval between the last mouse and keyboard operation time data and the current time data of a user is smaller than a specified time threshold value when the timer reaches time;
if the page is smaller than the page, the page is in an active state;
if not, the page is in an inactive state.
The system for detecting and updating the static resource version in real time comprises a construction module, a state detection module, a comparison module and a prompt module;
the construction module is used for acquiring all static resource files and processing all the static resource files to obtain static resource version number text files; the method is also used for loading the stored static resource version number file from the server during page initialization;
the state detection module is used for detecting the active state of the page in real time, and extracting the version number in the static resource version number file and transmitting the version number to the comparison module when the page is in the active state;
the comparison module is used for acquiring the static resource version number in the static resource version number text file and comparing and judging whether the static resource version number is consistent with the version number, if so, the active state of the page is re-detected, and if not, prompt information transmitted to the prompt module is generated;
the prompt module is used for displaying the prompt information on a page;
the system for detecting and updating the static resource version in real time comprises a building module, a dynamic resource version detection module and a dynamic resource version updating module, wherein the building module is internally provided with a generating unit, a calculating unit and a network request unit;
the generating unit is used for acquiring the static resource file;
the computing unit is used for computing according to the obtained static resource file to obtain a static resource version number text file;
the network request unit is used for requesting to acquire the static resource version number file from the server during page initialization.
In the system for detecting and updating the static resource version in real time, the computing unit performs a summary algorithm on the static resource file to obtain the static resource version number, arranges all the static resource version numbers according to the name sequence of the static resource file to obtain a static resource version number text, and performs a summary algorithm on the static resource version number text to obtain a static resource version number text file.
In a third aspect, a computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the method of any of the first aspects.
The technical scheme provided by the application has the following technical effects:
and generating a static resource version number text file for the static resource file in the construction period, detecting the version of the static resource version number in the static resource file of the server at regular time if the page is active in the operation period, comparing with the version number loaded by the current page, prompting the user to refresh the page if the version is inconsistent, and effectively avoiding a series of errors and crashes caused by untimely updating of the static resource file and avoiding waste of performance and bandwidth compared with the page which does not comprise the technical scheme.
Drawings
FIG. 1 is a flow chart of a method for real-time detection and update of static resource versions according to the present application;
FIG. 2 is a schematic diagram of an implementation of actively detecting a static resource version in an embodiment of the present application;
FIG. 3 is a schematic diagram of an implementation of detecting page active status in an embodiment of the present application;
fig. 4 is a schematic structural diagram of a system for real-time detection and update of static resource versions according to the present application.
Wherein, the reference numerals are as follows:
the system comprises a construction module 100, a state detection module 200, a comparison module 300 and a prompt module 400.
Detailed Description
In order to make the technical means, the inventive features, the achievement of the purpose and the effect of the implementation of the application easy to understand, the technical solutions in the embodiments of the application will be clearly and completely described in conjunction with the specific drawings, and it is obvious that the described embodiments are some embodiments of the application, not all embodiments.
All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be understood that the structures, proportions, sizes, etc. shown in the drawings are for illustration purposes only and should not be construed as limiting the application to the extent that it can be practiced, since modifications, changes in the proportions, or otherwise, used in the practice of the application, are not intended to be critical to the essential characteristics of the application, but are intended to fall within the spirit and scope of the application.
Also, the terms such as "upper," "lower," "left," "right," "middle," and "a" and the like recited in the present specification are merely for descriptive purposes and are not intended to limit the scope of the application, but are intended to provide relative positional changes or modifications without materially altering the technical context in which the application may be practiced.
The first embodiment of the application provides a method for real-time detection and update of a static resource version, and the second embodiment provides a system for real-time detection and update of a static resource version, which aims to generate a static resource version number text file for a static resource file in a construction period, and in a running period, if a page is active, the version of the static resource version number in the static resource file of a server is detected regularly and compared with the version number loaded by a current page, and if the version is inconsistent, a user is prompted to refresh the page, and compared with the page which does not comprise the technical scheme, a series of errors and crashes caused by untimely update of the static resource file are effectively avoided, and waste of performance and bandwidth is also avoided.
1-3, a method for real-time detecting and updating a static resource version in a first aspect includes the following steps:
step A1: at the end of the construction link, firstly, running a construction script to generate static resources, after all static resource files are generated, acquiring all static resource files, and processing all static resource files to obtain static resource version number text files;
step A2: when the page is initialized, the stored static resource version number file is loaded from the server through a network request;
step A3: judging whether the page is in an active state or not;
if the page is not in an active state, not performing any operation;
if the page is in an active state, acquiring a static resource version number file and extracting a version number in the static resource version number file;
step A4: comparing the version number with the static resource version number in the static resource version number text file to judge whether the version number is consistent with the static resource version number;
if the static resource files are consistent, judging that the static resource files are not changed, and returning to the execution step A3;
if the static resource files are inconsistent, judging that the static resource files are updated, and prompting a user to refresh the page through a notification bar displayed in a resident mode;
the application of the web end largely uses an http cache mechanism, and the cache policy is divided into two types: the method includes the steps that a cache version is compared with a server version when the resource is requested by negotiation, and the server is required to spend a great deal of calculation power and time for static resource version number comparison, so that the main stream strategy is to set a strong cache for the resource, maintain an expiration time locally in a strong cache mode, and forcedly use the local cache whenever the current time is smaller than the expiration time during each request, regardless of whether the resource of the server is updated or not; if the static resource of the server is updated during the use of the page by the user, the page still loads old resources, display errors, data errors and the like are caused, even a system crash is caused under serious conditions, in order to avoid the problem, the technical scheme provides a method for comparing static resource version numbers, the static resource version numbers are generated in the construction period, static resource files are written and deployed together with the static resource files, when the user accesses the page, front-end code logic reads the static resource version number text files under the server static resource file directory through an ajax request, the static resource version numbers of the currently loaded resources are obtained, then in the operation process, if the user is in an active state, the version numbers in the latest static resource version number files are read at regular time, the latest version numbers are obtained, and are compared with the initial version numbers (static resource version numbers), if the version numbers are consistent, the content of the static resource files is unchanged; if the version numbers are inconsistent, indicating that the content of the static resource file is changed, popping up a notification bar which is resident and displayed at the top of the page, prompting a user to refresh, repeating the process until the content of the resource is changed again or the user closes a browser;
the method for real-time detection and update of the static resource version is mainly used for prompting a user to refresh a page only when the content of the static resource file is updated truly, avoiding unnecessary user operation and network requests, ensuring that the version number can accurately reflect the content of the static resource file, and realizing 'unchanged resource and unchanged version number'; the purpose of resource change, version package must change ".
The method for detecting and updating the static resource version in real time comprises the following specific steps of processing all static resource files in the step A1 to obtain static resource version number text files:
step B1: operating a summary algorithm on all the static resource files to obtain all the static resource version numbers;
step B2: arranging all static resource version numbers according to the name sequence of the static resource file to obtain a static resource version number text;
step B3: operating a summary algorithm on the static resource version number text to obtain a static resource version number text file;
the content of the static resource version number text file is generated by arranging the static resource version numbers of all the static resource files in sequence, so that the static resource version number can accurately reflect the change of any one file, and if the content and the file name of all the static resource files are unchanged, the calculated integral static resource version number is not changed;
the overall static resource version number is used as a version number, a static resource version number text file is generated and copied to a static resource file directory, the static resource version number text file is distributed and deployed together with the static resource file, the consistency of the life cycle of the static resource version number text file and the life cycle of the static resource file is ensured, the version of the static resource file can be accurately recorded, and after static resources are obtained and deployed, an operation link is entered;
as shown in fig. 2-3, are all applied to web front-end browsers.
The summary algorithm is a calculation method for calculating information and converting an input with any length into an output with a fixed length.
The method for detecting and updating the static resource version in real time is characterized in that the abstract algorithm is an SHA256 abstract algorithm, the abstract algorithm has collision resistance, different encryption algorithms have different collision resistance, although the collision probability is lower, the situation that updating is not performed in time due to collision is avoided, and in consideration of the fact that the method is lower in operation frequency and more time is used for comparison, the abstract algorithm with simple calculation such as md5 and SHA1 and the like and poor collision resistance is not selected in the technical scheme, and the abstract algorithm with better collision resistance such as SHA256 is selected;
for a single file, the summary algorithm can reflect the characteristics of the content of the single file, but the static resource file usually appears in the form of a catalog and contains a plurality of files, so after the static resource version number of the single file is acquired, the technical scheme also combines the static resource version numbers of all the files together through a certain file name alphabetical order, the summary algorithm is operated for the second time to obtain an overall static resource version number, the SHA256 summary algorithm is also selected here, the obtained static resource version number can accurately reflect the change of the static resource, and if the content of the static resource is unchanged, the finally output static resource version number is consistent no matter how many times the static resource version number is repeatedly constructed; likewise, even if only one file is added at the end of one line, the static resource version numbers are quite different;
the static resource version number in the form of the plain text is finally output by the technical scheme, repeated calculation is not needed in the follow-up process during comparison, and the transmission and the use are convenient.
The method for detecting and updating the static resource version in real time comprises the step A2 of storing the obtained static resource version number file into a browser.
In the method for detecting and updating the static resource version in real time, in the step A3, whether the page is in an active state is triggered and judged according to a set timer;
the judging step of whether the page is in an active state is as follows:
step C1: the initial state of the page is an active state, monitoring is carried out on the mouse and the keyboard, and time data of each operation of the mouse and the keyboard are recorded;
step C2: setting a timer, and judging whether the interval between the last mouse and keyboard operation time data and the current time data of a user is smaller than a specified time threshold value when the timer reaches time;
if the page is smaller than the page, the page is in an active state;
if not, the page is in an inactive state;
in the page running process, the static resource version number file in the server is read regularly, if the page is not in a using state, the change of the static resource file has no influence on a user, the static resource version number file is not required to be read regularly, at the moment, a request causes certain performance waste to the server, and unnecessary bandwidth is consumed; according to the method for judging the page active state during page operation, a monitor is arranged for mouse and keyboard operation of a user to monitor, current time data are recorded every time the mouse moves, left/right clicks and scrolls or a keyboard is pressed, because the triggering frequency of the mouse and the keyboard operation is high and can reach tens or hundreds of times, unnecessary consumption is caused to system performance by all records, so that throttle optimization is carried out on the logic of the monitor, the current time is compared with the last triggering time during each triggering, if the time is less than 500ms, the record is not carried out, the fact that the triggering time is recorded too frequently is ensured, in addition, meaningless performance consumption is avoided, in the page operation process, the last operation time of the user is detected at regular time through a timer, if the interval between the operation time and the current time is greater than a certain specified time threshold, the user is considered to be in an inactive state, otherwise, the user is considered to be in an active state.
After a specified time, an active state detection timer triggers, executing timer logic: judging whether the interval from the last time of triggering the mouse and the keyboard to the current time is more than 10 minutes, if yes, considering that the user is not active, setting the page state as not active, if not, considering that the user is active, setting the page state as active, resetting an active state detection timer, and waiting for the next triggering;
after a specified time, the version compares the timer trigger, executing timer logic: judging whether the current page is in an active state or not, wherein special explanation is needed, the version comparison timer and the active state detection timer are independently operated and do not interfere with each other, a single-thread mechanism of the front-end JavaScript engine ensures that the problem of thread unsafe does not occur between the two timers, the purpose of judging the active state is that the static resource version is not detected at any time for the page in the inactive state, so that unnecessary network requests are reduced, the burden of a server is reduced, the timers are reset, the next trigger is waited, if the current page is in the active state, the static resource version number file is acquired and stored from the server through the network requests, the latest static resource version number is read, and if the current page is consistent with the initial version number, the static resource of the server is not updated from the initial access page of a user to the present; otherwise, if the latest version number is inconsistent with the initial version number, the static resource of the server is considered to be updated, the content is indeed different, and the version number generation mechanism ensures that if the content of the static resource is unchanged, the version number can be kept consistent even if the static resource is repeatedly constructed and deployed, and the static resource cannot be considered to be updated;
if the static resource is updated, popping up a notification bar which is displayed in a resident mode at the top of the page, prompting a user to 'detect the static resource update, please refresh the page in order not to cause data errors', attaching a button to the notification bar, removing a current active state detection timer after clicking by the user, ending the life cycle of the page, refreshing the current page, and restarting the operation flow;
if the static resource is not updated, resetting the version comparison timer, and waiting for the next trigger until the page is refreshed or closed.
As shown in fig. 4, in a second aspect, a system for real-time detection and update of a static resource version includes a construction module 100, a state detection module 200, a comparison module 300, and a prompt module 400;
the construction module 100 is configured to obtain all static resource files, and process all static resource files to obtain static resource version number text files; the method is also used for loading the stored static resource version number file from the server during page initialization;
the state detection module 200 is configured to detect an active state of a page in real time, and extract a version number in a static resource version number file and transmit the version number to the comparison module 300 when the page is in the active state;
the comparison module 300 is used for acquiring the static resource version number in the static resource version number text file and comparing and judging whether the static resource version number is consistent with the version number, if so, re-detecting the active state of the page, and if not, generating prompt information transmitted to the prompt module 400;
the prompt module 400 is used for displaying prompt information on a page;
the system for detecting and updating the static resource version in real time is characterized in that a generating unit, a calculating unit and a network request unit are arranged in a building module 100;
the generating unit is used for acquiring the static resource file;
the computing unit is used for computing to obtain a static resource version number text file according to the obtained static resource file;
the network request unit is used for requesting to acquire the static resource version number file from the server during page initialization.
The above system for real-time detection and update of static resource version, wherein, the computing unit performs abstract algorithm processing on the static resource file to obtain a static resource version number, and arranging all the static resource version numbers according to the name sequence of the static resource file to obtain a static resource version number text, and operating a summary algorithm on the static resource version number text to obtain a static resource version number text file.
In a third aspect, a computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the method of any of the first aspects.
For example, the memory may include random access memory, flash memory, read-only memory, programmable read-only memory, non-volatile memory, registers, or the like;
the processor may be a central processing unit (Central Processing Unit, CPU) or the like, or an image processor (Graphic Processing Unit, GPU) memory may store executable instructions;
the processor may execute the execution instructions stored in the memory to implement the various processes described herein.
It will be appreciated that the memory in this embodiment may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory;
the nonvolatile memory may be a ROM (Read-only memory), a PROM (programmable Read-only memory), an EPROM (erasablprom, erasable programmable Read-only memory), an EEPROM (electrically erasable EPROM), or a flash memory.
The volatile memory may be a RAM (random access memory) which serves as an external cache;
by way of example, and not limitation, many forms of RAM are available, such as SRAM (static RAM), DRAM (dynamic RAM), SDRAM (synchronous DRAM), ddr SDRAM (DoubleDataRate SDRAM, double data rate synchronous DRAM), ESDRAM (Enhanced SDRAM), SLDRAM (synclinkdram), and DRRAM (directrambus RAM). The memory described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some embodiments, the memory stores the following elements, an upgrade package, an executable unit, or a data structure, or a subset thereof, or an extended set thereof: an operating system and application programs;
the operating system comprises various system programs, such as a framework layer, a core library layer, a driving layer and the like, and is used for realizing various basic services and processing hardware-based tasks;
and the application programs comprise various application programs and are used for realizing various application services. The program for implementing the method of the embodiment of the application can be contained in an application program.
Those of skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of software and electronic hardware;
whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution;
those skilled in the art may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In embodiments of the present application, the disclosed systems, devices, and methods may be implemented in other ways;
for example, the division of units or modules is merely a logic function division, and there may be another division manner when actually implemented;
for example, multiple units or modules or components may be combined or may be integrated into another system;
in addition, each functional unit or module in the embodiments of the present application may be integrated in one processing unit or module, or may exist separately and physically.
It should be understood that, in various embodiments of the present application, the size of the sequence number of each process does not mean that the execution sequence of each process should be determined by its functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
The functions, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored on a machine-readable storage medium;
accordingly, aspects of the present application may be embodied in a software product, which may be stored on a machine-readable storage medium, which may include instructions for causing an electronic device to perform all or part of the processes of the aspects described by embodiments of the present application;
the storage medium may include a ROM, a RAM, a removable disk, a hard disk, a magnetic disk, or an optical disk, etc. various media in which program codes can be stored.
In summary, the method and the system for real-time detection and update of the static resource version can generate the static resource version number text file for the static resource file in the construction period, detect the version of the static resource version number in the static resource file of the server at fixed time if the page is active in the operation period, compare the version with the version number loaded by the current page, prompt the user to refresh the page if the version is inconsistent, and effectively avoid a series of errors and crashes caused by untimely update of the static resource file and avoid waste of performance and bandwidth compared with the page which does not contain the technical scheme.
The foregoing describes specific embodiments of the application. It is to be understood that the application is not limited to the specific embodiments described above, wherein devices and structures not described in detail are to be understood as being implemented in a manner common in the art; numerous variations, changes, or substitutions of light can be made by one skilled in the art without departing from the spirit of the application and the scope of the claims.

Claims (8)

1. The method for real-time detection and update of the static resource version is characterized by comprising the following steps:
step A1: acquiring all static resource files, and processing all the static resource files to obtain static resource version number text files;
step A2: when the page is initialized, the stored static resource version number file is loaded from the server;
step A3: judging whether the page is in an active state or not;
if the page is not in an active state, not performing any operation;
if the page is in an active state, acquiring a static resource version number file and extracting a version number in the static resource version number file;
step A4: comparing the version number with the static resource version number in the static resource version number text file to judge whether the version number is consistent with the static resource version number;
if the static resource files are consistent, judging that the static resource files are not changed, and returning to the execution step A3;
if the static resource files are inconsistent, judging that the static resource files are updated, and prompting a user to refresh the page through a notification bar displayed in a resident mode;
in the step A3, whether the page is in an active state is judged by triggering and judging whether the page is in an active state according to a set timer;
the judging step of whether the page is in an active state is as follows:
step C1: the initial state of the page is an active state, monitoring is carried out on the mouse and the keyboard, and time data of each operation of the mouse and the keyboard are recorded;
step C2: setting a timer, and judging whether the interval between the last mouse and keyboard operation time data and the current time data of a user is smaller than a specified time threshold value when the timer reaches time;
if the page is smaller than the page, the page is in an active state;
if not, the page is in an inactive state.
2. The method for real-time detection and update of static resource version as claimed in claim 1, wherein the specific steps of processing all static resource files in step A1 to obtain static resource version number text files are as follows:
step B1: operating a summary algorithm on all the static resource files to obtain all the static resource version numbers;
step B2: arranging all static resource version numbers according to the name sequence of the static resource file to obtain a static resource version number text;
step B3: and running a summary algorithm on the static resource version number text to obtain a static resource version number text file.
3. The method for real-time detection and update of static resource versions according to claim 2, wherein the digest algorithm is a SHA256 digest algorithm.
4. The method for real-time detection and update of static resource version as claimed in claim 3, wherein in step A2, the obtained static resource version number file is saved in the browser.
5. The system for detecting and updating the static resource version in real time is characterized by comprising a construction module, a state detection module, a comparison module and a prompt module;
the construction module is used for acquiring all static resource files and processing all the static resource files to obtain static resource version number text files; the method is also used for loading the stored static resource version number file from the server during page initialization;
the state detection module is used for detecting the active state of the page in real time, extracting the version number in the static resource version number file and transmitting the version number to the comparison module when the page is in the active state, wherein judging whether the page is in the active state is triggered and judged according to a set timer; the judging step of whether the page is in an active state is as follows: the initial state of the page is an active state, monitoring is carried out on the mouse and the keyboard, and time data of each operation of the mouse and the keyboard are recorded; setting a timer, and judging whether the interval between the last mouse and keyboard operation time data and the current time data of a user is smaller than a specified time threshold value when the timer reaches time; if the page is smaller than the page, the page is in an active state; if not, the page is in an inactive state;
the comparison module is used for acquiring the static resource version number in the static resource version number text file and comparing and judging whether the static resource version number is consistent with the version number, if so, the active state of the page is re-detected, and if not, prompt information transmitted to the prompt module is generated;
the prompt module is used for displaying the prompt information on a page.
6. The system for real-time detection and update of static resource version according to claim 5, wherein said building module is built with a generating unit, a calculating unit, and a network requesting unit;
the generating unit is used for acquiring the static resource file;
the computing unit is used for computing according to the obtained static resource file to obtain a static resource version number text file;
the network request unit is used for requesting to acquire the static resource version number file from the server during page initialization.
7. The system for real-time detection and update of a static resource version according to claim 6, wherein the computing unit performs a summary algorithm on the static resource file to obtain a static resource version number, arranges all static resource version numbers according to a name sequence of the static resource file to obtain a static resource version number text, and performs a summary algorithm on the static resource version number text to obtain a static resource version number text file.
8. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 4.
CN202110988918.1A 2021-08-26 2021-08-26 Method and system for real-time detection and update of static resource version Active CN113703807B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110988918.1A CN113703807B (en) 2021-08-26 2021-08-26 Method and system for real-time detection and update of static resource version

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110988918.1A CN113703807B (en) 2021-08-26 2021-08-26 Method and system for real-time detection and update of static resource version

Publications (2)

Publication Number Publication Date
CN113703807A CN113703807A (en) 2021-11-26
CN113703807B true CN113703807B (en) 2023-12-15

Family

ID=78655271

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110988918.1A Active CN113703807B (en) 2021-08-26 2021-08-26 Method and system for real-time detection and update of static resource version

Country Status (1)

Country Link
CN (1) CN113703807B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114518922B (en) * 2021-12-28 2024-03-05 百果园技术(新加坡)有限公司 Page display system, method and device, electronic equipment and storage medium
CN114924740A (en) * 2022-04-26 2022-08-19 江苏康众汽配有限公司 Active detection method for resource failure in front-end single-page application

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103092665A (en) * 2013-03-01 2013-05-08 畅捷通信息技术股份有限公司 Immediate updating device and immediate updating method
CN106649395A (en) * 2015-11-03 2017-05-10 腾讯科技(深圳)有限公司 Webpage updating method and apparatus
CN107301051A (en) * 2017-06-27 2017-10-27 深圳市金立通信设备有限公司 The caching of terminal dynamic data and exchange method, terminal, system and computer-readable recording medium
CN108304207A (en) * 2018-03-01 2018-07-20 上海找钢网信息科技股份有限公司 Mix the resource regeneration method and system of APP application programs
CN110244957A (en) * 2019-05-10 2019-09-17 阿里巴巴集团控股有限公司 A kind of resource data updating method, apparatus and system
CN110244962A (en) * 2019-04-29 2019-09-17 北京辰森世纪科技股份有限公司 Load application file and device, system, storage medium, electronic device
CN110244975A (en) * 2018-03-08 2019-09-17 北京京东尚科信息技术有限公司 A kind of generation method and device of static resource version number
WO2019242166A1 (en) * 2018-06-22 2019-12-26 平安科技(深圳)有限公司 Application update method and system, and computer device and storage medium
CN111046311A (en) * 2019-12-17 2020-04-21 深圳前海环融联易信息科技服务有限公司 Method and device for realizing traceless iteration version of PC (personal computer) end, computer equipment and storage medium
CN113268239A (en) * 2021-06-04 2021-08-17 平安科技(深圳)有限公司 Desktop application view construction method, device, equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9690563B2 (en) * 2012-05-17 2017-06-27 International Business Machines Corporation Updating web resources
US10620934B2 (en) * 2018-01-24 2020-04-14 Citrix Systems, Inc. Systems and methods for versioning a cloud environment for a device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103092665A (en) * 2013-03-01 2013-05-08 畅捷通信息技术股份有限公司 Immediate updating device and immediate updating method
CN106649395A (en) * 2015-11-03 2017-05-10 腾讯科技(深圳)有限公司 Webpage updating method and apparatus
CN107301051A (en) * 2017-06-27 2017-10-27 深圳市金立通信设备有限公司 The caching of terminal dynamic data and exchange method, terminal, system and computer-readable recording medium
CN108304207A (en) * 2018-03-01 2018-07-20 上海找钢网信息科技股份有限公司 Mix the resource regeneration method and system of APP application programs
CN110244975A (en) * 2018-03-08 2019-09-17 北京京东尚科信息技术有限公司 A kind of generation method and device of static resource version number
WO2019242166A1 (en) * 2018-06-22 2019-12-26 平安科技(深圳)有限公司 Application update method and system, and computer device and storage medium
CN110244962A (en) * 2019-04-29 2019-09-17 北京辰森世纪科技股份有限公司 Load application file and device, system, storage medium, electronic device
CN110244957A (en) * 2019-05-10 2019-09-17 阿里巴巴集团控股有限公司 A kind of resource data updating method, apparatus and system
CN111046311A (en) * 2019-12-17 2020-04-21 深圳前海环融联易信息科技服务有限公司 Method and device for realizing traceless iteration version of PC (personal computer) end, computer equipment and storage medium
CN113268239A (en) * 2021-06-04 2021-08-17 平安科技(深圳)有限公司 Desktop application view construction method, device, equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Deepak Kumar Ganeshiya等.A novel approach for webpage ranking using updated content.《Confluence The Next Generation Information Technology Summit (Confluence)》.2014,第210-214页. *
Web资源离线化和增量更新平台的设计与实现;张健;《中国优秀硕士学位论文全文数据库 信息科技辑》(第1期);I138-800 *

Also Published As

Publication number Publication date
CN113703807A (en) 2021-11-26

Similar Documents

Publication Publication Date Title
CN113703807B (en) Method and system for real-time detection and update of static resource version
US10613970B1 (en) Method and system for managing deployment of software application components based on software performance data
US8745164B2 (en) Method and system to detect a cached web page
CN110263275A (en) A kind of method, apparatus, mobile terminal and storage medium accessing webpage
WO2020181810A1 (en) Data processing method and apparatus applied to multi-level caching in cluster
CN104254840A (en) Memory dump and analysis in a computer system
US11018965B1 (en) Serverless function scaling
CN111078659B (en) Model updating method, device, computer readable storage medium and computer equipment
US20150161082A1 (en) Techniques for analyzing web pages to determine font subsets
WO2019242455A1 (en) Method and apparatus for user request forwarding, reverse proxy and computer readable storage medium
CN113407383B (en) Main and standby system switching method and device, server and main and standby system
US9690633B2 (en) Synchronization method
CN113411404A (en) File downloading method, device, server and storage medium
US8860735B2 (en) Aligning script animations with display refresh
US20190149571A1 (en) Method and device for repairing page vulnerability
US20130067320A1 (en) Batch Document Formatting and Layout on Display Refresh
US8032618B2 (en) Asynchronous update of virtualized applications
US20150205675A1 (en) Method and System for Improving Reliability of a Background Page
US20160182673A1 (en) Dynamic cache injector
US20160196149A1 (en) Milestone based dynamic multiple watchdog timeouts and early failure detection
US10558528B2 (en) Reconstruction of system definitional and state information
US20180210664A1 (en) System and method for managing a storage system
CN116821533A (en) Page rendering method, computer device and computer-readable storage medium
US11356532B1 (en) Systems and methods for packaging web resources
CN111427623A (en) Program exit method, device, computer equipment and storage medium

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