CN112800303A - Browser data storage and reading method and related device - Google Patents

Browser data storage and reading method and related device Download PDF

Info

Publication number
CN112800303A
CN112800303A CN201911107650.5A CN201911107650A CN112800303A CN 112800303 A CN112800303 A CN 112800303A CN 201911107650 A CN201911107650 A CN 201911107650A CN 112800303 A CN112800303 A CN 112800303A
Authority
CN
China
Prior art keywords
data
stored
storage
local
value
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
CN201911107650.5A
Other languages
Chinese (zh)
Other versions
CN112800303B (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.)
Mashang Xiaofei Finance Co Ltd
Original Assignee
Mashang Xiaofei Finance 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 Mashang Xiaofei Finance Co Ltd filed Critical Mashang Xiaofei Finance Co Ltd
Priority to CN201911107650.5A priority Critical patent/CN112800303B/en
Publication of CN112800303A publication Critical patent/CN112800303A/en
Application granted granted Critical
Publication of CN112800303B publication Critical patent/CN112800303B/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/951Indexing; Web crawling techniques
    • 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/953Querying, e.g. by the use of web search engines
    • 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

Abstract

The application discloses a browser data storage and reading method and a related device, wherein the storage method comprises the following steps: receiving a storage request from a browser, wherein the storage request comprises a name, a value and a storage path of data to be stored; reading currently stored local data from a local storage, and adding the name, the value and the storage path of the data to be stored into the currently stored local data as storage information of the data to be stored to obtain updated local data; and storing the updated local data into a local storage, wherein the data to be stored is stored in the local data according to the storage path in the storage request. According to the technical scheme, a large storage space can be provided for storing the browser data, data can be stored in the local data according to the set storage path, and flexible data storage in the local storage is achieved.

Description

