Cache clearing method, device and system

A caching and cache clearing technology, applied in the Internet field, can solve problems such as economic losses, data errors, and website inability to realize functions, and achieve the effect of small system resources and high processing efficiency

Pending Publication Date: 2020-09-01
上海乾臻信息科技有限公司
0 Cites 0 Cited by

AI-Extracted Technical Summary

Problems solved by technology

[0004] In addition, data errors caused by browser cache problems require a lot of time to locate and repair, resulting in the inability of the website to realize its functions, which will have an impact on b...
View more

Method used

Thus, in the cache clearing method applied to the client, the update resource and the version number of the update resource are sent to the client together by the server, so that the client can also cache the version number of the resource each time the resource is cached , thus, when the client receives the updated resource and the version number of the updated resource, it can compare the received version number with the cached version number. When the version numbers are different, it means that the resource received by the client is different from the cached resource. It is necessary to clear the cached resources and cache the received resources to update the resources. Therefore, on the one hand, when the client and the server implement the above method, they only need to add the version number to the transmitted resources, the required transmission bandwidth and the occupied cache are relatively small, and have almost no impact on system performance; On the other hand, the clearing and updating of cached resources are triggered by version number comparison. Compared with the solution of updating resources every time they are received, the required system resources are smaller and the overall processing efficiency of the system is higher.
Thus, in the cache clearing method applied to the server, when responding to the request information of the client, the server will integrate the template to generate and cache it as a temporary file, and if the temporary file is in an available state, there is no need for the client to When the temporary file is not available, clear the cached temporary file, and integrate the template to generate and cache an updated temporary file, so as to respond to the request of the client according to the temporary file. Therefore, on the one hand, when the request information from the client triggers the judgment of the availability status...
View more

Abstract

The invention discloses a cache clearing method, device and system. The cache clearing method applied to a client comprises the steps of transmitting request information to a server, and enabling theserver to carry out the cache clearing of the request information; receiving the updating resource and the version number of the updating resource sent by the server side; judging whether the versionnumber of the received updating resource is consistent with the version number of the cached resource or not; and if not, clearing the cached resources, and caching the received update resources and the version numbers of the update resources. According to the method and the device provided by the invention, the cache clearing of the resources and the template cache clearing of the server are respectively realized at the client, so that the problems of resource updating errors, data errors, function failures and the like caused by the cache can be alleviated.

Application Domain

Software reuseSpecial data processing applications +1

Technology Topic

Data errorEngineering +3

Image

  • Cache clearing method, device and system
  • Cache clearing method, device and system
  • Cache clearing method, device and system

Examples

  • Experimental program(1)

Example Embodiment

