A cache screening condition method and system based on browser indexedDB

By using the indexedDB storage function in the browser, creating a cache database and generating a save_form table, the problem of missing filter conditions in the data management system is solved, and the correct storage and recovery of filter conditions is achieved.

CN118349740BActive Publication Date: 2025-05-02JIANGXI DIGITAL NETWORK INFORMATION SECURITY TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410504209.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-25
Publication Date
2025-05-02
Estimated Expiration
2044-04-25

AI Technical Summary

Technical Problem

In the data management system, after entering the details page and returning, the filter conditions will be lost, resulting in errors in backfilling some filter conditions.

Method used

Using the indexedDB storage function based on the browser, create a cache database and generate a save_form table for storing filter conditions. By listening to page jump events, reading and saving filter conditions, ensuring that the filter conditions can be correctly restored when the child page returns to the parent page.

Benefits of technology

It effectively solves the problem of filter conditions loss, ensures that filter conditions can be properly saved and restored during the page jump process, and avoids filter conditions backfill errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118349740B_ABST
    Figure CN118349740B_ABST
Patent Text Reader

Abstract

The present invention discloses a cache screening condition method and system based on browser indexedDB. The method saves the screening condition based on the browser's indexedDB storage function, and then reads and screens it when the child page returns to the parent page. Indexed is stored in a key-value pair method to prevent duplication and confusion, and supports asynchronous reading, which can achieve senseless acquisition. In addition, due to the key-value pair method, the data format can be saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of cache data processing, and in particular relates to a cache screening condition method and system based on browser indexedDB. Background Art

[0002] With the advent of the digital age, more and more business scenarios have been transferred online. Online and paperless offices have become the norm. The transfer of business scenarios has brought about more and more online data management systems. The most common online data management system is the data management page. The data management page has a large number of filter conditions. However, after entering the details page in the data management system and returning, the filter conditions will be lost. The caches on the market are all stored in localStorage. Converting data into JSON strings for storage will lose the data format of the filter conditions, resulting in errors in the backfill of some filter conditions. Summary of the invention

[0003] The present invention provides a method and system for caching filtering conditions based on browser indexedDB, which are used to solve the technical problem that the data format of the filtering conditions may be lost, resulting in errors in the backfilling of some filtering conditions.

[0004] In a first aspect, the present invention provides a cache screening method based on browser indexedDB, comprising:

[0005] Create an indexedDB cache database, and generate a save_form table for storing screening conditions in the indexedDB cache database;

[0006] Acquire at least one page jump event in the jump process of the data management page, and filter out a target page jump event including a jump to a subpage from the at least one page jump event;

[0007] Reading the filter condition object of the current page corresponding to the target page jump event, and determining whether the filter condition object of the current page exists in the indexedDB cache database;

[0008] If it does not exist, insert the filter condition object of the current page into the save_form table of the indexedDB cache database and enter the sub-page;

[0009] After entering the sub-page, assign a value of true to the variable save_flag whose default value is false in the sub-page, so as to record that the sub-page needs to read the filter condition cache after returning to the parent page;

[0010] When the child page returns to the parent page, the save_flag is returned together, and the value of the save_flag is read in the parent page to determine whether the value of the save_flag is true;

[0011] If so, the save_form table in the indexedDB cache database is opened, and the page routing name corresponding to the sub-page is read from the save_form table, and the filtering condition is obtained according to the page routing name.

[0012] In a second aspect, the present invention provides a cache screening condition system based on browser indexedDB, comprising:

[0013] A creation module is configured to create an indexedDB cache database, and generate a save_form table for storing screening conditions in the indexedDB cache database;

[0014] A screening module, configured to obtain at least one page jump event in the jump process of the data management page, and screen out a target page jump event including a jump to a subpage from the at least one page jump event;

[0015] A first judgment module is configured to read the filter condition object of the current page corresponding to the target page jump event, and judge whether the filter condition object of the current page exists in the indexedDB cache database;

