CN113434796A - Page cache operation method and device, storage medium and electronic device - Google Patents

Page cache operation method and device, storage medium and electronic device Download PDF

Info

Publication number
CN113434796A
CN113434796A CN202110707326.8A CN202110707326A CN113434796A CN 113434796 A CN113434796 A CN 113434796A CN 202110707326 A CN202110707326 A CN 202110707326A CN 113434796 A CN113434796 A CN 113434796A
Authority
CN
China
Prior art keywords
page
page cache
cache
service
cache operation
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.)
Granted
Application number
CN202110707326.8A
Other languages
Chinese (zh)
Other versions
CN113434796B (en
Inventor
王鑫凯
吴虹松
路万斌
石斐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Haier Smart Home 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 Qingdao Haier Technology Co Ltd, Haier Smart Home Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202110707326.8A priority Critical patent/CN113434796B/en
Publication of CN113434796A publication Critical patent/CN113434796A/en
Application granted granted Critical
Publication of CN113434796B publication Critical patent/CN113434796B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses an operation method and device for page cache, a storage medium and an electronic device, wherein the method comprises the following steps: under the condition that page cache operation is detected on a browsed page, calling a target hijack service to intercept a page cache operation event corresponding to the page cache operation; analyzing and processing the page cache operation event through a routing stack management service to obtain a page cache operation type corresponding to the page cache operation; and calling an automatic cache management service to execute a page cache destroying operation or a page cache creating operation corresponding to the page cache operation type, wherein the automatic cache management service comprises the target hijacking service and the routing stack management service. By adopting the technical scheme, the problem that the traditional method is poor in management of page cache is solved.

Description

Page cache operation method and device, storage medium and electronic device
Technical Field
The invention relates to the field of communication, in particular to an operation method and device of page cache, a storage medium and an electronic device.
Background
Front-end development is carried out to date, front-end separation and front-end single-page application are gradually changed into a mainstream scheme, but the scheme also brings the problem of front-end page caching, for example, the single-page application can only cache page data through a script, which brings great challenges to cache management, for example, when single-page Web uses a front-end route to cache pages, different page instances of the same component cannot be cached, when a commodity detail page is jumped as the commodity detail page, two pages can only share the same cache, which is equivalent to that a page opened last time cannot be cached, and when a user returns, data of the page opened last time needs to be acquired through a network request again. And the single-page Web application needs manual cleaning when the cache is cleaned, and many scenes cannot be covered, so that the page is reserved in the memory for a long time, and the memory waste is caused.
Aiming at the problem of poor management of page cache in the prior art, no effective solution is provided at present.
Accordingly, there is a need for improvement in the related art to overcome the disadvantages of the related art.
Disclosure of Invention
The embodiment of the invention provides an operation method and device for page cache, a storage medium and an electronic device, which are used for at least solving the problem of poor management of the page cache in the traditional method.
According to an aspect of the embodiments of the present invention, there is provided an operation method of a page cache, including: under the condition that page cache operation is detected on a browsed page, calling a target hijack service to intercept a page cache operation event corresponding to the page cache operation; analyzing and processing the page cache operation event through a routing stack management service to obtain a page cache operation type corresponding to the page cache operation; and calling an automatic cache management service to execute a page cache destroying operation or a page cache creating operation corresponding to the page cache operation type, wherein the automatic cache management service comprises the target hijacking service and the routing stack management service.
Further, calling a target hijack service to intercept a page cache operation event corresponding to the page cache operation, including: calling an application hijacking service corresponding to the page caching operation, wherein the target hijacking service comprises the application hijacking service; intercepting a first page cache operation event corresponding to the page cache operation through the application hijack service, wherein the page cache operation event comprises: the first page cache operation event comprises at least one of the following events: page push events and page substitute events.
Further, calling a target hijack service to intercept a page cache operation event corresponding to the page cache operation, including: calling the route hijacking service corresponding to the page cache operation, wherein the target hijacking service comprises the route hijacking service; intercepting a second page cache operation event corresponding to the page cache operation through the route hijack service, wherein the page cache operation event comprises: the second page cache operation event, the second page cache operation event comprising at least one of: a route page push event, a route page replace event, a route page forward event, and a route page return event.
Further, invoking an automatic cache management service to execute a page cache destruction operation or a page cache creation operation corresponding to the page cache operation type, including: determining a first page cache operation logic according to the page cache operation type, wherein the first page cache operation logic at least comprises one of the following: page cache initialization, page cache replacement, page cache forward and page cache return: under the condition that the first page cache operation logic is the page cache initialization, replacing the unique identifier of the virtual object of the browsed page by a rendering function hijack service hijack rendering function, and realizing the page cache initialization according to the virtual object after replacing the unique identifier, wherein the cache automatic management service comprises the rendering function hijack service; when the first page cache operation logic is the page cache replacement, destroying a first page cache at the top of a routing stack to enable a first target page to enter the routing stack, wherein the page cache of the browsing page comprises: the first target page; and under the condition that the first page cache operation logic is that the page cache advances, adding one to the height of the routing stack to enable a second target page to enter the routing stack, wherein the page cache of the browsed page comprises the following steps: the second target page; when the first page cache operation logic is the page cache return, reducing the height of the routing stack by one to destroy a first page cache at the top of the routing stack and make a third target page become a current first page cache at the top of the routing stack, wherein the page cache of the browsing page comprises: the third target page.
Further, invoking an automatic cache management service to execute a page cache destruction operation or a page cache creation operation corresponding to the page cache operation type, including: determining a second page cache operation logic according to the page cache operation type, wherein the second page cache operation logic at least comprises one of the following: the page cache advances, and the page cache returns: in the target component of the browsing page, under the condition that the page cache operation logic is determined to be page cache advancing, executing a plurality of page cache creating operations; and in the target assembly, executing a plurality of page cache destroying operations under the condition that the page cache operation logic is determined to be returned by the page cache.
Further, invoking an automatic cache management service to execute a page cache destruction operation or a page cache creation operation corresponding to the page cache operation type, including: judging whether the page cache number of the browsed page is greater than a preset threshold value or not; and under the condition that the number of the page caches is larger than a preset threshold, executing destruction processing to enable the page caches to only comprise at least one of the following: the current page cache and the last page cache of the current page cache.
According to another aspect of the embodiments of the present invention, there is also provided an operating device for page caching, including: the system comprises an acquisition module, a cache module and a cache module, wherein the acquisition module is used for calling a target hijack service under the condition that page cache operation is detected on a browsed page so as to intercept a page cache operation event corresponding to the page cache operation; the processing module is used for analyzing and processing the page cache operation event through a routing stack management service so as to obtain a page cache operation type corresponding to the page cache operation; and the execution module is used for calling an automatic cache management service to execute a page cache destroying operation or a page cache creating operation corresponding to the page cache operation type, wherein the automatic cache management service comprises the target hijack service and the routing stack management service.
Further, the obtaining module is further configured to invoke an application hijacking service corresponding to the page caching operation, where the target hijacking service includes the application hijacking service; intercepting a first page cache operation event corresponding to the page cache operation through the application hijack service, wherein the page cache operation event comprises: the first page cache operation event comprises at least one of the following events: page push events and page substitute events.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, where the computer program is configured to execute the above-mentioned page caching operation method when running.
According to another aspect of the embodiments of the present invention, there is also provided an electronic apparatus, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the operation method of the page cache through the computer program.
According to the invention, under the condition that the page cache operation is detected on the browsed page, the target hijack service is called, the page cache operation event corresponding to the page cache operation is intercepted, and the page cache operation event is analyzed and processed through the routing stack management service, so that the page cache operation type corresponding to the page cache operation is obtained, and further, the cache automatic management service is called to execute the page cache destroying operation or the page cache creating operation corresponding to the page cache operation type. By adopting the technical scheme, the problem that the traditional method is poor in management of page cache is solved. And then, the page cache creating operation corresponding to the page cache operation type is executed by calling the cache automatic management service, so that different page instances of the same component can be cached, and the operation of a user can be responded quickly.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a block diagram of a hardware configuration of a computer terminal of an operation method of a page cache according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of operation of a page cache according to an embodiment of the present invention;
FIG. 3 is an architecture diagram of a method of operation of a page cache according to an embodiment of the invention;
FIG. 4 is a flow chart of a method of operation of a page cache according to an embodiment of the present invention;
fig. 5 is a block diagram of an operating apparatus of a page cache according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The method embodiments provided in the embodiments of the present application may be executed in a computer terminal or a similar computing device. Taking the operation on a computer terminal as an example, fig. 1 is a hardware structure block diagram of the computer terminal of the page cache operation method according to the embodiment of the present invention. As shown in fig. 1, the computer terminal may include one or more processors 102 (only one is shown in fig. 1), wherein the processors 102 may include, but are not limited to, a Microprocessor (MPU) or a Programmable Logic Device (PLD), and a memory 104 for storing data, and in an exemplary embodiment, the computer terminal may further include a transmission device 106 for communication function and an input/output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the computer terminal. For example, the computer terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration with equivalent functionality to that shown in FIG. 1 or with more functionality than that shown in FIG. 1.
The memory 104 may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the operation method of the page cache in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, so as to implement the above-mentioned method. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to a computer terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In the related art, a cache component (keep-alive) and a front-end routing plug-in (Vue-Router) provided by vue. js (front-end framework) have solved the page cache problem, but have short boards, such as: different page instances of the same component cannot be cached; the page which does not need to be cached cannot be destroyed in time, and the memory is recycled. In the process of sharing the page, the URL carries a router-key; the cache cannot be automatically cleaned in the process of returning to the original page, each page needs to be independently processed, and the cache cannot be cleaned by using a physical return key event.
In order to solve the above problem, in this embodiment, an operation method of a page cache is provided, and fig. 2 is a flowchart (a) of the operation method of the page cache according to the embodiment of the present invention, where the process includes the following steps:
step S202, under the condition that page cache operation is detected on a browsing page, a target hijack service is called to intercept a page cache operation event corresponding to the page cache operation;
step S204, analyzing and processing the page cache operation event through a routing stack management service to obtain a page cache operation type corresponding to the page cache operation;
step S206, invoking an automatic cache management service to perform a page cache destruction operation or a page cache creation operation corresponding to the page cache operation type, where the automatic cache management service includes the target hijack service and the routing stack management service.
Through the steps, under the condition that the page cache operation is detected on the browsed page, the target hijack service is called, the page cache operation event corresponding to the page cache operation is intercepted, the page cache operation event is analyzed and processed through the routing stack management service, the page cache operation type corresponding to the page cache operation is obtained, and then the cache automatic management service is called to execute the page cache destroying operation or the page cache creating operation corresponding to the page cache operation type. By adopting the technical scheme, the problem that the traditional method is poor in management of page cache is solved. And then, the page cache creating operation corresponding to the page cache operation type is executed by calling the cache automatic management service, so that different page instances of the same component can be cached, and the operation of a user can be responded quickly.
It should be noted that intercepting a page cache operation event corresponding to the page cache operation may be implemented in the following manner: calling an application hijacking service corresponding to the page caching operation, wherein the target hijacking service comprises the application hijacking service; intercepting a first page cache operation event corresponding to the page cache operation through the application hijack service, wherein the page cache operation event comprises: the first page cache operation event comprises at least one of the following events: page push events and page substitute events.
Further, intercepting a page cache operation event corresponding to the page cache operation can be implemented in the following manner: calling the route hijacking service corresponding to the page cache operation, wherein the target hijacking service comprises the route hijacking service; intercepting a second page cache operation event corresponding to the page cache operation through the route hijack service, wherein the page cache operation event comprises: the second page cache operation event, the second page cache operation event comprising at least one of: a route page push event, a route page replace event, a route page forward event, and a route page return event.
That is, the target hijacking service mainly includes: the method comprises the steps that an application hijacking service and a route hijacking service are adopted, wherein the application hijacking service is mainly responsible for intercepting historical page push events and page substitute events of a browser; the route hijacking service is mainly responsible for intercepting a route page push event, a route page substitution event, a route page forward event and a route page return event. Because the user does not know what the page cache operation is, the application hijack service and the routing hijack service can be called at the same time, the page push event and the page substitute event corresponding to the page cache operation are intercepted by the application hijack service, and the routing page push event, the routing page substitute event, the routing page forward event and the routing page return event corresponding to the page cache operation are intercepted by the routing hijack service.
After the application hijack service and the routing hijack service intercept the page cache operation event, a message is sent to the routing stack management service, the page cache operation event is analyzed and processed through the routing stack management service, the page cache operation type corresponding to the page cache operation is obtained, and then the cache automatic management service is called to execute the page cache destroying operation or the page cache creating operation corresponding to the page cache operation type.
It should be noted that the cache automatic management service executes a page cache destruction operation or a page cache creation operation corresponding to the page cache operation type in the following manner: determining a first page cache operation logic according to the page cache operation type, wherein the first page cache operation logic at least comprises one of the following: page cache initialization, page cache replacement, page cache forward and page cache return: under the condition that the first page cache operation logic is the page cache initialization, replacing the unique identifier of the virtual object of the browsed page by a rendering function hijack service hijack rendering function, and realizing the page cache initialization according to the virtual object after replacing the unique identifier, wherein the cache automatic management service comprises the rendering function hijack service; when the first page cache operation logic is the page cache replacement, destroying a first page cache at the top of a routing stack to enable a first target page to enter the routing stack, wherein the page cache of the browsing page comprises: the first target page; and under the condition that the first page cache operation logic is that the page cache advances, adding one to the height of the routing stack to enable a second target page to enter the routing stack, wherein the page cache of the browsed page comprises the following steps: the second target page; when the first page cache operation logic is the page cache return, reducing the height of the routing stack by one to destroy a first page cache at the top of the routing stack and make a third target page become a current first page cache at the top of the routing stack, wherein the page cache of the browsing page comprises: the third target page.
Therefore, the cache automatic management service determines a first page cache operation logic according to the page cache operation type, and the first page cache operation logic may specifically be: page cache initialization, page cache replacement, page cache forward, and page cache return. When the cache automatic management service determines that the page cache operation type is the page cache initialization, the rendering function is hijacked through the rendering function hijacked service, so that the unique identifier of the virtual object of the browsed page, namely the Key in the Vnode, is replaced, and the page cache initialization is realized according to the virtual object after the unique identifier is replaced.
When the cache automatic management service determines that the page cache operation type is page cache replacement, the first page cache at the top of the routing stack is destroyed, so that the first target page enters the routing stack. Therefore, when a new page is entered, the first page cache at the top of the stack needs to be destroyed.
And when the cache automatic management service determines that the page cache operation type is page cache forwarding, adding one to the height of the routing stack to enable a second target page to enter the routing stack. In short, as the page cache progresses, a new page is stacked, the height of the stack being incremented by one.
When the cache automatic management service determines that the page cache operation type is the page cache return, the height of the routing stack is reduced by one so as to destroy the first page cache at the top of the routing stack and enable a third target page to be the current first page cache at the top of the routing stack. In short, when a page cache return is made, the page cache at the top of the stack is destroyed and the height of the stack is reduced by one.
It should be noted that the first target page, the second target page, and the third target page are for distinguishing different pages used when different page caching operations are performed, and the page cache of the browsing page includes the first target page, the second target page, and the third target page.
Further, invoking an automatic cache management service to execute a page cache destruction operation or a page cache creation operation corresponding to the page cache operation type may also be implemented by: determining a second page cache operation logic according to the page cache operation type, wherein the second page cache operation logic at least comprises one of the following: the page cache advances, and the page cache returns: in the target component of the browsing page, under the condition that the page cache operation logic is determined to be page cache advancing, executing a plurality of page cache creating operations; and in the target assembly, executing a plurality of page cache destroying operations under the condition that the page cache operation logic is determined to be returned by the page cache.
Further, when the cache automatic management service is called to execute a page cache destruction operation or a page cache creation operation corresponding to the page cache operation type, it is also required to judge whether the number of page caches of the browsed page is greater than a preset threshold value; and under the condition that the number of the page caches is larger than a preset threshold, executing destruction processing to enable the page caches to only comprise at least one of the following: the current page cache and the last page cache of the current page cache.
That is to say, the number of the page caches of the pages to be browsed is greater than the preset threshold, which means that the number of the pages exceeding the preset number in the page caches of the browsed pages is indicated, the pages exceeding the preset number need to be regarded as invalid caches, and then destruction processing is performed on the invalid caches.
It is to be understood that the above-described embodiments are only a few, but not all, embodiments of the present invention. In order to better understand the operation method of the page cache, the following describes the above process with reference to an embodiment, but is not limited to the specific technical solution of the embodiment of the present invention:
in an alternative embodiment, fig. 3 is an architecture diagram of an operation method of a page cache according to an embodiment of the present invention, specifically:
the cache automatic management engine (corresponding to the cache automatic management service in the above embodiment) can be divided into 4 parts: a routing stack management module (equivalent to the routing stack management service in the above embodiment), a browser event interception module (equivalent to the application hijacking service in the above embodiment), a front-end routing event interception module (equivalent to the routing hijacking service in the above embodiment), and a cache rendering function hijacking module (equivalent to the rendering function hijacking service in the above embodiment).
The browser event intercepting module is mainly responsible for intercepting push (equivalent to page push in the above embodiment) and place (equivalent to page replacement in the above embodiment) events of the browser history, and sending a message to the routing stack management module to process relevant logic.
The front-end routing event intercepting module is mainly responsible for intercepting push (equivalent to stacking of routing pages in the above embodiments), place (equivalent to replacing of routing pages in the above embodiments), go (equivalent to forwarding of routing pages in the above embodiments), and back (equivalent to returning of routing pages in the above embodiments) events of Vue-router, and sending messages to the routing stack module to process relevant logics.
The cache rendering function hijacking module is mainly responsible for hijacking the rendering function of the keep-alive component, and replaces the key corresponding to the Vnode before rendering (which is equivalent to the unique identifier of the virtual object replacing the browsing page in the above embodiment).
The routing stack management module is mainly responsible for receiving messages transmitted by other modules to process related forward, backward and replacement logics, maintains a routing page stack and destroys objects stored in the stack at a specific moment.
At present, mobile Web end user experience is close to native App, but most of the experience still stays in UI and interaction level, there is no simulation scheme related to native routing stack, and development experience is also greatly different from native development experience, so in an optional embodiment, an operation method of page cache based on routing stack is provided, fig. 4 is a flow chart (ii) of an operation method of page cache according to an embodiment of the present invention, and the specific steps are as follows:
step S402: acquiring user operation, judging the user operation, executing a step S404 under the condition that the user operation is browser returning and advancing, and executing a step S406 under the condition that the user operation is service code operation;
step S404: intercepting a page cache operation event corresponding to page cache operation by using a browser hijack module;
step S406: intercepting a page cache operation event corresponding to page cache operation by using a front-end route hijack module;
step S408: identifying the operation type of the operation event by using a routing stack management module;
step S410: determining whether the operation type is initialization (equivalent to page cache initialization in the above embodiment), if so, performing step S412, otherwise, performing step S414;
step S412: the cache rendering function hijacking module hijacks the rendering function to replace the unique identifier of the virtual object of the browsed page, and initializes the page cache according to the virtual object after replacing the unique identifier;
step S414: judging whether the operation type is Replace (equivalent to page cache replacement in the above embodiment), if so, executing step S416, and if not, executing step S418;
step S416: the height of the routing stack is unchanged, and the current stack top cache page is destroyed;
step S418: determining whether the operation type is Push (which is equivalent to the page cache advance in the above embodiment), if so, executing step S420, and if not, executing step S422;
step S420: adding one to the height of the routing stack, and stacking the page;
step S422: the height of the routing stack is reduced by one, and a stack top page is destroyed;
step S424: the logic ends this time.
For better understanding, the browser module hijacking browser behavior includes: the browser returns an event, a forward event, an android physical return key event, and the like, which assists the step S408 in judging the behavior; the front-end routing hijacking module hijacks front-end routing behaviors, such as push, replace, go, and back methods, to assist the step S408 in judging the behaviors, and according to the event types collected in the steps S404 and S406, four conditions are judged: initialization, replacement, forward, backward, and then process different logics, respectively.
When initializing, hijacking a rendering function of a cache component is needed, and the purpose is to dynamically replace a Key for a page instance; when the page is replaced, the page cache at the top of the stack is destroyed, a new page is put on the stack, and the stack height is unchanged; when the page advances, a new page is stacked, and the stack height is increased by one; and when returning, destroying the page cache at the top of the stack, and reducing the stack height by one.
Through the scheme, the method can specifically realize that: (1) when the page A skips the page A (for example, the commodity detail page skips the commodity detail page), two page A instances are created and cached under a corresponding path, and the page cached before can be quickly displayed through the matching of the path when returning; (2) and the page A jumps to the page B, and when the page A is returned, if the page A is judged to be returned, the page B destroying operation is triggered so as to save the use of the memory. If the commodity searching result page jumps to the commodity detail page, the previous searching result page is directly displayed without passing through a network request again when returning, and meanwhile, the cache of the commodity detail page is automatically destroyed.
In addition, according to the technical scheme of the embodiment of the invention, developers do not need to manually manage the cache, and zero intrusion of the code is realized; the front-end routing automatic management is realized, and developers do not allow any additional operation; the return, forward and replacement can be automatically identified, and the page cache can be automatically managed; the URL does not carry meaningless router-key parameters; the useless cache can be destroyed by using return events such as android physical return keys; after the page is refreshed, the forward or backward still can be accurately identified, and the integrity and normal destruction logic of the routing chain are ensured; a page routing experience close to the native App is simulated.
And by the invention, the development of the native App page route can be simulated at the mobile Web end. The created and destroyed page can be hosted to the cache management engine, developers do not need to worry about the destruction and the memory occupation of the cache page, and users can also obtain a quick response close to the original state when returning, so that the user experience is improved.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, an operation device for page caching is further provided, where the device is used to implement the foregoing embodiments and preferred embodiments, and details are not repeated for what has been described. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementations in hardware or a combination of software and hardware are also possible and contemplated.
Fig. 5 is a block diagram of an operating apparatus of a page cache according to an embodiment of the present invention, the apparatus including:
the acquiring module 52 is configured to, when a page cache operation is detected on a browsing page, invoke a target hijack service to intercept a page cache operation event corresponding to the page cache operation;
a processing module 54, configured to analyze and process the page cache operation event through a routing stack management service, so as to obtain a page cache operation type corresponding to the page cache operation;
an executing module 56, configured to invoke an automatic cache management service to execute a page cache destruction operation or a page cache creation operation corresponding to the page cache operation type, where the automatic cache management service includes the target hijack service and the routing stack management service.
By the aid of the module, under the condition that page cache operation is detected on a browsed page, a target hijack service is called, a page cache operation event corresponding to the page cache operation is intercepted, the page cache operation event is analyzed and processed through a routing stack management service, a page cache operation type corresponding to the page cache operation is obtained, and then a cache automatic management service is called to execute page cache destroying operation or page cache creating operation corresponding to the page cache operation type. By adopting the technical scheme, the problem that the traditional method is poor in management of page cache is solved. And then, the page cache creating operation corresponding to the page cache operation type is executed by calling the cache automatic management service, so that different page instances of the same component can be cached, and the operation of a user can be responded quickly.
Optionally, the obtaining module 52 is further configured to invoke an application hijacking service corresponding to the page caching operation, where the target hijacking service includes the application hijacking service; intercepting a first page cache operation event corresponding to the page cache operation through the application hijack service, wherein the page cache operation event comprises: the first page cache operation event comprises at least one of the following events: page push events and page substitute events.
Optionally, the obtaining module 52 is further configured to invoke the route hijacking service corresponding to the page caching operation, where the target hijacking service includes the route hijacking service; intercepting a second page cache operation event corresponding to the page cache operation through the route hijack service, wherein the page cache operation event comprises: the second page cache operation event, the second page cache operation event comprising at least one of: a route page push event, a route page replace event, a route page forward event, and a route page return event.
Optionally, the execution module 56 is further configured to determine a first page cache operation logic according to the page cache operation type, where the first page cache operation logic at least includes one of: page cache initialization, page cache replacement, page cache forward and page cache return: under the condition that the first page cache operation logic is the page cache initialization, replacing the unique identifier of the virtual object of the browsed page by a rendering function hijack service hijack rendering function, and realizing the page cache initialization according to the virtual object after replacing the unique identifier, wherein the cache automatic management service comprises the rendering function hijack service; when the first page cache operation logic is the page cache replacement, destroying a first page cache at the top of a routing stack to enable a first target page to enter the routing stack, wherein the page cache of the browsing page comprises: the first target page; and under the condition that the first page cache operation logic is that the page cache advances, adding one to the height of the routing stack to enable a second target page to enter the routing stack, wherein the page cache of the browsed page comprises the following steps: the second target page; when the first page cache operation logic is the page cache return, reducing the height of the routing stack by one to destroy a first page cache at the top of the routing stack and make a third target page become a current first page cache at the top of the routing stack, wherein the page cache of the browsing page comprises: the third target page.
Optionally, the executing module 56 is further configured to determine a second page cache operation logic according to the page cache operation type, where the second page cache operation logic at least includes one of: the page cache advances, and the page cache returns: in the target component of the browsing page, under the condition that the page cache operation logic is determined to be page cache advancing, executing a plurality of page cache creating operations; and in the target assembly, executing a plurality of page cache destroying operations under the condition that the page cache operation logic is determined to be returned by the page cache.
Optionally, the execution module 56 is further configured to determine whether the number of page caches of the browsing page is greater than a preset threshold; and under the condition that the number of the page caches is larger than a preset threshold, executing destruction processing to enable the page caches to only comprise at least one of the following: the current page cache and the last page cache of the current page cache.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, under the condition that the page cache operation is detected on the browsing page, calling a target hijack service to intercept a page cache operation event corresponding to the page cache operation;
s2, analyzing and processing the page cache operation event through a routing stack management service to obtain a page cache operation type corresponding to the page cache operation;
and S3, calling an automatic cache management service to execute a page cache destroying operation or a page cache creating operation corresponding to the page cache operation type, wherein the automatic cache management service comprises the target hijack service and the routing stack management service.
In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary embodiments, and details of this embodiment are not repeated herein.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, under the condition that the page cache operation is detected on the browsing page, calling a target hijack service to intercept a page cache operation event corresponding to the page cache operation;
s2, analyzing and processing the page cache operation event through a routing stack management service to obtain a page cache operation type corresponding to the page cache operation;
and S3, calling an automatic cache management service to execute a page cache destroying operation or a page cache creating operation corresponding to the page cache operation type, wherein the automatic cache management service comprises the target hijack service and the routing stack management service.
In an exemplary embodiment, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary embodiments, and details of this embodiment are not repeated herein.
It will be apparent to those skilled in the art that the various modules or steps of the invention described above may be implemented using a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and they may be implemented using program code executable by the computing devices, such that they may be stored in a memory device and executed by the computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into various integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. An operating method of a page cache, comprising:
under the condition that page cache operation is detected on a browsed page, calling a target hijack service to intercept a page cache operation event corresponding to the page cache operation;
analyzing and processing the page cache operation event through a routing stack management service to obtain a page cache operation type corresponding to the page cache operation;
and calling an automatic cache management service to execute a page cache destroying operation or a page cache creating operation corresponding to the page cache operation type, wherein the automatic cache management service comprises the target hijacking service and the routing stack management service.
2. The method for operating a page cache according to claim 1, wherein invoking a target hijacking service to intercept a page cache operation event corresponding to the page cache operation comprises:
calling an application hijacking service corresponding to the page caching operation, wherein the target hijacking service comprises the application hijacking service;
intercepting a first page cache operation event corresponding to the page cache operation through the application hijack service, wherein the page cache operation event comprises: the first page cache operation event comprises at least one of the following events: page push events and page substitute events.
3. The method for operating a page cache according to claim 1, wherein invoking a target hijacking service to intercept a page cache operation event corresponding to the page cache operation comprises:
calling the route hijacking service corresponding to the page cache operation, wherein the target hijacking service comprises the route hijacking service;
intercepting a second page cache operation event corresponding to the page cache operation through the route hijack service, wherein the page cache operation event comprises: the second page cache operation event, the second page cache operation event comprising at least one of: a route page push event, a route page replace event, a route page forward event, and a route page return event.
4. The method according to claim 1, wherein invoking an automatic cache management service to perform a page cache destruction operation or a page cache creation operation corresponding to the page cache operation type comprises:
determining a first page cache operation logic according to the page cache operation type, wherein the first page cache operation logic at least comprises one of the following: page cache initialization, page cache replacement, page cache forward and page cache return:
under the condition that the first page cache operation logic is the page cache initialization, replacing the unique identifier of the virtual object of the browsed page by a rendering function hijack service hijack rendering function, and realizing the page cache initialization according to the virtual object after replacing the unique identifier, wherein the cache automatic management service comprises the rendering function hijack service;
when the first page cache operation logic is the page cache replacement, destroying a first page cache at the top of a routing stack to enable a first target page to enter the routing stack, wherein the page cache of the browsing page comprises: the first target page;
and under the condition that the first page cache operation logic is that the page cache advances, adding one to the height of the routing stack to enable a second target page to enter the routing stack, wherein the page cache of the browsed page comprises the following steps: the second target page;
when the first page cache operation logic is the page cache return, reducing the height of the routing stack by one to destroy a first page cache at the top of the routing stack and make a third target page become a current first page cache at the top of the routing stack, wherein the page cache of the browsing page comprises: the third target page.
5. The method according to claim 1, wherein invoking an automatic cache management service to perform a page cache destruction operation or a page cache creation operation corresponding to the page cache operation type comprises:
determining a second page cache operation logic according to the page cache operation type, wherein the second page cache operation logic at least comprises one of the following: the page cache advances, and the page cache returns:
in the target component of the browsing page, under the condition that the page cache operation logic is determined to be page cache advancing, executing a plurality of page cache creating operations;
and in the target assembly, executing a plurality of page cache destroying operations under the condition that the page cache operation logic is determined to be returned by the page cache.
6. The method according to claim 1, wherein invoking an automatic cache management service to perform a page cache destruction operation or a page cache creation operation corresponding to the page cache operation type comprises:
judging whether the page cache number of the browsed page is greater than a preset threshold value or not;
and under the condition that the number of the page caches is larger than a preset threshold, executing destruction processing to enable the page caches to only comprise at least one of the following: the current page cache and the last page cache of the current page cache.
7. An apparatus for operating a page cache, comprising:
the system comprises an acquisition module, a cache module and a cache module, wherein the acquisition module is used for calling a target hijack service under the condition that page cache operation is detected on a browsed page so as to intercept a page cache operation event corresponding to the page cache operation;
the processing module is used for analyzing and processing the page cache operation event through a routing stack management service so as to obtain a page cache operation type corresponding to the page cache operation;
and the execution module is used for calling an automatic cache management service to execute a page cache destroying operation or a page cache creating operation corresponding to the page cache operation type, wherein the automatic cache management service comprises the target hijack service and the routing stack management service.
8. The device for operating a page cache according to claim 7, wherein the obtaining module is further configured to invoke an application hijacking service corresponding to the page cache operation, where the target hijacking service includes the application hijacking service; intercepting a first page cache operation event corresponding to the page cache operation through the application hijack service, wherein the page cache operation event comprises: the first page cache operation event comprises at least one of the following events: page push events and page substitute events.
9. A computer-readable storage medium, comprising a stored program, wherein the program is operable to perform the method of any one of claims 1 to 6.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 6 by means of the computer program.
CN202110707326.8A 2021-06-24 2021-06-24 Page cache operation method and device, storage medium and electronic device Active CN113434796B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110707326.8A CN113434796B (en) 2021-06-24 2021-06-24 Page cache operation method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110707326.8A CN113434796B (en) 2021-06-24 2021-06-24 Page cache operation method and device, storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN113434796A true CN113434796A (en) 2021-09-24
CN113434796B CN113434796B (en) 2023-08-18

Family

ID=77754167

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110707326.8A Active CN113434796B (en) 2021-06-24 2021-06-24 Page cache operation method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN113434796B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113900628A (en) * 2021-12-09 2022-01-07 中邮消费金融有限公司 Vue-based multi-page label instance caching method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101442970B1 (en) * 2013-04-16 2014-09-23 광운대학교 산학협력단 Apparatus and method for caching web browser information using non-volatile memory
CN105068941A (en) * 2015-07-31 2015-11-18 浪潮电子信息产业股份有限公司 Cache page replacing method and cache page replacing device
CN106095568A (en) * 2016-06-01 2016-11-09 努比亚技术有限公司 Memory management device, mobile terminal and method
CN110020271A (en) * 2017-08-04 2019-07-16 北京京东尚科信息技术有限公司 Method and system for cache management
CN110427585A (en) * 2019-07-19 2019-11-08 上海易点时空网络有限公司 Page data processing method and device, storage medium suitable for front end routing
CN111538574A (en) * 2020-03-27 2020-08-14 北京达佳互联信息技术有限公司 Task stack management method, device, terminal and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101442970B1 (en) * 2013-04-16 2014-09-23 광운대학교 산학협력단 Apparatus and method for caching web browser information using non-volatile memory
CN105068941A (en) * 2015-07-31 2015-11-18 浪潮电子信息产业股份有限公司 Cache page replacing method and cache page replacing device
CN106095568A (en) * 2016-06-01 2016-11-09 努比亚技术有限公司 Memory management device, mobile terminal and method
CN110020271A (en) * 2017-08-04 2019-07-16 北京京东尚科信息技术有限公司 Method and system for cache management
CN110427585A (en) * 2019-07-19 2019-11-08 上海易点时空网络有限公司 Page data processing method and device, storage medium suitable for front end routing
CN111538574A (en) * 2020-03-27 2020-08-14 北京达佳互联信息技术有限公司 Task stack management method, device, terminal and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
TROY A.JOHNSON等: "CacheConnect: On-device proxy and web cache for performance increases", 《13TH IEEE ANNUAL CONSUMER COMMUNICATIONS & NETWORKING CONFERENCE (CCNC)》, pages 268 - 269 *
刘伟等: "面向访问模式的混合内存缓存替换策略", 《计算机科学》, vol. 47, no. 10, pages 130 - 135 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113900628A (en) * 2021-12-09 2022-01-07 中邮消费金融有限公司 Vue-based multi-page label instance caching method
CN113900628B (en) * 2021-12-09 2022-02-18 中邮消费金融有限公司 Vue-based multi-page label instance caching method

Also Published As

Publication number Publication date
CN113434796B (en) 2023-08-18

Similar Documents

Publication Publication Date Title
CN110427299B (en) Log processing method, related device and system for micro-service system application
CN108696399B (en) Business service test method and device
CN113366815B (en) Network resource request method, device, electronic equipment and storage medium
CN111399756B (en) Data storage method, data downloading method and device
CN109618176B (en) Processing method, equipment and storage medium for live broadcast service
CN113010378B (en) Log processing method and device of microservice module, storage medium and electronic device
CN112506670B (en) Multi-node automatic operation and maintenance task processing method, system and storage medium
CN109688094B (en) Suspicious IP configuration method, device, equipment and storage medium based on network security
CN108234233A (en) Log processing method and device
CN109698814B (en) Botnet discovery method and botnet discovery device
CN113434293A (en) Method and apparatus for processing repeat request, storage medium, and electronic apparatus
CN113434796B (en) Page cache operation method and device, storage medium and electronic device
CN111338710A (en) Application program control method and device, electronic equipment and storage medium
CN113495765A (en) Business data filling method and device, storage medium and electronic device
CN103248627A (en) Method, forward proxy server and system for visiting website resources
CN109522282A (en) Picture management method, device, computer installation and storage medium
CN117032870A (en) Page jump processing method and device
CN114611039B (en) Analysis method and device of asynchronous loading rule, storage medium and electronic equipment
CN114253441B (en) Method and device for enabling target function, storage medium and electronic device
CN106156210B (en) Method and device for determining application identifier matching list
CN112131263B (en) Software package acquisition method, system, device, electronic equipment and storage medium
CN110858846A (en) Resource allocation method, device and storage medium
CN112579472B (en) Automatic generation method and device for test cases
CN115037654A (en) Flow statistical method and device, electronic equipment and readable storage medium
CN109032795A (en) The processing method and processing device of data buffer storage, storage medium, electronic 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
GR01 Patent grant
GR01 Patent grant