Browser data storage and reading method and related device
Technical Field
The present application relates to the field of browser technologies, and in particular, to a method and a device for storing and reading browser data.
Background
With the exponential increase of the richness of the content of the browser application program, more and more programs at the original desktop end are transplanted to the browser end, but with the challenge of data interaction and storage, large data storage and faster data transmission are needed to improve the performance of the browser application program, such as first-screen rendering time and the like. In the HTML4 era, data related to a user is generally stored by a cookie, but the cookie has a small storage space and is transmitted by default along with an http request, which causes a waste of bandwidth, so that a technical scheme capable of improving the data storage performance and the user experience of a browser is required.
Disclosure of Invention
The technical problem mainly solved by the application is to provide a browser data storage and reading method and a related device, which can realize large-space storage of browser data and improve flexibility of data storage.
In order to solve the technical problem, the application adopts a technical scheme that: a storage method of browser data is provided, which comprises the following steps:
receiving a storage request from a browser, wherein the storage request comprises a name, a value and a storage path of data to be stored;
reading currently stored local data from a local storage, and adding the name, the value and the storage path of the data to be stored into the currently stored local data as storage information of the data to be stored to obtain updated local data;
and storing the updated local data into the local storage, wherein the data to be stored is stored in the local data according to a storage path in the storage request.
In order to solve the above technical problem, another technical solution adopted by the present application is to provide a method for reading browser data, where the method includes:
receiving a reading request from a browser, wherein the reading request comprises a data name to be read;
obtaining local data from a local store;
acquiring a corresponding stored data value from the local data according to the data name and the associated path of the browser;
and feeding back the acquired value to the browser.
In order to solve the above technical problem, another technical solution adopted by the present application is to provide an electronic device, including a memory and a processor coupled to each other, wherein,
the memory includes local storage and stores a computer program;
the processor is configured to run the computer program to perform the method as described in any of the above.
In order to solve the above technical problem, according to another technical solution of the present application, a storage device is provided, which stores a computer program capable of being executed by a processor, and the computer program is used for implementing the method according to any one of the above.
According to the technical scheme provided by the application, after the storage request from the browser is received, the currently stored local data is read from the local storage, and the name, value and storage path of the data to be stored are used as the storage information of the data to be stored and added into the currently stored local data according to the storage path in the storage request to obtain the updated local data, compared with the prior art, the technical scheme of the application can provide a larger storage space for storing the browser data by adopting the local storage, and can also store the data in the local data according to the storage path set by the user, and then data storage is carried out in the local storage based on the relative path, the flexibility of the data storage in the local storage is improved, and the limitation of the local storage mode of the browser is further optimized.
Drawings
Fig. 1 is a schematic flowchart of an embodiment of a method for storing browser data according to the present application;
FIG. 2 is a flowchart illustrating an embodiment of a method for storing browser data according to the present application;
fig. 3 is a schematic structural diagram of an embodiment of a data structure of a method for storing browser data according to the present application;
FIG. 4 is a flowchart illustrating a browser data storage method according to another embodiment of the present application;
FIG. 5 is a flowchart illustrating a method for storing browser data according to yet another embodiment of the present disclosure;
fig. 6 is a schematic flowchart illustrating an embodiment of a method for reading browser data according to the present application;
FIG. 7 is a schematic structural diagram of an embodiment of an electronic device of the present application;
fig. 8 is a schematic structural diagram of an embodiment of a memory device according to the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. 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 application.
In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless explicitly specifically limited otherwise. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
Before proceeding to the explanation of the technical solutions provided in the present application, first, the key terms or technical abbreviations mentioned in the specification of the present application are explained:
localstorage: a browser local storage object, the stored data of which can be preserved across browser sessions;
localdata: local data for storing data is integrally stored in a Localstorage;
cookie: a text string handle sent to a client browser and stored on the client's hard disk, which can be used to persist data between certain browser site sessions;
origin: the source concept in the browser consists of three parts, namely a protocol, a host and a port.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating an embodiment of a method for storing browser data according to the present application. In the present embodiment, an execution subject of the method provided by the present application is a server device, and the method provided by the present application includes:
s110: a storage request is received from a browser.
In the process of operating the browser program, when there is data that needs to be stored, or when a user needs to store the data, a storage request may be sent to the server device through the browser program, so that the data that needs to be stored is stored in a local storage (in other embodiments, the local storage is also defined as a localstorage) in the server device. In the following description of the technical solution provided by the present application, the browser program is referred to as a browser for short, and the server device running the browser is referred to as a browser device for short.
It should be noted that, in the current embodiment, the user may specify the browser to send the storage request to the server device according to a requirement of the user, or may preset a trigger condition for the browser to send the storage request to the outside, and the storage request is sent to the server device according to the trigger condition that is just met with the set trigger condition in the current browser operation process. It should be understood that the triggering condition for the browser to send the storage request is not limited at all, and may be specifically set and changed according to actual needs, for example, the triggering condition may be triggered to send the storage request when the browser reads a set key field.
The storage request comprises the name, the value and the storage path of the data to be stored. The name of the data to be stored is determined according to the type of the data to be stored, the value of the data to be stored is the specific content of the data to be stored, for example, when the data to be stored is a certain part of content on a website, the name of the data to be stored may be the name of the website or the website address of the website, and correspondingly, the value of the data to be stored is the content on the website or the result obtained after data processing is performed on at least part of the content on the website.
The storage path of the data to be stored is used for indicating the specific position of the localdata for storing the data to be stored in the localstorage, namely the address of the data to be stored in the localdata. In some embodiments, the storage path of the data to be stored can be introduced through the configuration item option, and when the storage path of the data to be stored is not specified, the default root path in the configuration item option is set as the storage path of the data to be stored. In another embodiment, when the data to be stored is a report article, the name of the data to be stored is the title of the report article, and the value of the data to be stored may be set to the title and the full text of the report article, or the browsing times, the file size, the source link, and the like of the report article.
Further, in another embodiment, when the user does not set the storage path, the storage path in the storage request is a root path of the browser, so the storage request at this time still includes the name of the data to be stored, the value of the data to be stored, and the storage path of the data to be stored. The root path of the browser is a default storage path set by a system, and when a user does not particularly set the storage path of the data to be stored, the root path is directly set as the storage path of the data to be stored.
S120: and reading the currently stored local data from the local storage, and adding the name, the value and the storage path of the data to be stored into the currently stored local data as storage information of the data to be stored so as to obtain updated local data.
After receiving a storage request from a browser, reading currently stored local data from a local storage, adding the name, value and storage path of the data to be stored into the currently stored local data as storage information of the data to be stored to obtain updated local data, and storing the updated local data into the local storage to realize the storage of the data to be stored into the local storage. In some embodiments, the local data is not stored in the local storage by the concept of a storage path, and the local data cannot be stored in the local storage according to different path structures, that is, when the local data is stored in the local storage, the local data can only be stored to a fixed position in the local storage according to the setting of the system.
Further, please refer to fig. 2, and fig. 2 is a schematic flowchart illustrating another embodiment of a method for storing browser data according to the present application. Specifically shown in fig. 2 is step S120 illustrated in fig. 1: and adding the name, the value and the storage path of the data to be stored into the currently stored local data as the storage information of the data to be stored. In the present embodiment, step S120 includes steps S201 to S204.
S201: the local data is read from the local storage.
Firstly, after a storage request which is sent by a browser and at least comprises a name of data to be stored and a value of the data to be stored is received, reading at least one piece of local data from a local storage to judge whether the current data to be stored exists in the local data. When the local data in the local storage includes a plurality of local data, and each local data in the local storage is divided according to the set rule, the local data read in step S201 is at least the local data corresponding to the current browser. In the current embodiment, it is not limited that one browser corresponds to one local data, nor that one local data corresponds to only one browser.
Further, in another embodiment, when the storage request includes the name of the data to be stored, the value of the data to be stored, and the storage path, the local data is read from the local storage according to at least one of the name of the data to be stored, the value of the data to be stored, and the storage path, so as to determine whether the current data to be stored already exists in the local data.
Furthermore, when the local data in the local storage is divided according to the set rule, the local data may also be read according to the set rule. For example, when the local data in the local storage is divided according to the correspondence of different browsers, the name or address of the current browser can be determined from the storage request sent by the browser, and then the local data corresponding to the current browser can be directly read according to the read name or address of the browser. When the local data is divided according to the browser, it can be understood that one browser may correspond to at least one local data, and in step S201, the plurality of local data may be read from the local storage, or the local data may be sequentially read from the local storage to determine whether there is data to be stored in the read local data.
S202: and judging whether the currently stored local data has data to be stored.
After reading the corresponding local data, further judging whether the read local data has data to be stored so as to avoid the situation of repeated storage. In the present embodiment, step S202 is to determine whether there is data with the same name as the data to be stored in the currently stored local data, and it is not required that there is one data with the same content as all the data to be stored in the local data, so step S202 may also be understood as determining whether there is stored data with the same name as the data to be stored in the currently stored local data, so as to avoid repeatedly storing the data with the same name.
Further, the step S202 of determining whether there is data to be stored in the currently stored local data includes: and judging whether the currently stored local data has the data to be stored or not by using the name and the storage path of the data to be stored.
Specifically, when the storage path in the storage request is not the root path but a storage path set by the user, the location corresponding to the storage path in the local data may be directly and correspondingly queried to determine whether the stored data with the same name as the data to be stored is stored under the storage path, and if the data with the same name as the data to be stored is present in the local data, it is determined that the stored data with the same name as the data to be stored is present in the currently stored local data, step S203 may be further performed.
In another embodiment, when the storage path in the storage request is a default root path, the data stored under the root path in the currently stored local data is further directly queried whether there is data with the same name as the data to be stored, so as to determine whether there is stored data with the same name as the data to be stored in the currently stored local data.
S203: and covering the storage information of the data to be stored with the storage information of the corresponding data in the currently stored local data.
And if the stored data with the same name as the data to be stored already exists in the local data under the storage path corresponding to the data to be stored, directly covering the storage information of the current data to be stored with the storage information of the corresponding stored data in the currently stored local data so as to update the storage information.
Specifically, step S203 may also be understood as correspondingly overwriting a value in the data to be stored, and then adding the storage information of the data to be stored to the local data is completed, specifically because step S203 is to overwrite the data to be stored with the stored data in the local data, which has the same name and the same path as the data to be stored, and since the name and the storage path are the same, it may also be understood as correspondingly overwriting only the value of the stored data, and then it may also be regarded that the storage information in the current embodiment at least includes the value of the data to be stored, and specifically, overwrite the value of the data to be stored with the value of the stored data in the local data, which has the same name as the data to be stored.
S204: and adding the name, the value and the storage path of the data to be stored into the currently stored local data as the storage information of the newly added data.
If it is determined in step S202 that there is no to-be-stored data in the local data corresponding to the to-be-stored data in the storage path, the name of the to-be-stored data, the value of the to-be-stored data, and the storage path of the to-be-stored data are added to the currently stored local data as storage information of the newly added data, so as to complete the data required to be stored in the storage request. Specifically, the storage information of the newly added data is added to the storage path corresponding to the data to be stored in the currently stored local data.
Further, adding the name, the value and the storage path of the data to be stored into the currently stored local data as the storage information of the newly added data, including: and adding a first key-value pair for the local data, namely adding a first key-value pair under the storage path corresponding to the data to be stored in the local data.
In the updated local data, the storage path of the data to be stored is used as a key of the first key-value pair, and the name and the value of the data to be stored are used as the value of the first key-value pair to form the first key-value pair.
The key of the first key-value pair is a storage path of the data to be stored, and the value of the first key-value pair is the name and the value of the data to be stored. For example, if the name of the data to be stored included in the storage request is "a 1", the value of the data to be stored is "B1", and the storage path is "C1", then in the current embodiment, the key of the first key-value pair is the storage path of the data to be stored "C1", and the value in the first key-value pair includes the name of the data to be stored "a 1" and the value of the data to be stored "B1".
Further, the name and value of the data to be stored constitute a second key-value pair as the value of the first key-value pair. And the key of the second key-value pair is the name of the data to be stored, and the value of the second key-value pair is the value of the data to be stored.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an embodiment of a data structure of a method for storing browser data according to the present application. In the current embodiment, the structure of the first Key-Value pair 300 is specifically illustrated, and the first Key-Value pair 300 includes a Key 310 and a Value 320, where the Key (Key illustrated in fig. 3) of the first Key-Value pair 300 is a storage path of data to be stored, the Value (Value illustrated in fig. 3) of the first Key-Value pair 300 may be a second Key-Value pair, the Key (Key 1 illustrated in fig. 3) of the second Key-Value pair is a name of the data to be stored, and the Value (Value 1 illustrated in fig. 3) of the second Key-Value pair is a Value of the data to be stored.
Such as: the name of the data to be stored included in the storage request is "a 1", the Value of the data to be stored is "B1", the storage path is "C1", the Key of the first Key-Value pair 300 may be the storage path of the data to be stored "C1", the Value of the first Key-Value pair includes a second Key-Value pair 320, the second Key-Value pair includes a Key and a Value, the Key of the second Key-Value pair is the name of the data to be stored "a 1", and the Value of the second Key-Value pair is the Value of the data to be stored "B1".
In other embodiments, when it is determined that stored data having the same name as the data to be stored exists in the local data corresponding to the storage path of the data to be stored, the step "overwriting the storage information of the stored data with the storage information of the corresponding data in the local data" may be understood as: and correspondingly covering the value of the second key value pair in the first key value pair with the same name as the data to be stored by using the value of the data to be stored, namely covering the value of the second key value pair with the same name as the data to be stored by using the value of the data to be stored.
It should be noted that the local data, the first key-value pair, the value of the first key-value pair, and the second key-value pair are all objects. The local data, the first key value pair, the value of the first key value pair, or the second key value may be objects at different levels, specifically, the local storage may include a plurality of local data, one local data may include a plurality of first key value pairs, and when the first key value pair includes the second key value pair, one first key value pair may include a plurality of second key value pairs. In the localdata, a storage path of data to be stored is used as a key of a sub-object in local data, a corresponding value and a name of the data to be stored are contained in one object as a whole, the whole is used as a value of the sub-object, and the data to be stored is stored according to a storage path identifier when being stored to the local data, so that the data can be obtained according to the storage path identifier when being obtained, and the problem that the local storage cannot be stored according to the path in the prior art is solved.
Furthermore, when the value in the first key value pair is the second key value pair and it is determined that there is data with the same name as the data to be stored in the local data, step S203 overwrites the storage information of the data to be stored with the storage information of the corresponding data in the currently stored local data, including: and updating the value of the second key value pair of the corresponding data in the currently stored local data to the value of the data to be stored, wherein the corresponding data is stored data with the same data name as the data name to be stored. Because the name of the corresponding data in the local data is the same as the data to be stored, and the storage path is also the same as the storage path of the data to be stored, the data can be updated and stored only by covering the value of the data to be stored with the value of the second key value pair in the corresponding data in the local data.
S130: and storing the updated local data into a local storage, wherein the data to be stored is stored in the local data according to the storage path in the storage request.
After the name, the value and the storage path of the data to be stored are stored in the local data according to the storage path of the data to be stored to obtain the updated local data, the obtained local data is further stored in the local storage, that is, the local data to which the name of the data to be stored, the value of the data to be stored and the storage path are added is stored in the local storage, and the storage of the data to be stored is completed.
In the embodiment illustrated in fig. 1, the name, the value, and the storage path of the data to be stored are added to the local data according to the storage path in the storage request by using the name, the value, and the storage path of the data to be stored as the storage information of the data to be stored, so that data storage can be performed in the local data according to the storage path set by the user. In the whole technical scheme, the storage of the relative path of the local data is added in the local storage, so that a user can store the local data according to the expected path of the user, the data is stored in the local storage based on the relative path, and the limitation of the local storage mode of the browser is further optimized.
Compared with the prior art that the storage path of the data is only an origin path and cannot be correspondingly stored based on different paths, the technical scheme provided by the application can store the data in the local data under the corresponding sub-path according to the structure of the sub-path included in the web application, and compensates the defect that the local data can only be stored to a fixed position in the local storage according to the setting of the system in the prior art, so that the flexibility of storing the data in the local storage is improved.
Referring to fig. 4, fig. 4 is a schematic flowchart illustrating a browser data storage method according to another embodiment of the present application. In the present embodiment, the above steps add the name, value and storage path of the data to be stored as storage information of the new data to the currently stored local data, and further include steps S401 to S403.
S401: and judging whether a first key value pair taking the storage path as a key exists in the currently stored local data.
Before adding a first key-value pair to the local data, firstly, judging whether the currently stored local data has the first key-value pair taking the storage path of the currently to-be-stored data as a key. Specifically, the keys of each first key-value pair in the local data are sequentially read, whether the keys of each first key-value pair are the same as the storage path of the data to be stored is sequentially judged, if the keys of each first key-value pair are judged to be different from the storage path of the data to be stored, it is judged that the first key-value pair taking the storage path of the data to be stored as a key does not exist in the local data, and step S402 is executed; otherwise, when the key of a certain first key-value pair in the local data is determined to be the same as the storage path of the data to be stored, the first key-value pair with the storage path as the key is determined to have been stored in the local data, and step S403 is executed. Since the key of the first key-value pair included in the local data is the corresponding storage path of the stored data, and the storage path may be a path stored into the local data specified by the user or an automatically default path, it may also be understood in step S401 that it is determined whether the local data already stores the same data record as the path of the data to be stored.
S402: and taking the storage path of the data to be stored as a key of the first key-value pair, taking the name and the value of the data to be stored as the value of the first key-value pair to form a new first key-value pair, and adding the new first key-value pair into the currently stored local data.
And if the first key value pair taking the storage path as the key does not exist in the currently stored local data, taking the storage path of the data to be stored as the key of the first key value pair, taking the name and the value of the data to be stored as the value of the first key value pair to form a new first key value pair, and adding the new first key value pair into the currently stored local data.
S403: and taking the name and the value of the data to be stored as new values of the existing first key value pair, and adding the new values into the existing first key value pair.
And taking the name and the value of the data to be stored as a new value of the existing first key value pair, and adding the new value into the existing first key value pair, wherein the new value refers to the value newly added into the first key value pair. Step S403 may be understood as adding a new value to the first key value pair using the storage path as the key if it is determined that the first key value pair using the storage path as the key exists in the local data, where the added value is the name and the value of the data to be stored, so as to form a new value in the first key value pair using the storage path as the key.
In an embodiment, when the value in the first key value pair is the second key value pair, step S403 may also be understood as an added second key value pair in the first key value pair that uses the storage path of the data to be stored as a key, where the added key in the second key value pair is the name of the data to be stored, and the added value in the second key value pair is the value of the data to be stored.
In the embodiment corresponding to fig. 4 of the present application, by determining whether a first key-value pair using a storage path as a key exists in currently stored local data, and then selecting a specific manner of adding a new first key-value pair according to a determination result, space in the local data is reasonably utilized, and thus, the utilization rate of local storage is improved.
Referring to fig. 5, fig. 5 is a schematic flowchart illustrating a browser data storage method according to another embodiment of the present application. In the present embodiment, the method for storing browser data provided by the present application includes steps S501 to S505.
S501: a storage request is received from a browser.
S502: and adding the name, the value and the storage path of the data to be stored into the local data as storage information of the data to be stored.
S503: and storing the updated local data into a local storage.
Steps S501 to S503 in the current embodiment are the same as steps S110 to S130 illustrated in fig. 1, and for details, refer to the description of the corresponding parts above, and are not repeated herein. In the current embodiment, after the step S503 stores the updated local data in the local storage, the method provided by the present application further includes a step S504 and a step S505.
S504: whether the storage space range of the local storage is abnormal is detected.
After the local data is stored in the local storage, whether the storage space in the local storage is abnormal or not is further detected, specifically, whether the remaining storage space in the local storage is smaller than or equal to a set threshold or not is detected, when the remaining storage space in the local storage is detected to be smaller than or equal to the set threshold, it is obtained that the range of the storage space in the local storage is abnormal, otherwise, it is obtained that the range of the storage space in the current local storage is not abnormal.
The set threshold may be zero, and when the set threshold is zero, step S504 is used to detect whether the local storage has a remaining storage space, and when the set threshold is set to a smaller value according to the actual requirement, step S504 is substantially used to detect whether the storage space in the local storage can support the system to operate at a relatively higher speed. The set threshold may be set according to the performance of the server device and the requirements of the actual application, and is not limited herein.
S505: and clearing the data in the local storage, and storing the updated local data into the local storage again.
And if the storage space range of the local storage is detected to be abnormal, clearing the data in the local storage, and then storing the updated local data into the local storage again.
In the current embodiment, after the local data is stored in the local storage, by further detecting whether the storage space of the local storage is abnormal, emptying the data in the local storage after detecting that the storage space of the local storage is abnormal, and then storing the local data in the local storage again, the situation that the storage space in the local storage is overflowed or abnormal can be better solved, and the blank of processing when the storage space in the local storage is overflowed in the prior art is made up, so that the local storage (localstorage) has a wider application scene, and the abnormal situation that the system operation becomes sluggish due to too little residual storage space of the local storage is also avoided.
Referring to fig. 6, fig. 6 is a schematic flowchart illustrating an embodiment of a method for reading browser data according to the present application. In the current embodiment, the method provided by the present application includes:
s601: a read request is received from a browser.
The reading request comprises a data name to be read. And receiving a reading request sent by the browser, and analyzing the reading request to obtain the name of the data to be read.
S602: local data is retrieved from a local store.
And acquiring corresponding local data from the local storage to acquire the data to be read and the corresponding value thereof from the local data. In the present embodiment, the local storage includes at least one local data.
When the local storage comprises a plurality of local data and the local data in the local storage is divided according to the set rule, the corresponding local data can be obtained according to the set rule. If the local storage is divided according to the type of the browser, the local data of the browser corresponding to the reading request is directly searched according to the rule of local data distribution when the local data is acquired.
S603: and acquiring the value of the corresponding stored data from the local data according to the data name and the associated path of the browser.
After the local data is acquired, the data name obtained by analyzing the reading request and the associated path of the browser are acquired from the local data, and the value of the stored data is acquired from the local data. Specifically, as described above, the local data includes a plurality of first key-value pairs, the keys of the first key-value pairs are storage paths for storing the data, and the values of the first key-value pairs are names of the storage data and values of the storage data, so step S603 finds the corresponding first key-value pair in the local data according to the association path of the browser, and then reads the corresponding value from the stored data in the local data according to the name of the data to be read, thereby completing the obtaining of the value of the data to be read.
Further, the associated path of the browser is the path where the browser program is located. Further, according to the data name and the associated path of the browser, obtaining the value of the corresponding stored data from the local data, including:
and searching the stored data with the name consistent with the data name and the storage path consistent with the associated path from the local data, and acquiring the value of the stored data.
The storage path of the data to be stored in the data storage stage corresponding to the path where the browser program is located may be a storage path specified by the user, or may refer to a default root path when the user does not specify the storage path. Therefore, the stored data with the name consistent with the data name in the local data and the storage path consistent with the associated path is as follows: and the data which is stored in the local data, has the same association path between the keys in the first key value pair and the browser, and has the same name of the stored data included in the values in the first key value pair as the name of the data to be read.
S604: and feeding back the acquired value to the browser.
And after the value of the corresponding stored data is acquired from the local data, the acquired value is fed back to the browser for the browser to call or display to a user.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an embodiment of an electronic device according to the present application. In the present embodiment, the electronic device 700 provided herein includes a processor 701 and a memory 702 coupled. The electronic device 700 may be a server device that executes the method described in any one of the embodiments of fig. 1 to 6 and their counterparts.
The memory 702 includes a local storage (not shown) and stores a computer program, and the computer program implements the method described in any of the embodiments of fig. 1 to fig. 6 and the corresponding embodiments when executed.
A processor 701 is coupled to the memory 702, and the processor 701 is configured to execute a computer program to perform the method described in any of the embodiments of fig. 1 to 6 and their counterparts.
Referring to fig. 8, fig. 8 is a schematic structural diagram of an embodiment of a memory device according to the present application. The memory device 800 stores a computer program 801 that can be executed by a processor, and the computer program 801 is used for implementing the method described in any one of the embodiments of fig. 1 to 6 and corresponding embodiments thereof. Specifically, the storage device 800 may be one of a memory, a personal computer, a server, a network device, or a usb disk.
The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application or are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (11)