[0016] An insertion module is configured to insert the filter condition object of the current page into the save_form table of the indexedDB cache database if it does not exist, and enter the sub-page;

[0017] An assignment module is configured to assign a value of true to a variable save_flag whose default value is false in the sub-page after entering the sub-page, so as to record that the sub-page needs to read the filter condition cache after returning to the parent page;

[0018] A second judgment module is configured to return the save_flag together when the child page returns to the parent page, and read the value of the save_flag in the parent page to judge whether the value of the save_flag is true;

[0019] The acquisition module is configured to, if yes, open the save_form table in the indexedDB cache database, read the page routing name corresponding to the sub-page in the save_form table, and obtain the screening condition according to the page routing name.

[0020] According to a third aspect, an electronic device is provided, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the steps of the cache filtering condition method based on browser indexedDB of any embodiment of the present invention.

[0021] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor executes the steps of the cache screening condition method based on browser indexedDB of any embodiment of the present invention.

[0022] The cache filtering condition method and system based on browser indexedDB of the present application saves the filtering conditions based on the browser's indexedDB storage function, and then reads and filters them when the child page returns to the parent page. Indexed is stored in a key-value pair method to prevent duplication and confusion, and supports asynchronous reading, which can achieve seamless acquisition, and because of the key-value pair method, the data format can be saved. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0024] Figure 1 A flowchart of a cache screening method based on browser indexedDB provided by an embodiment of the present invention;

[0025] Figure 2 A structural block diagram of a cache screening condition system based on browser indexedDB provided by an embodiment of the present invention;

[0026] Figure 3 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0028] See also Figure 1 , which shows a flowchart of a cache screening condition method based on browser indexedDB of the present application.

[0029] like Figure 1 As shown, the cache screening method based on browser indexedDB specifically includes the following steps:

[0030] Step S101: create an indexedDB cache database, and generate a save_form table for storing screening conditions in the indexedDB cache database.

[0031] In this step, an indexedDB cache database is generated according to the browser's own command window.indexedDB.open(), and a save_form table for storing screening conditions is created in the indexedDB cache database.

[0032] Step S102: acquiring at least one page jump event in the jump process of the data management page, and filtering out a target page jump event including a jump to a sub-page from the at least one page jump event.

[0033] In this step, at least one route jump event in the jump process of the data management page is obtained, wherein the route in the route jump event is associated with the page; the target route jump event of the current route jumping to the sub-route is filtered out from the at least one route jump event, and through the association relationship between the route and the page, the target page jump event of the current page jumping to the sub-page associated with the sub-route is obtained.

[0034] Step S103: read the filter condition object of the current page corresponding to the target page jump event, and determine whether the filter condition object of the current page exists in the indexedDB cache database.

[0035] In this step, if the filter condition object of the current page exists in the indexedDB cache database, the filter condition object of the current page is deleted.

[0036] Step S104: If it does not exist, insert the filter condition object of the current page into the save_form table of the indexedDB cache database and enter the sub-page.

[0037] In this step, the attributes of the filter condition object of the current page are traversed, all attribute values ​​and the specific filter value of the current page are read, a new object is generated with the traversed attribute name and attribute value, and the new object is inserted into the save_form table of the indexedDB cache database as a key-value pair, where the key is <page route name>_save_form.

[0038] Step S105, after entering the sub-page, assigning a value of true to the variable save_flag whose default value is false in the sub-page, for recording that the sub-page needs to read the filter condition cache after returning to the parent page;

[0039] Step S106, when the child page returns to the parent page, the save_flag is returned together, and the value of the save_flag is read in the parent page to determine whether the value of the save_flag is true;

[0040] Step S107: If yes, then open the save_form table in the indexedDB cache database, read the page routing name corresponding to the sub-page in the save_form table, and obtain the filtering condition according to the page routing name.

