Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a resource invoking method according to an embodiment of the present invention, where the embodiment is applicable to a situation where a dependent resource package is invoked during a project development process, and the method may be executed by a resource invoking device, and the device may be implemented in a form of software and/or hardware.
Before explaining the technical solution of the embodiment of the present invention, an application scenario of the embodiment of the present invention is first exemplarily explained: the embodiment of the invention refers to the method for calling the dependent resources in the process of project development or packaging, and particularly, the effect of reducing the occupation amount of the local memory is achieved by calling the dependent resources from the dependent resource temporary storage server.
As shown in fig. 1, the resource scheduling method according to the embodiment of the present invention specifically includes the following steps:
s110, when a dependent resource calling request is received, determining a target dependent resource identifier corresponding to the dependent resource calling request.
The dependent resource calling request refers to a request for calling one or more dependent resources. Dependent resources are resources that are used by the current project development and/or packaging. For example, Errors in the project (error handling library) may be handled and annotated. It should be noted that the dependent resource in the embodiment of the present invention may be understood as a dependent package. The target dependent resource refers to a dependent resource that needs to be called. The target dependent resource identification is an identification that distinguishes the target dependent resource from other dependent resources. The representation form of the target dependent resource identifier may be an icon, a character, and the like.
Specifically, when a dependent resource calling request sent by a client is received, a target dependent resource identifier corresponding to the dependent resource calling request is determined to distinguish a target dependent resource from other dependent resources, and preparation is made for subsequent acquisition of the target dependent resource.
S120, if the target cache does not include the target dependent resource corresponding to the target dependent resource identifier, determining a target dependent resource temporary storage server corresponding to the target dependent resource identifier, and sending the dependent resource calling request to the target dependent resource temporary storage server.
The cache refers to a memory for temporary storage, and the target cache refers to a storage space for temporarily storing the target dependent resource. The target dependent resource temporary storage server refers to a server to which the target dependent resource belongs, for example, the target dependent resource temporary storage server is a GitHub server.
Specifically, after the target dependent resource identifier is determined, whether the target dependent resource corresponding to the target dependent identifier is stored in the target cache is determined based on the target dependent resource identifier. And if the target dependent resource is not stored in the target cache, sending the dependent resource calling request to the target dependent resource server, so that the target dependent resource server determines the target dependent resource according to the received dependent resource calling request.
Optionally, the target dependent resource identifier includes a target dependent resource locator; the determining the target dependent resource temporary storage server corresponding to the target dependent resource identifier includes: and determining a target dependent resource temporary storage server corresponding to the target dependent resource locator.
The target dependent resource locator corresponds to the target dependent resource one to one, the target dependent resource can be called based on the target dependent resource locator, for example, the target dependent resource locator is a URL address, and the target dependent resource can be called from a target dependent resource temporary storage server corresponding to the target dependent resource through the URL address.
Specifically, the target dependent resource temporary storage server corresponding to the target dependent resource is determined through the target dependent resource locator, and accuracy of determining the target dependent resource temporary storage server is improved.
S130, receiving the target dependent resources corresponding to the dependent resource calling request fed back by the target dependent resource temporary storage server.
Specifically, the dependent resource calling request is sent to the target dependent resource temporary storage server, so that the target dependent resource temporary storage server determines the target dependent resource based on the target dependent resource identifier in the dependent resource calling request and feeds back the target dependent resource. By receiving the target dependent resources from the temporary storage server of the target dependent resources, the target dependent resources do not need to be downloaded, stored and maintained in advance, the working efficiency of the server is improved, and the memory occupation amount is reduced.
According to the technical scheme of the embodiment of the invention, when the dependent resource calling request is received, the target dependent resource identifier corresponding to the dependent resource calling request is determined, whether the target dependent resource corresponding to the target dependent resource identifier is stored in the target cache is judged, if not, the target dependent resource temporary storage server corresponding to the target dependent resource identifier is determined, and the dependent resource calling request is sent to the target dependent resource temporary storage server. And receiving the target dependent resources fed back by the target dependent resource temporary storage server. According to the technical scheme of the embodiment of the invention, the corresponding dependent resources are pertinently called from the resource temporary storage server corresponding to the dependent resources in the project development process, and the problems that all the dependent resources are required to be downloaded, stored and maintained in advance before the project development and the local memory load is increased are solved.
On the basis of the foregoing technical solution, optionally, after receiving the target dependent resource corresponding to the dependent resource invoking request and fed back by the target dependent resource temporary storage server, the method includes: and carrying out project packaging based on the target dependent resources and the project file to obtain a target project package.
Wherein, the project file is a file in the process of project development. Such as program code files and document files. The item package refers to a package generated after the whole item is packaged, and one or more dependent resources can be included in the item package. The target project package is obtained by packaging based on the target dependent resources and the project file.
Specifically, after the target dependent resource is determined, the target dependent resource and the project file are packaged to obtain a project package, and the project development process is completed.
Example two
Fig. 2 is a flowchart of a resource retrieving method according to an embodiment of the present invention, which is an extension of the alternative of the foregoing embodiment, and after a target dependent resource is retrieved, the target dependent resource is stored in a target cache, so that when the target dependent resource is retrieved again, the target dependent resource can be retrieved from the target cache. Specific extensions are set forth in detail in the embodiments of the present invention. Technical terms identical or similar to those of the above embodiments will not be described again.
As shown in fig. 2, the resource scheduling method according to the embodiment of the present invention includes the following steps:
s210, when a dependent resource calling request is received, determining a target dependent resource identifier corresponding to the dependent resource calling request.
S220, if the target cache does not include the target dependent resource corresponding to the target dependent resource identifier, determining a target dependent resource temporary storage server corresponding to the target dependent resource identifier, and sending the dependent resource calling request to the target dependent resource temporary storage server.
And S230, receiving the target dependent resources corresponding to the dependent resource calling request fed back by the target dependent resource temporary storage server.
S240, storing the target dependent resource into a target cache, so as to determine a target dependent resource identifier corresponding to the dependent resource calling request when receiving the dependent resource calling request, and calling the target dependent resource corresponding to the target dependent resource identifier from the target cache.
Specifically, after the target dependent resource is obtained, the target dependent resource is stored in the target cache. Optionally, a corresponding relationship is set between the target dependent resource identifier and the location information stored in the target cache, so as to determine whether the target dependent resource is stored in the target cache based on the target dependent resource identifier and the corresponding relationship, and if yes, the location information of the target dependent resource in the target cache may also be determined. And calling the target dependent resource based on the position information.
In this embodiment of the present invention, setting a correspondence between a target dependent resource identifier and location information stored in a target cache may be that, the invoking a target dependent resource corresponding to the target dependent resource identifier from the target cache includes: determining a target dependent resource path corresponding to the target dependent identifier; and calling the target dependent resource corresponding to the target dependent resource path from the target cache.
The target dependent resource path refers to path information of the target dependent resource in the target cache.
Specifically, a corresponding target dependent resource path is determined according to the target dependent identifier, so that the corresponding target dependent resource is called from the target cache according to the target dependent path. And the target dependent resource is called in a target dependent resource path mode, so that the accuracy of calling the target dependent resource is improved.
In the embodiment of the present invention, the target dependent resource stored in the target cache may have an updated condition, and at this time, the target dependent resource in the target cache may be updated according to the updated version or update information may be sent to the target terminal, so as to remind a target user corresponding to the target terminal, and the like. Optionally, after storing the target dependent resource in the target cache, the method further includes: monitoring whether each dependent resource in the target cache has an updated version; if yes, sending prompt information corresponding to the updated dependent resources to the target terminal; the prompt message comprises an updated version number of the updated dependent resource and a server identifier of the target dependent resource temporary storage server.
The prompt information is used for prompting a target user corresponding to the target terminal. The prompt message can be sent to the target terminal through a short message, a push message and telephone voice. The presentation mode of the prompt message can be voice, text, diagram and the like. The server identification of the target dependent resource staging server may be the name of the target dependent resource staging server.
Specifically, when it is monitored that one or more dependent resources in the target cache have an updated version, the prompt information may be sent to the target terminal based on the dependent resources, so that the target user corresponding to the target terminal is prompted, and the target user updates or performs other operations on the dependent resources based on the prompt information, thereby preventing problems such as failure of a project caused by using an old version of a dependent resource package in the project due to version update of the dependent resources. Optionally, when the plurality of dependent resources in the target cache have updated versions, the prompt information may be sent to the target terminal based on each dependent resource, or the prompt information of the plurality of dependent resources may be integrated to generate a piece of prompt information, and the piece of prompt information is sent to the target terminal. The prompt information comprises the updated version number of the dependent resource and the server identifier of the target dependent resource temporary storage server to which the dependent resource belongs, so that a target user corresponding to the target terminal can know the updated version condition of the dependent resource in time conveniently.
On the basis of the above technical solution, after the storing the target dependent resource in the target cache, the method further includes: when detecting that the dependent resource in the target cache has an updated version, updating the dependent resource in the target cache based on the updated version in the dependent resource temporary storage server to which the dependent resource belongs, and sending update information to a target terminal; the update information includes an original version number of the dependent resource, an update version number of the dependent resource, version update time, and a dependent resource temporary storage server to which the dependent resource belongs.
Specifically, when it is detected that the dependent resource in the target cache has an updated version, the dependent resource of the new version is downloaded in the dependent resource temporary storage server corresponding to the dependent resource, and the corresponding dependent resource in the target cache is covered. And sending the update information to the target terminal so that the target user corresponding to the target terminal knows the updated dependent resources based on the update information. Optionally, the downloaded dependent resource of the new version and the corresponding dependent resource in the target cache are stored in an associated manner, and the update information is sent to the target terminal, so that the target user knows that the updated version of the dependent resource is stored in the target cache, and the target user determines whether to delete the original stored dependent resource in the target cache according to the project requirement, thereby improving the experience of the user.
According to the technical scheme of the embodiment of the invention, when the dependent resource calling request is received, the target dependent resource identifier corresponding to the dependent resource calling request is determined, whether the target dependent resource corresponding to the target dependent resource identifier is stored in the target cache is judged, if not, the target dependent resource temporary storage server corresponding to the target dependent resource identifier is determined, and the dependent resource calling request is sent to the target dependent resource temporary storage server. And receiving the target dependent resources fed back by the target dependent resource temporary storage server, and storing the target dependent resources in a target cache. By the technical scheme of the embodiment of the invention, the target dependent resource is called and stored, when the target dependent resource is called again, the target dependent resource can be called from the target cache, the downloading time from the target dependent resource temporary storage server is shortened, and the bandwidth is reduced.
EXAMPLE III
Fig. 3 is a flowchart illustrating a resource invoking method according to an embodiment of the present invention. The embodiment of the invention is an alternative on the basis of the above-described embodiment.
Before explaining the technical solution of the embodiment of the present invention, an exemplary description is first made of the technical background of the embodiment of the present invention:
currently, web packs are generally used as static module packaging tools for developing web applications, and various dependent packages need to be loaded, such as real, Vue, Axios and other technical frameworks. Json is used to maintain various dependency packages and versions thereof during project development. When the project is operated and packaged, the dependent package required to be used is extracted through the Webpack analysis code, the corresponding file is obtained in the Node _ modules (Node modules) according to the names of the dependent package for packaging, if the dependent package cannot be found in the Node _ modules (Node modules), an error is prompted, and the project packaging cannot be successful. Therefore, before a project is run, Npm install is needed to install the dependency package listed in package json, Npm downloads and installs the needed dependency package into the local Node _ modules, and therefore, the burden of the local memory is too heavy.
In the project development process, the target dependency package is firstly analyzed, whether the address of the target dependency package is the URL address or not is judged, if not, the target dependency package is downloaded and stored in the local memory in advance, and the target dependency package can be obtained from the local memory. If so, acquiring the URL address of the target dependency package, and calling the target dependency package through the URL address of the target dependency package. Specifically, whether a target dependency package corresponding to the URL address is stored in the target cache is judged through the URL address of the target dependency package, and if yes, the target dependency package is acquired from the target cache. If not, determining a target server corresponding to the target dependency package through the URL address, acquiring the target dependency package from the target server, and packaging the project based on the target dependency package and the project file. And the downloaded target dependency package is stored in the target cache, so that the target dependency package can be called from the target cache when called again, and the time length for downloading the target dependency package and the occupied bandwidth are reduced. Optionally, when the target dependency package is stored in the target cache, an association relationship is set between the URL address of the target dependency package and a storage location in the target cache, so that the target dependency package is called from the target cache based on the URL address of the target dependency package and the association relationship.
For example, when the technical framework is Vue (of course, other technical frameworks are also possible, and are not limited herein), the invocation of the target dependent packet may be introduced by means of a URL address, for example, import Vue from 'https:// unpkg.com/Vue', where 'https:// unpkg.com/Vue' is a URL address. And then, judging whether the dependency package which can be corresponding to the URL address is stored in the target cache or not according to the URL address. And if the dependency package is not used, the dependency file is called from the corresponding target server according to the URL address, the called dependency file is stored in the target cache for reuse, and finally, all the obtained dependency packages are subjected to code packaging.
According to the technical scheme of the embodiment of the invention, the URL address of the target dependent resource is determined, whether the target dependent resource corresponding to the URL address is stored in the target cache is judged based on the URL address, and if yes, the target dependent resource is called from the target cache. If not, the target server is determined based on the URL address, and the target dependent resource is called from the target server, so that the dependent packet can be directly called from the target cache when being used again, and time and bandwidth are saved.
Example four
Fig. 4 is a schematic structural diagram of a resource retrieving device according to an embodiment of the present invention, where the resource retrieving device according to the embodiment of the present invention can execute a resource retrieving method according to any embodiment of the present invention, and has corresponding functional modules and beneficial effects of the execution method. The device includes: a target dependent resource identifier invoking module 410, a server determining module 420, and a first target dependent resource invoking module 430; wherein:
a target dependent resource identifier invoking module 410, configured to, when a dependent resource invoking request is received, determine a target dependent resource identifier corresponding to the dependent resource invoking request; a server determining module 420, configured to determine a target dependent resource temporary storage server corresponding to the target dependent resource identifier if the target cache does not include the target dependent resource corresponding to the target dependent resource identifier, and send the dependent resource invoking request to the target dependent resource temporary storage server; a first target dependent resource invoking module 430, configured to receive a target dependent resource corresponding to the dependent resource invoking request and fed back by the target dependent resource temporary storage server; wherein the dependent resources are resources used by the current project development and/or packaging.
Further, the target dependent resource identifier comprises a target dependent resource locator; the server determination module 420 includes:
and the temporary storage server determining module is used for determining the target dependent resource temporary storage server corresponding to the target dependent resource locator.
Further, the apparatus further comprises:
and the second target dependent resource calling module is used for storing the target dependent resource into a target cache, so that when a dependent resource calling request is received, a target dependent resource identifier corresponding to the dependent resource calling request is determined, and the target dependent resource corresponding to the target dependent resource identifier is called from the target cache.
Further, the second target dependent resource invoking module includes:
the path determining submodule is used for determining a target dependent resource path corresponding to the target dependent identifier; and the target dependent resource calling submodule is used for calling the target dependent resource corresponding to the target dependent resource path from the target cache.
Further, the apparatus further comprises:
the target project package acquisition module is used for carrying out project packaging based on the target dependent resources and the project files so as to acquire a target project package; wherein, the project file is a file in the process of project development.
Further, the apparatus further comprises:
the update version determining module is used for monitoring whether each dependent resource in the target cache has an update version; the prompt information sending module is used for sending prompt information corresponding to the updated dependent resource to the target terminal if the updated dependent resource exists; the prompt message comprises an updated version number of the updated dependent resource and a server identifier of the target dependent resource temporary storage server.
Further, the apparatus further comprises:
the dependent resource updating module is used for updating the dependent resources in the target cache based on the updated version in the dependent resource temporary storage server to which the dependent resources belong and sending updating information to the target terminal when the fact that the dependent resources in the target cache have the updated version is detected; the update information includes an original version number of the dependent resource, an update version number of the dependent resource, version update time, and a dependent resource temporary storage server to which the dependent resource belongs.
According to the technical scheme of the embodiment of the invention, when the dependent resource calling request is received, the target dependent resource identifier corresponding to the dependent resource calling request is determined, whether the target dependent resource corresponding to the target dependent resource identifier is stored in the target cache is judged, if not, the target dependent resource temporary storage server corresponding to the target dependent resource identifier is determined, and the dependent resource calling request is sent to the target dependent resource temporary storage server. And receiving the target dependent resources fed back by the target dependent resource temporary storage server. According to the technical scheme of the embodiment of the invention, the corresponding dependent resources are pertinently called from the resource temporary storage server corresponding to the dependent resources in the project development process, and the problems that all the dependent resources are required to be downloaded, stored and maintained in advance before the project development and the local memory load is increased are solved.
It should be noted that, the units and modules included in the apparatus are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the embodiment of the invention.
EXAMPLE five
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. FIG. 5 illustrates a block diagram of an exemplary device 50 suitable for use in implementing embodiments of the present invention. The device 50 shown in fig. 5 is only an example and should not bring any limitation to the function and scope of use of the embodiments of the present invention.
As shown in FIG. 5, device 50 is embodied in a general purpose computing device. The components of the device 50 may include, but are not limited to: one or more processors or processing units 501, a system memory 502, and a bus 503 that couples the various system components (including the system memory 502 and the processing unit 501).
Bus 503 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Device 50 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by device 50 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 502 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)504 and/or cache memory 505. The device 50 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 506 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, commonly referred to as a "hard drive"). Although not shown in FIG. 5, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 503 by one or more data media interfaces. Memory 502 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 508 having a set (at least one) of program modules 507 may be stored, for instance, in memory 502, such program modules 507 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 507 generally perform the functions and/or methodologies of embodiments of the invention as described herein.
Device 50 may also communicate with one or more external devices 509 (e.g., keyboard, pointing device, display 510, etc.), with one or more devices that enable a user to interact with device 50, and/or with any devices (e.g., network card, modem, etc.) that enable device 50 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 511. Also, device 50 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via network adapter 512. As shown, the network adapter 512 communicates with the other modules of the device 50 over a bus 503. It should be appreciated that although not shown in FIG. 5, other hardware and/or software modules may be used in conjunction with device 50, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 501 executes various functional applications and data processing, for example, implementing a resource calling method provided by an embodiment of the present invention, by executing a program stored in the system memory 502.
EXAMPLE six
Embodiments of the present invention also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a method for resource invocation, the method comprising:
when a dependent resource calling request is received, determining a target dependent resource identifier corresponding to the dependent resource calling request; if the target cache does not comprise the target dependent resource corresponding to the target dependent resource identifier, determining a target dependent resource temporary storage server corresponding to the target dependent resource identifier, and sending the dependent resource calling request to the target dependent resource temporary storage server; receiving the target dependent resources corresponding to the dependent resource calling request fed back by the target dependent resource temporary storage server; wherein the dependent resources are resources used by the current project development and/or packaging.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for embodiments of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.