1. A method for storing browser data is characterized by comprising the following steps:
receiving a storage request from a browser, wherein the storage request comprises a name, a value and a storage path of data to be stored;
reading currently stored local data from a local storage, and adding the name, the value and the storage path of the data to be stored into the currently stored local data as storage information of the data to be stored to obtain updated local data;
and storing the updated local data into the local storage, wherein the data to be stored is stored in the local data according to a storage path in the storage request.
2. The method for storing browser data according to claim 1, wherein the adding the name, the value, and the storage path of the data to be stored as storage information of the data to be stored to the currently stored local data includes:
judging whether the currently stored local data has the data to be stored;
if the local data exists, the storage information of the data to be stored is covered with the storage information of the corresponding data in the currently stored local data;
and if the new data does not exist, adding the name, the value and the storage path of the data to be stored into the currently stored local data as the storage information of the newly added data.
3. The method for storing browser data according to claim 2, wherein the determining whether the data to be stored exists in the currently stored local data includes:
and judging whether the local data to be stored exists in the currently stored local data or not by using the name and the storage path of the data to be stored.
4. The method according to claim 2, wherein in the updated local data, a storage path of the data to be stored is used as a key of a first key-value pair, and a name and a value of the data to be stored are used as values of the first key-value pair to form the first key-value pair.
5. The browser data storage method according to claim 4, wherein the name and value of the data to be stored constitute a second key-value pair as the value of the first key-value pair; and the key of the second key-value pair is the name of the data to be stored, and the value of the second key-value pair is the value of the data to be stored.
6. The method for storing browser data according to claim 5, wherein the adding the name, value and storage path of the data to be stored as storage information of new data to the currently stored local data includes:
judging whether the first key value pair taking the storage path as a key exists in the currently stored local data or not;
if the local data does not exist, taking the storage path of the data to be stored as a key of a first key-value pair, taking the name and the value of the data to be stored as the value of the first key-value pair to form a new first key-value pair, and adding the new first key-value pair into the currently stored local data;
if the key value pair exists, the name and the value of the data to be stored are used as new values of the existing first key value pair, and the new values are added into the existing first key value pair;
the step of overlaying the storage information of the data to be stored on the storage information of the corresponding data in the currently stored local data includes:
and updating the value of the second key value pair of the corresponding data in the currently stored local data into the value of the data to be stored.
7. The method according to claim 1, wherein the storing the updated local data into a local storage comprises:
detecting whether the storage space range of the local storage is abnormal;
if so, emptying the data in the local storage, and storing the updated local data into the local storage again.
8. A method for reading browser data is characterized by comprising the following steps:
receiving a reading request from a browser, wherein the reading request comprises a data name to be read;
obtaining local data from a local store;
acquiring a corresponding stored data value from the local data according to the data name and the associated path of the browser;
and feeding back the acquired value to the browser.
9. The method according to claim 8, wherein the associated path of the browser is a path in which the browser program is located;
the obtaining, according to the data name and the associated path of the browser, a value of corresponding stored data from the local data includes:
and searching stored data with the name consistent with the data name and the storage path consistent with the associated path from the local data, and acquiring the value of the stored data.
10. An electronic device comprising a memory and a processor coupled, wherein,
the memory includes local storage and stores a computer program;
the processor is configured to run the computer program to perform the method of any one of claims 1 to 9.
11. A storage means, characterized in that a computer program is stored which can be run by a processor for implementing the method according to any one of claims 1-9.
CN201911107650.5A 2019-11-13 2019-11-13 Browser data storage and reading method and related device Active CN112800303B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911107650.5A CN112800303B (en) 2019-11-13 2019-11-13 Browser data storage and reading method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911107650.5A CN112800303B (en) 2019-11-13 2019-11-13 Browser data storage and reading method and related device