[0088] In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are proposed for a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from obstructing the description of the present invention.
[0089] In order to illustrate the technical solution of the present invention, specific embodiments are used for description below. In the following embodiments of the present invention, the step numbers in the flowcharts are not configured to limit the execution order of the steps.
[0090] The cache clearing method, device, system, electronic equipment, and computer-readable storage medium provided by the present invention can be applied to various system application scenarios with a client and a server. The client can be provided in the form of a webpage in a browser, or can be provided in the form of computer software or mobile terminal APP, and the present invention is not limited thereto. The application fields of the present invention include but are not limited to e-commerce platforms, social network platforms, various other business platforms, etc.
[0091] First, see figure 1 The first embodiment provides a cache clearing method applied to the client. figure 1 The following steps are shown:
[0092] Step S100: Send request information to the server side, where the request information is used by the server side to clear the cache.
[0093] The request information includes, but is not limited to, request information such as requesting a web page from the server, requesting data, and user operations. The request information can be triggered by the user operating the client. Preferably, the request information is used to request static resources.
[0094] Step S110: Receive the update resource and the version number of the update resource sent by the server.
[0095] Specifically, the version numbers can be numbered sequentially, so that the server and the client can understand the difference in update time between resource versions. The version number can be numbered randomly and is only used to distinguish resources of different versions. The present invention can realize the numbering mode of more version numbers, which will not be repeated here.
[0096] Step S120: Determine whether the version number of the received update resource is consistent with the version number of the cached resource.
[0097] If step S120 is determined to be no, then step S130 is executed: clearing the cached resources, and caching the received update resources and the version numbers of the update resources.
[0098] Further, in the embodiment of sequential numbering of version numbers, after step S120 above, it can be further determined whether the version number of the received update resource is later than the version number of the cached resource, if the version number of the received update resource is later than For the version number of the cached resource, step S130 is executed. In this way, it is possible to prevent the resource before the version of the current resource from being updated to the client, thereby causing problems such as data error and function failure.
[0099] Therefore, in the cache clearing method applied to the client, the update resource and the version number of the update resource are sent to the client together through the server, so that the client can also cache the version number of the resource every time the resource is cached. , When the client receives the update resource and the version number of the update resource, it can compare the received version number with the cached version number. When the version number is different, it means that the resource received by the client is different from the cached resource and needs to be cached The resources are cleared and the received resources are cached to implement resource updates. Therefore, on the one hand, when the client and server implement the above method, they only need to increase the version number in the transmission resources, and the required transmission bandwidth and the cache occupied are small, which has little impact on system performance; On the other hand, the version number comparison triggers the clearing and updating of cached resources. Compared with the solution that updates the resources each time it is received, the system resources required are smaller and the overall processing efficiency of the system is higher.
[0100] figure 2 It is a schematic flow diagram of the cache clearing method applied to the client in the second embodiment. figure 2 The following steps are shown:
[0101] Step S100: Send request information to the server.
[0102] Step S110: Receive the update resource and the version number of the update resource sent by the server.
[0103] Step S120: Determine whether the version number of the received update resource is consistent with the version number of the cached resource.
[0104] If the judgment in step S120 is no, then step S130 is executed: clearing the cached resource, and buffering the received update resource and the version number of the update resource.
[0105] If step S120 is determined to be YES, then step S140 is executed: the cached resource is not cleared, and the received update resource and the version number of the update resource are not cached.
[0106] The client sends request information to the server, which triggers the server to send the update resource and the version number of the update resource to the client, thereby avoiding update delays caused by periodic updates or updates at a preset time, which may cause the client to have functions Missing and data errors and other issues. Further, when the client uses the cached resource, it can be guaranteed that the cached resource is the latest version of the resource.
[0107] In the first and second embodiments of the present invention, the client can be provided in a browser.
[0108] By implementing the client in the browser, it is convenient for users to log in to the system in different hardware devices and interact with the server. Furthermore, due to the cache mechanism in the browser, the cache clearing method provided by the present invention is particularly suitable for the browser In the scenario where the client is provided. The present invention is not limited to this, and the client can also be provided in other forms.
[0109] In the first embodiment and the second embodiment of the present invention, the update resource is a static resource. The present invention is not limited to this. Since static resources are generally updated with system updates, the cache clearing method provided by the present invention is more suitable for static resources.
[0110] See below image 3 , image 3 It is a schematic diagram of the cache clearing system provided by the third embodiment. The cache clearing system includes a client 10 and a server 20. in image 3 In the illustrated embodiment, the client 10 and the server 20 are the client 10 and the server 20 of the system 30.
[0111] In this embodiment, the client 10 is configured to execute figure 1 The steps shown: receive the update resource and the version number of the update resource sent by the server side 20; determine whether the version number of the received update resource is consistent with the version number of the cached resource; if not, clear the cached resource and cache The received update resource and the version number of the update resource. The server end 20 is configured to send the update resource and the version number of the update resource to the client 10.
[0112] Furthermore, this solution is particularly suitable for the system 30 to update the version number of the related static resource to the server 20 when the system 30 is upgraded. When the client 10 initiates a request (for example, the user operates a browser), it sends the request information of the client 10 requesting static resources to the server 20. After the server 20 receives the request from the client 10, the server 20 responds to the client The client 10 sends the static resource to the client 10. When the client 10 receives the static resource sent by the server 20, the client 10 will detect the version number of the static resource sent by the server 20 and the cached version number Whether the static resources are consistent, if they are consistent, the browser that provides the client 10 uses the cached static resources; when they are inconsistent, the browser that provides the client 10 will automatically cache the upgraded static resources, thereby achieving the purpose of clearing the browser cache. As a result, the client 10 can automatically load and update static resources, and the client 10 cache can be cleared in time.
[0113] The foregoing is only a schematic description, and the specific implementation manner of this embodiment is not limited thereto.
[0114] See below Figure 4 , Figure 4 It is a schematic flowchart of the cache clearing method applied to the server side provided by the fourth embodiment. Figure 4 Show the following steps:
[0115] Step S210: Receive request information sent by the client.
[0116] The request information includes, but is not limited to, request information such as requesting a web page from the server, requesting data, and user operations. The request information can be triggered by the user operating the client. Preferably, the request information is used to request static resources.
[0117] In a specific embodiment of the present invention, figure 2 Step S100 shown and Figure 4 The request information of step S210 shown is the same request information.
[0118] Step S220: Determine whether the cached temporary file is in an available state.
[0119] Specifically, in order to increase the reusability and conciseness of the code, public functions (js, html), etc. can be encapsulated as separate templates. If these functions are used in other functions, only the encapsulated template is needed. Yes; when the client initiates a request, the server can load and integrate these imported templates and cache them as a temporary file. Further, the judgment of whether the temporary file is in the available state can be found in Figure 5.
[0120] If not, perform step S230: clear the cached temporary files, and integrate templates to generate and cache an updated temporary file.
[0121] Step S240: Respond to the request of the client according to the temporary file to send the resource and the version number of the resource to the client for the client to clear the cache.
[0122] Specifically, step S230 and step S240 can respond to the client's request by integrating static resources and updated temporary files into a web page.
[0123] In a specific embodiment, when the server integrates the static resources and updated temporary files into a web page and provides it to the client, it also provides the client with the version number of the static resource, so that the client can implement figure 1 The steps shown.
[0124] Therefore, in the cache clearing method applied to the server, when responding to the client's request information, the server will integrate the template to generate and cache it as a temporary file, and if the temporary file is available, there is no need for every client request. Perform integration; when the temporary file is in an unavailable state, clear the cached temporary file, and integrate the template to generate and cache an updated temporary file to respond to the client's request according to the temporary file. Therefore, on the one hand, when the client's request information triggers the judgment of the available status of the temporary file, so as to avoid the update delay caused by periodic update or update at a preset time, resulting in possible lack of functions and data errors on the server side. The problem; on the other hand, by judging the status of the temporary file to trigger the cache clearing and cache update of the temporary file, there is no need to integrate each client request, the required system resources are smaller, and the overall system processing efficiency is higher.
[0125] See below Figure 5 , Figure 5 It is a schematic flow chart of determining the available status of temporary files in the cache clearing method applied to the server in the fifth embodiment. Figure 4 Step S220 in step S220 of determining whether the cached temporary file is in an available state may also include the following steps:
[0126] Step S221: Determine whether the template associated with the temporary file has expired;
[0127] If yes, perform step S222: the temporary file is in an unavailable state;
[0128] If not, perform step S223: determine whether the template associated with the temporary file is updated;
[0129] If yes, perform step S224: the temporary file is in an unavailable state;
[0130] If not, perform step S225: the temporary file is in an available state.
[0131] Through the above judgment steps, the available state and unavailable state of the temporary file are defined, and the judgment method is simple to implement. in Figure 5 In the illustrated embodiment, it is determined that step S221 and step S223 are executed sequentially, but the present invention is not limited thereto. When step S221 and step S223 are both judged as negative, step S220 judges that the temporary file is in an available state. The determination of step S221 and step S223 may be performed synchronously, asynchronously, or in the reverse order.
[0132] See below Image 6 , Image 6 It is a schematic flow diagram of the integration step in the cache clearing method applied to the server in the fifth embodiment. Figure 4 Step S230 in clearing the cached temporary files and integrating the template to generate and cache an updated temporary file may include the following steps:
[0133] Step S231: Determine whether the cached template is a new template;
[0134] If yes, perform step S232: integrate the new template to generate and cache an updated temporary file;
[0135] If not, step S233 to step S235 are executed in sequence. Step S233: Clear the cached template:. Step S234: Load a new template for caching. Step S235: Integrate the new template to generate and cache an updated temporary file.
[0136] By judging the status of temporary files, the template’s cache clearing and cache update are triggered to avoid update delays caused by periodic updates or updates at a preset time, which may cause problems such as missing functions and data errors on the server side. The system resources are smaller and the overall system processing efficiency is higher.
[0137] in spite of Figure 5 with Image 6 Shown as the fifth embodiment, but Figure 5 with Image 6 The steps can be implemented separately in different embodiments.
[0138] See below Figure 7 , Figure 7 It is a schematic diagram of the cache clearing system provided by the sixth embodiment. The cache clearing system includes a client 10 and a server 20. in Figure 7 In the illustrated embodiment, the client 10 and the server 20 are the client 10 and the server 20 of the system 30.
[0139] The client 10 is configured to send request information to the server and receive a response from the server. The server side is configured to execute as Figure 4 The steps shown are: receiving the request information sent by the receiving client; judging whether the cached temporary file is in an available state; if not, clearing the cached temporary file, and integrating the template to generate and cache an updated temporary file; The temporary file responds to the client's request.
[0140] Specifically, in this embodiment, when the client 10 initiates a request (for example, the user operates a browser), the request information of the client 10 for requesting static resources can be sent to the server 20, and the server 20 receives the client 10. After the request, determine whether the template cache in the temporary file has expired, or whether the template file in the temporary file is updated. When the template cache in the temporary file expires or the template file is updated, the server side 20 will automatically integrate the new template in the static page into a temporary file, load and integrate the new temporary file and static resources, and generate A temporary new page to achieve the purpose of clearing the server cache. In a specific implementation of this embodiment, in order to avoid the untimely update of the template cache when the system 30 goes online, a method of manually deleting the template cache may also be adopted to achieve the purpose of cache update.
[0141] Combine image 3 with Figure 7 In the request response interaction between the client 10 and the server 20, both the server and the client perform cache clearing, which improves the cache clearing efficiency of the entire system.
[0142] See below Picture 8 , Picture 8 It is a schematic structural diagram of a cache clearing device applied to a client provided in the seventh embodiment. The cache clearing device 1 applied to the client includes a first sending module 104, a first receiving module 101, a first determining module 102, and a first caching module 103. The first sending module 104, the first receiving module 101, the first determining module 102, and the first buffering module 103 can all perform data exchange.
[0143] The first receiving module 101 is configured to receive the update resource and the version number of the update resource sent by the server. The first determination module 102 is configured to determine whether the version number of the received update resource is consistent with the version number of the cached resource. The first cache module 103 is configured to, when the first determination module 102 determines that it is inconsistent, clear the cached resources, and cache the received update resources and the version numbers of the update resources. The first sending module 104 is configured to send request information to the server before the first receiving module 101 receives the update resource and the version number of the update resource sent by the server.
[0144] Picture 8 It only schematically shows the cache clearing device 1 applied to the client provided by the present invention. Without violating the concept of the present invention, the splitting, merging, and adding of modules are all within the protection scope of the present invention. The cache clearing device 1 applied to the client provided by the present invention can be implemented by software, hardware, firmware, plug-ins and any combination between them.
[0145] See below Picture 9 , Picture 9 It is a schematic structural diagram of the cache clearing device 2 applied to the server side provided by the eighth embodiment. The cache clearing device 2 includes a second receiving module 201, a second judgment module 202, an integration module 203, and a response module 204. Data can be exchanged between each module.
[0146] The second receiving module 201 is configured to receive request information sent by the client. The second judgment module 202 is configured to judge whether the cached temporary file is in an available state. The integration module 203 is configured to, when the second judgment template 202 judges to be no, clear the cached temporary files, and integrate the templates to generate and cache an updated temporary file. The response module 204 is configured to respond to the request of the client according to the temporary file to send the resource and the version number of the resource to the client for the client to clear the cache.
[0147] In this embodiment, the second judgment module 202 may further include a first sub-judgment module 2021 and a second sub-judgment module 2022. The first sub-judging module 2021 is configured to judge whether the template associated with the temporary file has expired. The second sub-judging module 2022 is configured to judge whether the template associated with the temporary file is updated. Specifically, when the first sub-judging module 2021 and the second sub-judging module 2022 both judge to be no, the second judgment module 202 judges that the temporary file is in an available state. The judgments of the first sub-judging module 2021 and the second sub-judging module 2022 can be executed synchronously or asynchronously, and the present invention does not limit the execution sequence of the first sub-judging module 2021 and the second sub-judging module 2022.
[0148] In this embodiment, the integration module 203 may further include a third judgment module 2031, a first sub-integration module 2032, a removal module 2033, a loading module 2034, and a second sub-integration module 2035.
[0149] The third determining module 2031 is configured to determine whether the cached template is a new template. The first sub-integration module 2032 is configured to integrate the new template to generate and cache an updated temporary file when the third determination module 2031 determines yes. The clearing module 2033 is configured to clear the cached template when the third determining module 2031 determines that it is no. The loading module 2034 is configured to load a new template for caching. The second sub-integration module 2035 is configured to integrate the new template to generate and cache an updated temporary file after the loading module loads the new template for caching.
[0150] The foregoing is only a schematic description of the implementation manners provided by the present invention, and the present invention is not meant to be limiting, and each module can be implemented individually or in combination.
[0151] Picture 9 It is only a schematic illustration of the cache clearing device 2 applied to the server provided by the present invention. Without violating the concept of the present invention, the splitting, merging, and adding of modules are all within the protection scope of the present invention. The cache clearing device 5 applied to the server provided by the present invention can be implemented by software, hardware, firmware, plug-ins and any combination between them, and the present invention is not limited to this.
[0152] See Picture 10 The ninth embodiment provides an electronic device 3 configured for cache clearing. The electronic device 3 includes at least one storage unit 31, at least one processing unit 32, and a bus 33 connecting different platform systems.
[0153] The storage unit 31 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 311 and/or a cache storage unit 312, and may further include a read-only storage unit (ROM) 313.
[0154] Wherein, the storage unit 31 also stores a program product 4, which can be executed by the processing unit 32, so that the processing unit 32 executes the steps of the cache clearing method in any embodiment (such as Figure 1 to Figure 7 Shown). The storage unit 31 may also include a program/utility tool 314 having a set of (at least one) program modules 315. Such program modules include but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each of the examples or some combination may include the realization of a network environment.
[0155] Correspondingly, the processing unit 32 can execute the above-mentioned program product 4 and can execute the program/utility tool 314.
[0156] The bus 33 may represent one or more of several types of bus structures, including a storage unit bus or a storage unit controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local area using any bus structure among multiple bus structures. bus.
[0157] The electronic device 3 can also communicate with one or more external devices 34 such as keyboards, pointing devices, Bluetooth devices, etc., and can also communicate with one or more devices that can interact with the electronic device 3, and/or communicate with the electronic device 3 Any device (such as router, modem, etc.) that can communicate with one or more other computing devices. This communication can be performed through an input/output (I/O) interface 35. In addition, the electronic device 3 may also communicate with one or more networks (for example, a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) through the network adapter 36. The network adapter 36 can communicate with other modules of the electronic device 3 through the bus 33. It should be understood that although Picture 10 Not shown, other hardware and/or software modules can be used in conjunction with the electronic device 3, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms Wait.
[0158] See Picture 11 The tenth embodiment provides a computer-readable storage medium configured to store a computer program that, when executed, implements the steps of the cache clearing method in any embodiment. Picture 11 The program product 4 provided in this embodiment and configured to implement the above method is shown, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can run on a terminal device, such as a personal computer. However, the program product 4 of the present invention is not limited to this. In this document, the readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or combined with an instruction execution system, device, or device. The program product 4 can adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: electrical connections with one or more wires, portable disks, hard drives, random access memory (RAM), read-only memory (ROM), erasable Type programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
[0159] The computer-readable storage medium may include a data signal propagated in baseband or as a part of a carrier wave, and readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The readable storage medium may also be any readable medium other than the readable storage medium, and the readable medium may send, propagate, or transmit a program configured to be used by or in combination with the instruction execution system, apparatus, or device. The program code contained on the readable storage medium can be transmitted by any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above. The program code configured to perform the operations of the present invention can be written in any combination of one or more programming languages. The programming languages ​​include object-oriented programming languages ​​such as Java, C++, etc., as well as conventional procedural programming languages. Such as "C" language or similar programming language. The program code can be executed entirely on the user's computing device, partly on the user's device, executed as an independent software package, partly on the user's computing device and partly executed on the remote computing device, or entirely on the remote computing device or server Executed on. In the case of a remote computing device, the remote computing device can be connected to a user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using Internet service providers) Business to connect via the Internet).
[0160] This application is described from the viewpoints of use purpose, effectiveness, progress, and novelty. The practical advancement of its setting has already met the functional enhancement and use requirements emphasized by the patent law. The above description and drawings of this application are only This is the preferred embodiment of this application, and it is not intended to limit this application. Therefore, everything that is similar or identical to the structure, device, and features of this application, that is, equivalent replacements or modifications made according to the scope of the patent application of this application. , Should fall within the scope of the patent application protection of this application.

PUM

no PUM

Description & Claims & Application Information

We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.

Similar technology patents

Display method and display device for planned roads

InactiveCN102620743Asave system resources
Owner:SHENZHEN CARELAND TECH

Classification and recommendation of technical efficacy words

  • save system resources
  • Improve processing efficiency

Voice processing method and device

InactiveCN103617797Asave system resources
Owner:TENCENT TECH (SHENZHEN) CO LTD

User equipment calling method and system

Owner:北京智讯伙伴科技有限公司

RFID security authentication method based on physical unclonable function

InactiveCN104333537AGuarantee system securitysave system resources
Owner:CHINA TOBACCO ZHEJIANG IND

Data restoration method, data restoration device and storage system

ActiveCN103049354Asave system resourcesShort repair cycle
Owner:HUAWEI TECH CO LTD

Full-automatic cloth paving and cutting integrated machine

InactiveCN106592194AImprove processing intelligenceImprove processing efficiency
Owner:CHONGQING UNIV OF TECH
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products