[0041] In this embodiment, when the system is generated, the indexedDB cache database is generated through the browser's own command window.indexedDB.open(), and the save_form table is created. This method listens in the route jump method of the data management page to monitor whether the route jump jumps to the sub-route. If it is a sub-route, it means that the jump is to the sub-page. The route is compared to confirm that it is a sub-route, then the route name of the current page is read, and the indexedDB is queried to see if <page route name>_save_form exists. If it exists, it is deleted, and then the conditional form object of the current page is read, and its attributes are traversed to read all attribute values, such as common general filters such as page, pageSize, and the specific filter value of the current page. The traversed attribute name and attribute value generate a new object, and this object is inserted into the save_form of indexedDB in the form of a key-value pair, with the key being <page route name>_save_form and the value being the new object.

[0042] After entering the sub-page, assign the variable save_flag in the sub-page with a default value of false to true, which is used to record that the sub-page needs to read the filter condition cache after returning to the parent page. The method of monitoring the return of the sub-page route, when the route returns to the parent page, returns with save_flag, returns to the parent page to read the value of save_flag, if it is true, then open the save_form table of indexedDB, read <page route name>_save_form, obtain the filter condition, and then recycle and assign it to the page filter condition form to perform a filter query, so as to return to the list page in the state before entering the sub-page.

[0043] In summary, the method of the present application saves the filtering conditions based on the indexedDB storage function of the browser, and then reads and filters them when the child page returns to the parent page. Indexed is stored using key-value pairs to prevent duplication and confusion, and supports asynchronous reading, which can achieve seamless acquisition, and because of the key-value pair method, the data format can be saved.

[0044] In a specific embodiment, the cache screening method based on browser indexedDB specifically includes: creating an indexedDB database;

[0045] Generate the save_form table in the indexedDB database to store the filter conditions;

[0046] Monitor the jump event of the data list page;

[0047] Whether the page being redirected is a sub-page;

[0048] Read the filter condition object of the page;

[0049] Traverse the filter condition object and copy the cache object <page route name>-save-form;

[0050] Check whether the filter condition object of the current page exists in the indexedDB database;

[0051] If not, the filter condition object is inserted into the indexedDB database;

[0052] Enter the subpage, set the value of the variable save-flag to true (the default value is false), indicating that there is a cache, and monitor the page route return method;

[0053] The child page returns, carrying the save-flag value, and returns to the parent page for reading;

[0054] Determine whether the save-flag value is true;

[0055] Read the object of <page route name>-save-form in the indexedDB database, and traverse and assign the object back to the filter box;

[0056] Perform a filter query.

[0057] See also Figure 2 , which shows a structural block diagram of a cache screening condition system based on browser indexedDB of the present application.

[0058] like Figure 2 As shown, the cache screening condition system 200 includes a creation module 210 , a screening module 220 , a first judgment module 230 , an insertion module 240 , an assignment module 250 , a second judgment module 260 and an acquisition module 270 .

[0059] Among them, the creation module 210 is configured to create an indexedDB cache database and generate a save_form table for storing filtering conditions in the indexedDB cache database; the filtering module 220 is configured to obtain at least one page jump event in the jump process of the data management page, and filter out the target page jump event including the jump to the subpage in the at least one page jump event; the first judgment module 230 is configured to read the filtering condition object of the current page corresponding to the target page jump event, and judge whether the filtering condition object of the current page exists in the indexedDB cache database; the insertion module 240 is configured to insert the filtering condition object of the current page into the save_form of the indexedDB cache database if it does not exist. rm table, and enter the sub-page; an assignment module 250 is configured to assign a value of true to the variable save_flag with a default value of false in the sub-page after entering the sub-page, so as to record that the filter condition cache needs to be read after the sub-page returns to the parent page; a second judgment module 260 is configured to return save_flag together when the sub-page returns to the parent page, and read the value of save_flag in the parent page to determine whether the value of save_flag is true; an acquisition module 270 is configured to, if yes, open the save_form table in the indexedDB cache database, and read the page routing name corresponding to the sub-page in the save_form table, and obtain the filtering condition according to the page routing name.

[0060] It should be understood that Figure 2 Modules and references documented in Figure 1 Therefore, the operations and features described above for the method and the corresponding technical effects are also applicable to Figure 2 The modules in it will not be described in detail here.

[0061] In some other embodiments, the embodiments of the present invention further provide a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor executes the cache screening condition method based on browser indexedDB in any of the above method embodiments;

[0062] As an implementation mode, the computer-readable storage medium of the present invention stores computer-executable instructions, and the computer-executable instructions are configured as follows:

[0063] Create an indexedDB cache database, and generate a save_form table for storing screening conditions in the indexedDB cache database;

[0064] Acquire at least one page jump event in the jump process of the data management page, and filter out a target page jump event including a jump to a subpage from the at least one page jump event;

[0065] Reading the filter condition object of the current page corresponding to the target page jump event, and determining whether the filter condition object of the current page exists in the indexedDB cache database;

[0066] If it does not exist, insert the filter condition object of the current page into the save_form table of the indexedDB cache database and enter the sub-page;

[0067] After entering the sub-page, assign a value of true to the variable save_flag whose default value is false in the sub-page, so as to record that the sub-page needs to read the filter condition cache after returning to the parent page;

[0068] When the child page returns to the parent page, the save_flag is returned together, and the value of the save_flag is read in the parent page to determine whether the value of the save_flag is true;

[0069] If so, the save_form table in the indexedDB cache database is opened, and the page routing name corresponding to the sub-page is read from the save_form table, and the filtering condition is obtained according to the page routing name.

[0070] The computer-readable storage medium may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created based on the use of a cache filter condition system based on a browser indexedDB, etc. In addition, the computer-readable storage medium may include a high-speed random access memory, and may also include a memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the computer-readable storage medium may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the cache filter condition system based on the browser indexedDB via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0071] Figure 3 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Figure 3 As shown, the device includes: a processor 310 and a memory 320. The electronic device may also include: an input device 330 and an output device 340. The processor 310, the memory 320, the input device 330 and the output device 340 may be connected via a bus or other means. Figure 3 In the example, the connection through the bus is taken as an example. The memory 320 is the above-mentioned computer-readable storage medium. The processor 310 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 320, that is, the cache screening condition method based on the browser indexedDB of the above-mentioned method embodiment is implemented. The input device 330 can receive input digital or character information, and generate key signal input related to user settings and function control of the cache screening condition system based on the browser indexedDB. The output device 340 may include display devices such as display screens.

[0072] The electronic device can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.

[0073] As an implementation mode, the electronic device is applied to a cache screening condition system based on browser indexedDB, and is used for a client, comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can:

[0074] Create an indexedDB cache database, and generate a save_form table for storing screening conditions in the indexedDB cache database;

[0075] Acquire at least one page jump event in the jump process of the data management page, and filter out a target page jump event including a jump to a subpage from the at least one page jump event;

[0076] Reading the filter condition object of the current page corresponding to the target page jump event, and determining whether the filter condition object of the current page exists in the indexedDB cache database;

[0077] If it does not exist, insert the filter condition object of the current page into the save_form table of the indexedDB cache database and enter the sub-page;

[0078] After entering the sub-page, assign a value of true to the variable save_flag whose default value is false in the sub-page, so as to record that the sub-page needs to read the filter condition cache after returning to the parent page;

[0079] When the child page returns to the parent page, the save_flag is returned together, and the value of the save_flag is read in the parent page to determine whether the value of the save_flag is true;

[0080] If so, the save_form table in the indexedDB cache database is opened, and the page routing name corresponding to the sub-page is read from the save_form table, and the filtering condition is obtained according to the page routing name.

[0081] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.

[0082] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A cache screening method based on browser indexedDB, characterized in that: include: Creating an indexedDB cache database, and generating a save_form table for storing filtering conditions in the indexedDB cache database, wherein creating an indexedDB cache database, and generating a save_form table for storing filtering conditions in the indexedDB cache database includes: Generate an indexedDB cache database according to the browser's own command window.indexedDB.open(), and create a save_form table for storing screening conditions in the indexedDB cache database; Acquire at least one page jump event in the jump process of the data management page, and filter out a target page jump event including a jump to a subpage from the at least one page jump event; Reading the filter condition object of the current page corresponding to the target page jump event, and determining whether the filter condition object of the current page exists in the indexedDB cache database; If it does not exist, insert the filter condition object of the current page into the save_form table of the indexedDB cache database and enter the sub-page; After entering the sub-page, assign a value of true to the variable save_flag whose default value is false in the sub-page, so as to record that the sub-page needs to read the filter condition cache after returning to the parent page; When the child page returns to the parent page, the save_flag is returned together, and the value of the save_flag is read in the parent page to determine whether the value of the save_flag is true; If so, the save_form table in the indexedDB cache database is opened, and the page routing name corresponding to the sub-page is read from the save_form table, and the filtering condition is obtained according to the page routing name.

2. A cache screening method based on browser indexedDB according to claim 1, characterized in that: The acquiring of at least one page jump event in the jump process of the data management page, and filtering out a target page jump event including a jump to a subpage from the at least one page jump event comprises: Acquire at least one route jump event in the jump process of the data management page, wherein the route in the route jump event is associated with the page; A target route jump event in which the current route jumps to a sub-route is screened out from the at least one route jump event, and a target page jump event in which the current page jumps to a sub-page associated with the sub-route is obtained through the association relationship between the route and the page.

3. The cache screening method based on browser indexedDB according to claim 1, characterized in that: After determining whether there is a screening condition object for the current page in the indexedDB cache database, the method further includes: If it exists, delete the filter condition object of the current page.

4. The cache screening method based on browser indexedDB according to claim 1, characterized in that: Inserting the filter condition object of the current page into the indexedDB cache database includes: Perform attribute traversal on the filter condition object of the current page, read all attribute values ​​and the specific filter value of the current page, generate a new object with the traversed attribute name and attribute value, and insert the new object into the save_form table of the indexedDB cache database as a key-value pair, where the key is <page route name>_save_form.

5. The cache screening method based on browser indexedDB according to claim 1, characterized in that: After determining whether the value of the save_flag is true, the method further includes: If not, then continue to determine whether the value of save_flag corresponding to the next child page is true when the next child page returns to the parent page.

6. A cache screening condition system based on browser indexedDB, characterized in that: include: A creation module is configured to create an indexedDB cache database, and generate a save_form table for storing filtering conditions in the indexedDB cache database, wherein the creation of the indexedDB cache database and the generation of the save_form table for storing filtering conditions in the indexedDB cache database include: Generate an indexedDB cache database according to the browser's own command window.indexedDB.open(), and create a save_form table for storing screening conditions in the indexedDB cache database; A screening module, configured to obtain at least one page jump event in the jump process of the data management page, and screen out a target page jump event including a jump to a subpage from the at least one page jump event; A first judgment module is configured to read the filter condition object of the current page corresponding to the target page jump event, and judge whether the filter condition object of the current page exists in the indexedDB cache database; An insertion module is configured to insert the filter condition object of the current page into the save_form table of the indexedDB cache database if it does not exist, and enter the sub-page; An assignment module is configured to assign a value of true to a variable save_flag whose default value is false in the sub-page after entering the sub-page, so as to record that the sub-page needs to read the filter condition cache after returning to the parent page; A second judgment module is configured to return the save_flag together when the child page returns to the parent page, and read the value of the save_flag in the parent page to judge whether the value of the save_flag is true; The acquisition module is configured to, if yes, open the save_form table in the indexedDB cache database, read the page routing name corresponding to the sub-page in the save_form table, and obtain the screening condition according to the page routing name.

7. An electronic device, characterized in that: include: At least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Page display method and device, storage medium and electronic equipment

    CN115080154A

  • 3d Internet of Vehicles visual management method and system based on web browser cache

    CN116112561A