Publications (2)

Publication Number Publication Date
CN112800303A true CN112800303A (en) 2021-05-14
CN112800303B CN112800303B (en) 2023-05-05

Family

ID=75803384

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911107650.5A Active CN112800303B (en) 2019-11-13 2019-11-13 Browser data storage and reading method and related device

Country Status (1)

Country Link
CN (1) CN112800303B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20230409213A1 (en) * 2022-06-17 2023-12-21 Western Digital Technologies, Inc. Key Value Data Storage Device With Improved Utilization For Short Key Value Pairs

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1332879A (en) * 1998-11-02 2002-01-23 维维登斯股份有限公司 Full-service research bureau and test center method and apparatus
US20090099999A1 (en) * 2007-10-11 2009-04-16 International Business Machines Corporation Efficient delivery of cross-linked reports with or without live access to a source data repository
CN102447714A (en) * 2010-10-07 2012-05-09 鸿富锦精密工业(深圳)有限公司 Cookie management method
US20130163731A1 (en) * 2011-09-11 2013-06-27 Steven Kai-Man Yan Techniques for Customer Relationship Management
CN103294700A (en) * 2012-02-24 2013-09-11 腾讯科技(北京)有限公司 Cross-browser data local storage method and device
CN103971059A (en) * 2014-05-09 2014-08-06 中国科学院计算技术研究所 Cookie local storage and usage method
CN106406961A (en) * 2016-09-27 2017-02-15 北京奇虎科技有限公司 Method and device for loading and providing application based on browser
CN106897618A (en) * 2015-12-21 2017-06-27 珠海市君天电子科技有限公司 Webpage access method and device
CN107624180A (en) * 2015-05-15 2018-01-23 微软技术许可有限责任公司 System and method for extracting the user data relevant with sharing application program
CN108932238A (en) * 2017-05-23 2018-12-04 北京金山云网络技术有限公司 A kind of cross-domain communication method and device
CN109542961A (en) * 2018-10-19 2019-03-29 中国平安财产保险股份有限公司 Date storage method, device, computer equipment and storage medium
CN110321367A (en) * 2019-06-28 2019-10-11 北京奇艺世纪科技有限公司 A kind of date storage method, data query method and relevant apparatus, electronic equipment

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1332879A (en) * 1998-11-02 2002-01-23 维维登斯股份有限公司 Full-service research bureau and test center method and apparatus
US20090099999A1 (en) * 2007-10-11 2009-04-16 International Business Machines Corporation Efficient delivery of cross-linked reports with or without live access to a source data repository
CN102447714A (en) * 2010-10-07 2012-05-09 鸿富锦精密工业(深圳)有限公司 Cookie management method
US20130163731A1 (en) * 2011-09-11 2013-06-27 Steven Kai-Man Yan Techniques for Customer Relationship Management
CN103294700A (en) * 2012-02-24 2013-09-11 腾讯科技(北京)有限公司 Cross-browser data local storage method and device
CN103971059A (en) * 2014-05-09 2014-08-06 中国科学院计算技术研究所 Cookie local storage and usage method
CN107624180A (en) * 2015-05-15 2018-01-23 微软技术许可有限责任公司 System and method for extracting the user data relevant with sharing application program
CN106897618A (en) * 2015-12-21 2017-06-27 珠海市君天电子科技有限公司 Webpage access method and device
CN106406961A (en) * 2016-09-27 2017-02-15 北京奇虎科技有限公司 Method and device for loading and providing application based on browser
CN108932238A (en) * 2017-05-23 2018-12-04 北京金山云网络技术有限公司 A kind of cross-domain communication method and device
CN109542961A (en) * 2018-10-19 2019-03-29 中国平安财产保险股份有限公司 Date storage method, device, computer equipment and storage medium
CN110321367A (en) * 2019-06-28 2019-10-11 北京奇艺世纪科技有限公司 A kind of date storage method, data query method and relevant apparatus, electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
PANX: "手机变图库,傲游四招Hold住图片控" *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20230409213A1 (en) * 2022-06-17 2023-12-21 Western Digital Technologies, Inc. Key Value Data Storage Device With Improved Utilization For Short Key Value Pairs
US11853564B1 (en) * 2022-06-17 2023-12-26 Western Digital Technologies, Inc. Key value data storage device with improved utilization for short key value pairs

