CN110244975A - A kind of generation method and device of static resource version number - Google Patents

A kind of generation method and device of static resource version number Download PDF

Info

Publication number
CN110244975A
CN110244975A CN201810189831.6A CN201810189831A CN110244975A CN 110244975 A CN110244975 A CN 110244975A CN 201810189831 A CN201810189831 A CN 201810189831A CN 110244975 A CN110244975 A CN 110244975A
Authority
CN
China
Prior art keywords
static resource
local
acquisition request
time
version number
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.)
Pending
Application number
CN201810189831.6A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810189831.6A priority Critical patent/CN110244975A/en
Publication of CN110244975A publication Critical patent/CN110244975A/en
Pending legal-status Critical Current

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

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 invention discloses the generation methods and device of a kind of static resource version number, are related to field of computer technology.One specific embodiment of this method includes: to receive the acquisition request of static resource, intercepts and parse the acquisition request, obtains static resource and quotes path, with the local static resource under determination static resource reference path;The nearest modification time of the local static resource is obtained, the version number of static resource in the acquisition request is replaced with the nearest modification time of the local static resource.The embodiment is able to solve the problem of can not being conveniently generated static resource version number.

Description

A kind of generation method and device of static resource version number
Technical field
The present invention relates to field of computer technology more particularly to a kind of generation methods and device of static resource version number.
Background technique
For performance consideration, current most of front end systems can all do static resource caching process.But when in static resource When appearance changes, browser cannot but automatically update caching.To solve this problem, usual way is to introduce static resource When, increase version number behind static resource reference path, after modifying static file content every time, introduces the place of this file (i.e. static resource reference path) requires to modify specific version number.The main version that static resource is modified by two ways at present This number: manual modification static resource version number;Static resource version is automatically generated using the automation the build tool such as glup, grunt This number.
In realizing process of the present invention, at least there are the following problems in the prior art: manual revision for inventor's discovery It number is easy to ignore or forget, after causing function to be issued, client is led to system abnormity due to cache problem;Automate the build tool Automatically generating version number is realized by way of modify filename, can generate new file every time in this way, so then The code for needing to modify reference this document, causes complicated for operation.Therefore, building work is still either automated by manual modification Tool, can not all be conveniently generated static resource version number.
Summary of the invention
In view of this, the embodiment of the present invention provides the generation method and device of a kind of static resource version number, it is able to solve The problem of static resource version number can not be conveniently generated.
To achieve the above object, according to an aspect of an embodiment of the present invention, a kind of static resource version number is provided Generation method, comprising:
The acquisition request for receiving static resource intercepts and parses the acquisition request, obtains static resource and quotes path, with Determine the local static resource under static resource reference path;
The nearest modification time of the local static resource is obtained, is replaced with the nearest modification time of the local static resource Change the version number of static resource in the acquisition request.
Optionally, the nearest modification time of the local static resource is obtained, with repairing recently for the local static resource Change the version number that the time replaces static resource in the acquisition request, comprising:
The first time stamp of the local static resource is obtained, the first time stabs as the local static resource most Nearly modification time;
The second timestamp of static resource in the acquisition request is obtained, second timestamp is in the acquisition request The modification time of the static resource of terminal buffers;
It determines that the first time stamp is inconsistent with the second timestamp, the acquisition request is replaced with first time stamp Second timestamp of middle static resource.
Optionally, the nearest modification time of the local static resource is the starting time for automating the build tool;
The acquisition request of static resource is received, before, the method also includes:
When automating the build tool starting, the starting time of described automation the build tool is obtained and stored.
Optionally, the nearest modification time of the local static resource is obtained, with repairing recently for the local static resource Change the version number that the time replaces static resource in the acquisition request, later, the method also includes: the local that will be modified recently Static resource returns to terminal.
Optionally, the nearest modification time of the local static resource is obtained, with repairing recently for the local static resource Change the version number that the time replaces static resource in the acquisition request, later, the method also includes: with the local static money The version number in static resource reference path in the nearest modification time replacement local page data in source.
In addition, other side according to an embodiment of the present invention, provides a kind of generating means of static resource version number, Include:
Blocking module intercepts and parses the acquisition request for receiving the acquisition request of static resource, obtain static money Path is quoted in source, with the local static resource under determination static resource reference path;
Replacement module, for obtaining the nearest modification time of the local static resource, with the local static resource Nearest modification time replaces the version number of static resource in the acquisition request.
Optionally, the replacement module is used for:
The first time stamp of the local static resource is obtained, the first time stabs as the local static resource most Nearly modification time;
The second timestamp of static resource in the acquisition request is obtained, second timestamp is in the acquisition request The modification time of the static resource of terminal buffers;
It determines that the first time stamp is inconsistent with the second timestamp, the acquisition request is replaced with first time stamp Second timestamp of middle static resource.
Optionally, the nearest modification time of the local static resource is the starting time for automating the build tool;
Described device further includes memory module, and before the acquisition request for receiving static resource, the memory module is for working as When automating the build tool starting, the starting time of described automation the build tool is obtained and stored.
Optionally, described device further includes return module, the nearest modification time of the local static resource is obtained, with institute The nearest modification time for stating local static resource is replaced in the acquisition request after the version number of static resource, the return mould Block is used to the local static resource modified recently returning to terminal.
Optionally, the nearest modification time of the local static resource is obtained, with repairing recently for the local static resource Changing the time replaces in the acquisition request after the version number of static resource, and the replacement module is also used to described local static The version number in static resource reference path in the nearest modification time replacement local page data of resource.
Other side according to an embodiment of the present invention, additionally provides a kind of electronic equipment, comprising:
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processing Device realizes method described in any of the above-described embodiment.
Other side according to an embodiment of the present invention additionally provides a kind of computer-readable medium, is stored thereon with meter Calculation machine program, realizes method described in any of the above-described embodiment when described program is executed by processor.
One embodiment in foregoing invention has the following advantages that or the utility model has the advantages that because repairing recently using static resource Change the technological means of the version number of static resource in time replacement request, so static resource version can not be conveniently generated by overcoming This number the technical issues of, the present invention is using the nearest modification time of static resource as current version number, and most by static resource Nearly modification time is updated into request, to replace old version number, therefore automatically by the nearest modification time of static resource Fixed version number is become into a variable, does not both have to manual modification static resource version number, without regenerating new file Name, as long as automation the build tool starting, so that it may refresh terminal buffers automatically.Therefore, method energy provided in an embodiment of the present invention Version number enough is automatically generated for static resource, it is not necessary to which manual modification again need not also modify reference path, can also prevent from malfunctioning.
Further effect possessed by above-mentioned non-usual optional way adds hereinafter in conjunction with specific embodiment With explanation.
Detailed description of the invention
Attached drawing for a better understanding of the present invention, does not constitute an undue limitation on the present invention.Wherein:
Fig. 1 is the schematic diagram of the main flow of the generation method of static resource version number according to an embodiment of the present invention;
Fig. 2 is the main flow of the generation method of a static resource version number that can refer to embodiment according to the present invention Schematic diagram;
Fig. 3 is the schematic diagram of the main modular of the generating means of static resource version number according to an embodiment of the present invention;
Fig. 4 is that the embodiment of the present invention can be applied to exemplary system architecture figure therein;
Fig. 5 is adapted for the structural representation of the computer system for the terminal device or server of realizing the embodiment of the present invention Figure.
Specific embodiment
Below in conjunction with attached drawing, an exemplary embodiment of the present invention will be described, including the various of the embodiment of the present invention Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize It arrives, it can be with various changes and modifications are made to the embodiments described herein, without departing from scope and spirit of the present invention.Together Sample, for clarity and conciseness, descriptions of well-known functions and structures are omitted from the following description.
Fig. 1 is the schematic diagram of the main flow of the generation method of static resource version number according to an embodiment of the present invention.Such as Shown in Fig. 1, as an embodiment of the present invention, the generation method of the static resource version number may include:
Step 101, the acquisition request for receiving static resource intercepts and parses the acquisition request, obtains static resource and draws With path, the local static resource under path is quoted with the determination static resource.
Page static resource required when loading can be .js file (Javascript code file), be also possible to .cs File (C# language source code file) is also possible to css file (Cascading Style Sheet, cascading style list), also It can be the resource files such as picture.
After terminal to server sends the acquisition request of page data, server back page data are quoted again in the page Static resource, triggering parsing static resource when browser loading page, terminal send obtaining for static resource to server again Request is taken, server quotes path based on the static resource in request and returns to static resource to terminal.
Terminal can judge associated static resource whether has been stored in terminal according to static resource path, if not stored, Static resource can be then downloaded from server, and stores and arrives predeterminated position, and the predeterminated position corresponding page loads static resource Path.It, can in subsequent page rendering if judge that terminal has stored associated static resource according to static resource path To be loaded directly into the static resource, without downloading static resource from server, broadband and time can be effectively saved.
Terminal send request URI (Uniform Resource Identifier, uniform resource locator) can be URL (Uniform Resource Locator, uniform resource locator) format, in an embodiment of the present invention, the acquisition Request includes that static resource quotes path, can determine that the static resource of the page quotes road according to the information carried in the URL Diameter.
It should be pointed out that modified static resource storage is on the server, need to update the static state for being buffered in terminal Resource, therefore path is quoted by static resource and determines that the static resource quotes the static resource under path, to obtain storage The version number of modified static resource on the server.
As another embodiment of the invention, acquisition request is intercepted and parsed by blocker, in order in subsequent step The version number of the static resource of terminal buffers in the acquisition request is modified in rapid.The blocker can be SpringMVC and block Device is cut, SpringMVC blocker is a kind of lightweight Web frame based on Java, and effect is simplified Web exploitation.SpringMVC Blocker is can according to demand, by code setting to specifically requesting the blocker intercepted, such as of the invention In embodiment, it can be made to intercept the static resource that terminal to server is sent by code configuration SpringMVC blocker Acquisition request.
Optionally, blocker parses request, such as obtains the specified static state of request by SpringMVC blocker Quoting resource path, so that it is determined that the static resource of storage on the server under static resource reference path.
Step 102, the nearest modification time of the local static resource is obtained, with repairing recently for the local static resource Change the version number that the time replaces static resource in the acquisition request.
It for example, in the prior art, is the fixed version number of increase in static resource reference path, such as:
< script type=" text/javascript " src=" #springUrl ('/static/widgets/ Simplet able/simpletable.js?v=1.0></script>
And in an embodiment of the present invention, by the nearest modification time of server local static resource, modify automatically quiet State quoting resource path, using the nearest modification time of static resource as version number.Specifically, variable $ can be used The original fixed version number of { staticResVersion } replacement.
Using the nearest modification time of static resource as version number, such as:
< script type=" text/javascript " src=" #springUrl ('/static/widgets/ Simple table/simpletable.js?v=' ) ${staticResVersion}"></script>
If local static resource is consistent with the static resource of terminal buffers, do not need to execute step 103, if local Static resource and the static resource of terminal buffers are inconsistent, then follow the steps 103.As another embodiment of the invention, step Rapid 103 include: firstly, obtaining the first time stamp of the local static resource, and the first time stamp is described local static The nearest modification time of resource;Then, the second timestamp of static resource in the acquisition request, second timestamp are obtained For the modification time of the static resource of terminal buffers in the acquisition request;Finally, when determining the first time stamp with second Between stab inconsistent, the second timestamp of static resource in the acquisition request is replaced with first time stamp.
If recently static resource assert the time of the Last modification of static resource, i.e., by repeatedly modification Modification time is to stab at the first time.When static resource has multiple files, some files are modified, and some files are not repaired Change, then the time that the first time stamp of static resource can be nearest for modification time in all modifications file.
It should be pointed out that in an embodiment of the present invention, can first obtain and stab at the first time, then obtain for the second time Stamp;The second timestamp can also be first obtained, then obtains and stabs at the first time;Stamp and the second time at the first time can also be obtained simultaneously Technical effect of the invention may be implemented in stamp, the invention is not limited in this regard, these embodiments.
It is whether consistent with the second timestamp by judging to stab at the first time, to judge that local static resource and terminal are slow Whether the static resource deposited is consistent, only when determining that stamp is inconsistent with the second timestamp at the first time, with first time stamp The second timestamp of the static resource of terminal buffers in the acquisition request is replaced, to avoid repeated downloads, saves customer flow, Improve user experience.
It is alternatively possible to be configured as follows in the development phase, to realize the generation side of the static resource version number Method.
Step 1: function file is introduced system.
Step 2: defining blocker, interception request.
Step 3: modification static resource quotes path, original fixed version is replaced using variable $ { staticResVersion } This number.
Such as:
< script type=" text/javascript " src=" #springUrl ('/static/widgets/ Simple table/simpletable.js?v=' ) ${staticResVersion}"></script>
For example, by taking timestamp 20180205101700 as an example, automatic static resource of modifying quotes path, with static state money The nearest modification time in source is as version number:
< script type=" text/javascript " src=" #springUrl ('/static/widgets/ Simplet able/simpletable.js?v=20180205101700></script>
Optionally, in yet another embodiment of the present invention, the nearest modification time of the local static resource is automatic Change the starting time of the build tool, or the modification time of manual modification local static resource.
For automating the build tool, as in yet another embodiment of the present invention, before step 101, the side Method further include: when automating the build tool starting, obtain and store the starting time of described automation the build tool.In step The starting time of automation the build tool is stored in advance before 101, in order to rapidly obtain local static money in step 103 The nearest modification time in source, improves the formation speed of version number.
Therefore, the method provided through the embodiment of the present invention, when automating the build tool starting, when automatically generating starting Between stab (i.e. the nearest modification time of static resource), as current version number, replace the version of static resource in acquisition request This number, so that version number's content behind static resource path is changed to a variable by occurrence.The variable can be with dynamicization structure Build the instrument start-up time changes automatically, in this way, both do not have to manual modification static resource version number, without regenerating new text Part name will not generate new file.
Automation the build tool starting time can be as accurate as the second, be formatted as:
Yyyymmddhhmmss, i.e. date Hour Minute Second, such as 20180205195600.
As another embodiment of the invention, the method also includes: the local static resource modified recently is returned To terminal.If the static resource of static resource and terminal buffers on server is inconsistent, needs to return to terminal and modify Static resource afterwards, terminal browser update caching due to version change, to avoid because caching do not update caused by system it is new Dysfunction.
As another embodiment of the invention, the method also includes: with the nearest modification of the local static resource Time replaces the version number in the static resource reference path in local page data.So when terminal to server request page When data, the static resource of acquisition reference path be also it is updated, to prevent system new function caused by not updating because of caching It is abnormal.
According to various embodiments recited above, it can be seen that the present invention by using static resource nearest modification time The technological means of the version number of static resource in replacement request, so that static resource version number can not be conveniently generated by solving Problem.That is, in the prior art, there are problems that manual revision number is easy to ignore or forget, there is also automatic New file can be generated every time by changing when the build tool automatically generates version number, then needs to modify asking for the code of reference this document Topic.And the present invention is using the nearest modification time of static resource as current version number, and when by the nearest modification of static resource Between update into request, to replace old version number, therefore automatically will fixed version by the nearest modification time of static resource This number becomes a variable, does not both have to manual modification static resource version number, without new filename is regenerated, as long as being System is restarted, so that automation the build tool starting, so that it may refresh terminal buffers automatically.Therefore, side provided in an embodiment of the present invention Method can automatically generate version number for static resource, it is not necessary to which manual modification again need not also modify reference path, can also prevent out It is wrong.
Fig. 2 is the main flow of the generation method of a static resource version number that can refer to embodiment according to the present invention Schematic diagram.As another embodiment of the invention, the generation method of the static resource version number may include:
Step 201, when automating the build tool starting, when obtaining and storing the starting of described automation the build tool Between;
Step 202, the acquisition request of static resource is received;
Step 203, the acquisition request is intercepted and parsed, static resource is obtained and quotes path, so that it is determined that the static state Local static resource under quoting resource path;
Step 204, the first time stamp of the local static resource is obtained, the first time stamp is described local static The nearest modification time of resource;
Step 205, the second timestamp of static resource in the acquisition request is obtained, second timestamp is described obtains Take the modification time of the static resource of terminal buffers in request;
Step 206, judge whether stamp is consistent with the second timestamp at the first time, if it is not, 207 are thened follow the steps, if so, Terminate;
Step 207, when replacing second of the static resource of terminal buffers in the acquisition request with first time stamp Between stab.
Step 208, with the static resource in the nearest modification time replacement local page data of the local static resource The version number in path is quoted, and the local static resource modified recently is returned into terminal.
It should be pointed out that step 204 can be first carried out, step 205 is being executed, step 205 can also first carried out, then hold Row step 204, may also be performed simultaneously step 204 and step 205, and Fig. 2 is only to schematically illustrate sequence of steps, this hair It is bright to this with no restriction.
It should be pointed out that can refer to the generation method of static resource version number described in embodiment at the present invention one Content is embodied, has been described in detail in the generation method of static resource version number described above, therefore in being repeated at this Appearance no longer illustrates.
Fig. 3 is the generating means of static resource version number according to an embodiment of the present invention, as shown in figure 3, the static money The generating means 300 of source version number include blocking module 301 and replacement module 302, and the blocking module 301 receives static resource Acquisition request, intercept and parse the acquisition request, obtain static resource and quote path, with the determination static resource reference Local static resource under path, the replacement module 302 obtains the nearest modification time of the local static resource, with described The nearest modification time of local static resource replaces the version number of static resource in the acquisition request.
Page static resource required when loading can be .js file (Javascript code file), be also possible to .cs File (C# language source code file) is also possible to css file (Cascading Style Sheet, cascading style list), also It can be the resource files such as picture.
After terminal to server sends the acquisition request of page data, server back page data are quoted again in the page Static resource, triggering parsing static resource when browser loading page, terminal send obtaining for static resource to server again Request is taken, server quotes path based on the static resource in request and returns to static resource to terminal.
Terminal can judge associated static resource whether has been stored in terminal according to static resource path, if not stored, Static resource can be then downloaded from server, and stores and arrives predeterminated position, and the predeterminated position corresponding page loads static resource Path.It, can in subsequent page rendering if judge that terminal has stored associated static resource according to static resource path To be loaded directly into the static resource, without downloading static resource from server, broadband and time can be effectively saved.
It should be pointed out that modified static resource storage is on the server, need to update the static state for being buffered in terminal Resource, therefore path is quoted by static resource and determines that the static resource quotes the static resource under path, to obtain storage The version number of modified static resource on the server.
Optionally, the replacement module 302 obtains the first time stamp of the local static resource, the first time stamp For the nearest modification time of the local static resource;The second timestamp of static resource in the acquisition request is obtained, it is described Second timestamp is the modification time of the static resource of terminal buffers in the acquisition request;Determine first time stamp and the Two timestamps are inconsistent, and the second timestamp of static resource in the acquisition request is replaced with first time stamp.As it can be seen that institute It is whether consistent with the second timestamp by judging to stab at the first time to state replacement module 302, to judge the static money on server Whether the static resource of source and terminal buffers is consistent, only when determining that stamp is inconsistent with the second timestamp at the first time, with described Stamp replaces the second timestamp of the static resource of terminal buffers in the request at the first time, to avoid repeated downloads, saves and uses Family flow improves user experience.
If recently static resource assert the time of the Last modification of static resource, i.e., by repeatedly modification Modification time is to stab at the first time.When static resource has multiple files, some files are modified, and some files are not repaired Change, then the time that the first time stamp of static resource can be nearest for modification time in all modifications file.
It should be pointed out that in an embodiment of the present invention, can first obtain and stab at the first time, then obtain for the second time Stamp;The second timestamp can also be first obtained, then obtains and stabs at the first time;Stamp and the second time at the first time can also be obtained simultaneously Technical effect of the invention may be implemented in stamp, the invention is not limited in this regard, these embodiments.
Optionally, in yet another embodiment of the present invention, the nearest modification time of the local static resource is automatic Change the starting time of the build tool, or the modification time of manual modification local static resource.
Optionally, the nearest modification time of the local static resource is the starting time for automating the build tool.
Optionally, described device further includes memory module, and when automating the build tool starting, the memory module is obtained And store the starting time of described automation the build tool.Therefore, the device provided through the embodiment of the present invention, when automation structure When building instrument start-up, starting timestamp (the nearest modification time of i.e. local static resource) is automatically generated, as current version This number, the version number of the static resource of terminal buffers in replacement request, so that version number's content behind static resource path is by having Body value is changed to a variable.The variable can change automatically as dynamicization the build tool starts the time, in this way, both not having to repair manually Change static resource version number, without new filename is regenerated, new file will not be generated.
The starting time of automation the build tool is stored in advance, in order to which the replacement module 303 rapidly obtains locally The nearest modification time of static resource, improves the formation speed of version number.
Optionally, described device further includes return module, the nearest modification time of the local static resource is obtained, with institute The nearest modification time for stating local static resource is replaced in the acquisition request after the version number of static resource, the return mould The local static resource modified recently is returned to terminal by block.If the static money of static resource and terminal buffers on server Source is inconsistent, then needs to return modified static resource to terminal, terminal browser is cached since version change updates, to keep away It is abnormal to exempt from system new function caused by not updating because of caching.
Optionally, the nearest modification time of the local static resource is obtained, with repairing recently for the local static resource Changing the time replaces in the acquisition request after the version number of static resource, and the replacement module 303 is also with the static resource Nearest modification time replacement local page data in static resource reference path in version number.So when terminal is to service When device request page data, the static resource of acquisition reference path be also it is updated, caused by preventing from not updating because of caching System new function is abnormal.
According to various embodiments recited above, it can be seen that the present invention by using static resource nearest modification time The technological means of the version number of static resource in replacement request, so that static resource version number can not be conveniently generated by solving Problem.That is, in the prior art, there are problems that manual revision number is easy to ignore or forget, there is also automatic New file can be generated every time by changing when the build tool automatically generates version number, then needs to modify asking for the code of reference this document Topic.And the present invention is using the nearest modification time of static resource as current version number, and when by the nearest modification of static resource Between update into request, to replace old version number, therefore automatically will fixed version by the nearest modification time of static resource This number becomes a variable, does not both have to manual modification static resource version number, without new filename is regenerated, as long as certainly Dynamicization the build tool starting, so that it may refresh terminal buffers automatically.Therefore, method provided in an embodiment of the present invention can be static money The automatic build version number in source, it is not necessary to which manual modification again need not also modify reference path, can also prevent from malfunctioning.
It should be noted that the specific implementation content of the generating means in static resource version number of the present invention, upper It has been described in detail in the generation method of static resource version number described in face, therefore has no longer illustrated in this duplicate contents.
Fig. 4 shows generation method or the static resource version number that can apply static resource of embodiment of the present invention version number Generating means exemplary system architecture 400.
As shown in figure 4, system architecture 400 may include terminal device 401,402,403, network 404 and server 405. Network 404 between terminal device 401,402,403 and server 405 to provide the medium of communication link.Network 404 can be with Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 401,402,403 and be interacted by network 404 with server 405, to receive or send out Send message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 401,402,403 (merely illustrative) such as the application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform softwares.
Terminal device 401,402,403 can be the various electronic equipments with display screen and supported web page browsing, packet Include but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 405 can be to provide the server of various services, such as utilize terminal device 401,402,403 to user The shopping class website browsed provides the back-stage management server (merely illustrative) supported.Back-stage management server can be to reception To the data such as information query request analyze etc. processing, and by processing result (such as target push information, product letter Breath --- merely illustrative) feed back to terminal device.
It should be noted that the generation method of static resource version number is generally by server provided by the embodiment of the present invention 405 execute, and correspondingly, the generating means of the static resource version number are generally located in server 405.
It should be understood that the number of terminal device, network and server in Fig. 4 is only schematical.According to realization need It wants, can have any number of terminal device, network and server.
Below with reference to Fig. 5, it illustrates the computer systems 500 for the terminal device for being suitable for being used to realize the embodiment of the present invention Structural schematic diagram.Terminal device shown in Fig. 5 is only an example, function to the embodiment of the present invention and should not use model Shroud carrys out any restrictions.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in Program in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 and Execute various movements appropriate and processing.In RAM 503, also it is stored with system 500 and operates required various programs and data. CPU 501, ROM 502 and RAM503 are connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to always Line 504.
I/O interface 505 is connected to lower component: the importation 506 including keyboard, mouse etc.;It is penetrated including such as cathode The output par, c 507 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 508 including hard disk etc.; And the communications portion 509 of the network interface card including LAN card, modem etc..Communications portion 509 via such as because The network of spy's net executes communication process.Driver 510 is also connected to I/O interface 505 as needed.Detachable media 511, such as Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 510, in order to read from thereon Computer program be mounted into storage section 508 as needed.
Particularly, disclosed embodiment, the process described above with reference to flow chart may be implemented as counting according to the present invention Calculation machine software program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computer Computer program on readable medium, the computer program include the program code for method shown in execution flow chart.? In such embodiment, which can be downloaded and installed from network by communications portion 509, and/or from can Medium 511 is dismantled to be mounted.When the computer program is executed by central processing unit (CPU) 501, system of the invention is executed The above-mentioned function of middle restriction.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meter Calculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but not Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Meter The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wires Taking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storage Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device, Or above-mentioned any appropriate combination.In the present invention, computer readable storage medium can be it is any include or storage journey The tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.And at this In invention, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for By the use of instruction execution system, device or device or program in connection.Include on computer-readable medium Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned Any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, program segment or code of table, a part of above-mentioned module, program segment or code include one or more Executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in box The function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practical On can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it wants It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute rule The dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instruction It closes to realize.
Being described in module involved in the embodiment of the present invention can be realized by way of software, can also be by hard The mode of part is realized.Described module also can be set in the processor, for example, can be described as: a kind of processor packet Include blocking module and replacement module, wherein the title of these modules does not constitute the limit to the module itself under certain conditions It is fixed.
As on the other hand, the present invention also provides a kind of computer-readable medium, which be can be Included in equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying equipment.Above-mentioned calculating Machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makes Obtaining the equipment includes: to receive the acquisition request of static resource, intercepts and parse the acquisition request, obtains static resource and quotes road Diameter, with the local static resource under determination static resource reference path;Obtain the nearest modification of the local static resource Time replaces the version number of static resource in the acquisition request with the nearest modification time of the local static resource.
Technical solution according to an embodiment of the present invention, because using quiet in the nearest modification time replacement request of static resource The technological means of the version number of state resource, so the technical issues of can not being conveniently generated static resource version number is overcome, this Invention updates the nearest modification time of static resource to asking using the nearest modification time of static resource as current version number In asking, to replace old version number, therefore fixed version number is automatically become one by the nearest modification time of static resource A variable does not both have to manual modification static resource version number, without new filename is regenerated, as long as automation building work Tool starting, so that it may refresh terminal buffers automatically.Therefore, method provided in an embodiment of the present invention can automatically generate for static resource Version number, it is not necessary to which manual modification again need not also modify reference path, can also prevent from malfunctioning.
Above-mentioned specific embodiment, does not constitute a limitation on the scope of protection of the present invention.Those skilled in the art should be bright It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and substitution can occur.It is any Made modifications, equivalent substitutions and improvements etc. within the spirit and principles in the present invention, should be included in the scope of the present invention Within.

Claims (12)

1. a kind of generation method of static resource version number characterized by comprising
The acquisition request for receiving static resource intercepts and parses the acquisition request, obtains static resource and quotes path, with determination Local static resource under static resource reference path;
The nearest modification time of the local static resource is obtained, institute is replaced with the nearest modification time of the local static resource State the version number of static resource in acquisition request.
2. the method according to claim 1, wherein obtain the nearest modification time of the local static resource, The version number of static resource in the acquisition request is replaced with the nearest modification time of the local static resource, comprising:
The first time stamp of the local static resource is obtained, the first time stamp is repairing recently for the local static resource Change the time;
The second timestamp of static resource in the acquisition request is obtained, second timestamp is terminal in the acquisition request The modification time of the static resource of caching;
It determines that the first time stamp is inconsistent with the second timestamp, is replaced with first time stamp quiet in the acquisition request Second timestamp of state resource.
3. the method according to claim 1, wherein the nearest modification time of the local static resource is automatic Change the starting time of the build tool;
The acquisition request of static resource is received, before, the method also includes:
When automating the build tool starting, the starting time of described automation the build tool is obtained and stored.
4. the method according to claim 1, wherein obtain the nearest modification time of the local static resource, The version number of static resource in the acquisition request is replaced with the nearest modification time of the local static resource, it is later, described Method further include: the local static resource modified recently is returned into terminal.
5. method described in any one of -4 according to claim 1, which is characterized in that obtain the local static resource most Nearly modification time replaces the version of static resource in the acquisition request with the nearest modification time of the local static resource Number, later, the method also includes: with quiet in the nearest modification time replacement local page data of the local static resource Version number in state quoting resource path.
6. a kind of generating means of static resource version number characterized by comprising
Blocking module intercepts and parses the acquisition request for receiving the acquisition request of static resource, obtain static resource and draw With path, the local static resource under path is quoted with the determination static resource;
Replacement module, for obtaining the nearest modification time of the local static resource, with the nearest of the local static resource Modification time replaces the version number of static resource in the acquisition request.
7. device according to claim 6, which is characterized in that the replacement module is used for:
The first time stamp of the local static resource is obtained, the first time stamp is repairing recently for the local static resource Change the time;
The second timestamp of static resource in the acquisition request is obtained, second timestamp is terminal in the acquisition request The modification time of the static resource of caching;
It determines that the first time stamp is inconsistent with the second timestamp, is replaced with first time stamp quiet in the acquisition request Second timestamp of state resource.
8. device according to claim 6, which is characterized in that the nearest modification time of the local static resource is automatic Change the starting time of the build tool;
Described device further includes memory module, and before the acquisition request for receiving static resource, the memory module is used for when automatic When changing the build tool starting, the starting time of described automation the build tool is obtained and stored.
9. device according to claim 6, which is characterized in that further include return module, obtain the local static resource Nearest modification time, the version of static resource in the acquisition request is replaced with the nearest modification time of the local static resource After this number, the return module is used to the local static resource modified recently returning to terminal.
10. the device according to any one of claim 6-9, which is characterized in that obtain the local static resource Nearest modification time replaces the version of static resource in the acquisition request with the nearest modification time of the local static resource After number, the replacement module is also used in the nearest modification time replacement local page data with the local static resource Static resource quotes the version number in path.
11. a kind of electronic equipment characterized by comprising
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real Now such as method as claimed in any one of claims 1 to 5.
12. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor Such as method as claimed in any one of claims 1 to 5 is realized when row.
CN201810189831.6A 2018-03-08 2018-03-08 A kind of generation method and device of static resource version number Pending CN110244975A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810189831.6A CN110244975A (en) 2018-03-08 2018-03-08 A kind of generation method and device of static resource version number

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810189831.6A CN110244975A (en) 2018-03-08 2018-03-08 A kind of generation method and device of static resource version number

Publications (1)

Publication Number Publication Date
CN110244975A true CN110244975A (en) 2019-09-17

Family

ID=67882098

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810189831.6A Pending CN110244975A (en) 2018-03-08 2018-03-08 A kind of generation method and device of static resource version number

Country Status (1)

Country Link
CN (1) CN110244975A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112346761A (en) * 2020-10-27 2021-02-09 长沙市到家悠享网络科技有限公司 Front-end resource online method, equipment, system and storage medium
CN113703807A (en) * 2021-08-26 2021-11-26 上海德拓信息技术股份有限公司 Method and system for detecting and updating static resource version in real time

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140215019A1 (en) * 2013-01-28 2014-07-31 Spencer Ahrens Static resource caching
CN104038520A (en) * 2013-03-05 2014-09-10 北京畅游天下网络技术有限公司 Multi-version distributed resource management method and multi-version distributed resource management system
CN106293675A (en) * 2015-06-08 2017-01-04 腾讯科技(深圳)有限公司 Static system resource loading method and device
CN107465707A (en) * 2016-06-03 2017-12-12 阿里巴巴集团控股有限公司 A kind of content refresh method and device of content distributing network
CN107748689A (en) * 2017-10-19 2018-03-02 阿里巴巴集团控股有限公司 A kind of web page display method and apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140215019A1 (en) * 2013-01-28 2014-07-31 Spencer Ahrens Static resource caching
CN104038520A (en) * 2013-03-05 2014-09-10 北京畅游天下网络技术有限公司 Multi-version distributed resource management method and multi-version distributed resource management system
CN106293675A (en) * 2015-06-08 2017-01-04 腾讯科技(深圳)有限公司 Static system resource loading method and device
CN107465707A (en) * 2016-06-03 2017-12-12 阿里巴巴集团控股有限公司 A kind of content refresh method and device of content distributing network
CN107748689A (en) * 2017-10-19 2018-03-02 阿里巴巴集团控股有限公司 A kind of web page display method and apparatus

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112346761A (en) * 2020-10-27 2021-02-09 长沙市到家悠享网络科技有限公司 Front-end resource online method, equipment, system and storage medium
CN112346761B (en) * 2020-10-27 2024-05-17 长沙市到家悠享网络科技有限公司 Front-end resource online method, device, system and storage medium
CN113703807A (en) * 2021-08-26 2021-11-26 上海德拓信息技术股份有限公司 Method and system for detecting and updating static resource version in real time
CN113703807B (en) * 2021-08-26 2023-12-15 上海德拓信息技术股份有限公司 Method and system for real-time detection and update of static resource version

Similar Documents

Publication Publication Date Title
US10108595B2 (en) Method and system for automated analysis and transformation of web pages
RU2673403C2 (en) Website access method, device and website system
CN110019211A (en) The methods, devices and systems of association index
CN110019350A (en) Data query method and apparatus based on configuration information
CN109683998A (en) Internationalize implementation method, device and system
CN108228282A (en) For the method and device of Website page loading
CN108989362A (en) A kind for the treatment of method and apparatus of static resource
CN108984170A (en) The multilingual rendering method of the H5 page and device
CN109413127A (en) A kind of method of data synchronization and device
US20150188999A1 (en) System and method to extend the capabilities of a web browser to improve the web application performance
CN110209662A (en) A kind of method and apparatus of automation load data
CN110020304A (en) A kind of method and apparatus of loading page
CN110019539A (en) A kind of method and apparatus that the data of data warehouse are synchronous
CN109241033A (en) The method and apparatus for creating real-time data warehouse
CN110134427A (en) A kind of method and apparatus generating code file
CN104219295A (en) Server-side configuration based information display method and system for mobile equipment
CN113760722A (en) Test system and test method
CN109936605A (en) A kind of method and apparatus of loading interface data
CN110244975A (en) A kind of generation method and device of static resource version number
CN109144843A (en) The method and apparatus for testing environment deployment
CN114003659A (en) Data synchronization method, data synchronization device, electronic equipment, storage medium and program product
CN110109912A (en) A kind of identifier generation method and device
CN111767495A (en) Method and system for synthesizing webpage
CN112181408A (en) Method and device for displaying view list on front page of application program
CN111753226A (en) Page loading method and device

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