Also Published As

Publication number Publication date
CN112800303B (en) 2023-05-05

Similar Documents

Publication Publication Date Title
US11720225B2 (en) Method and apparatus for managing notification bar message
US11870673B2 (en) Intercepting and examining a packet header or trailer
US20200228590A1 (en) Application Sharing Method and Apparatus
US8126963B1 (en) System and method for adding dynamic information to digitally signed mobile applications
CN113938456B (en) Session message overhead processing method and device
EP3623942A1 (en) Message processing method and apparatus, storage medium, and computer device
US20190190968A1 (en) Method for Migrating Data and Terminal
US8943164B2 (en) Apparatus and methods for retrieving/ downloading content on a communication device
US9503499B1 (en) Concealing latency in display of pages
CN108090079B (en) Chat record processing method and device of instant chat tool
CN106888236B (en) Session management method and session management device
US20070220083A1 (en) Estimation of initial dynamic rendering control data
CN107656768B (en) Method and system for controlling page jump
US9112827B2 (en) Determining appropriate browsing applications for selected network resources
CN108334516B (en) Information pushing method and device
US20120054598A1 (en) Method and system for viewing web page and computer Program product thereof
CN107943921B (en) Page sharing information generation method and device, computer equipment and storage medium
CN110347578B (en) Application testing method and device and storage medium
CN112800303A (en) Browser data storage and reading method and related device
CN112565238A (en) Method for popping privacy policy, client and computer-readable storage medium
US8296645B2 (en) Jump destination site determination method and apparatus, recording medium with jump destination site determination program recorded thereon
CN114385951A (en) Site content management method and device, computer equipment and storage medium
CN110069731B (en) Data processing method and device, electronic equipment and computer readable storage medium
CN111382038B (en) Method, device, electronic equipment and storage medium for reporting service data
JP2023541707A (en) Process control method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant