CN112800303B - 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
CN112800303B
CN112800303B CN201911107650.5A CN201911107650A CN112800303B CN 112800303 B CN112800303 B CN 112800303B CN 201911107650 A CN201911107650 A CN 201911107650A CN 112800303 B CN112800303 B CN 112800303B
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.)
Active
Application number
CN201911107650.5A
Other languages
Chinese (zh)
Other versions
CN112800303A (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

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a storage and reading method and a related device of browser data, 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 the current stored local data from the local storage, and adding the name, the value and the storage path of the data to be stored as the storage information of the data to be stored into the current stored local data 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 a storage path in the storage request. The technical scheme provided by the application can provide a larger storage space for storing the browser data, and can also store the data in the local data according to the set storage path, so that the flexible storage of the data in the local storage is realized.

Description

Browser data storage and reading method and related device
Technical Field
The present disclosure relates to the field of browser technologies, and in particular, to a method and an apparatus for storing and reading browser data.
Background
With the exponential growth of the richness of browser application program content, more and more programs at the original desktop end are transplanted to the browser end, but with the challenges 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 era of HTML4, data related to a user is generally stored through a cookie, but the cookie has a small storage space and is transmitted together with an http request by default, so that bandwidth is wasted, and a technical scheme capable of improving data storage performance and user experience of a browser is needed.
Disclosure of Invention
The technical problem that this application mainly solves is to provide a browser data's storage, reading method and relevant device, can realize the great space storage of browser data, and improve the flexibility of data storage.
In order to solve the technical problems, one technical scheme adopted by the application is as follows: the method for storing browser data 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 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 as the storage information of the data to be stored into the currently stored local data 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 a storage request.
In order to solve the above technical problems, another technical solution adopted in 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;
acquiring local data from local storage;
acquiring a corresponding value of stored data 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 in the present application is to provide an electronic device, which includes 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 of any of the above.
In order to solve the above technical problem, another technical solution adopted in the present application is to provide a storage device, where a computer program capable of being executed by a processor is stored, where the computer program is configured to implement a method as set forth in any one of the above claims.
According to the technical scheme, after a storage request from a browser is received, the currently stored local data is read from the local storage, the name, the value and the storage path of the data to be stored are used as 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, so that updated local data are obtained, and then the updated local data are stored into the local storage.
Drawings
FIG. 1 is a flow chart illustrating an embodiment of a method for storing browser data according to the present application;
FIG. 2 is a flow chart illustrating an embodiment of a method for storing browser data according to the present application;
FIG. 3 is a schematic diagram illustrating 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 method for storing browser data according to another embodiment of the present application;
FIG. 5 is a flowchart illustrating a method for storing browser data according to another embodiment of the present disclosure;
FIG. 6 is a flowchart illustrating a method for reading browser data according to an embodiment of the present disclosure;
FIG. 7 is a schematic diagram of an electronic device according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a memory device according to an embodiment of 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 for purposes of illustration only and are not limiting. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
In the description of the present application, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may 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 may be included in at least one embodiment of the present application. The appearances of such phrases 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. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
Before proceeding to the description of the technical solutions provided in this application, the key terms or technical abbreviations mentioned in the description of this application are first explained:
localstorage: a browser locally stores objects whose stored data can be preserved across browser sessions;
localdata: the local data for storing data is integrally stored in the localtorage;
cookie: a text string handle sent to a client browser and stored on the client's hard disk may be used to persist data between certain browser site sessions;
origin: the concept of source in browser consists of protocol, host and port.
Referring to fig. 1, fig. 1 is a flowchart illustrating an embodiment of a method for storing browser data according to the present application. In the current embodiment, the execution subject of the method provided in the present application is a server device, and the method provided in the present application includes:
s110: a storage request from a browser is received.
When there is data to be stored in the running process of the browser program, 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 to be stored is stored in a local store (in other embodiments, the local store is defined as a localtorage) in the server device. The server device is a device for running a browser program, at least includes a processor and a memory, which are coupled, and at least one browser program can be run, and in the process of describing the technical scheme provided in the application, the browser program is simply called a browser, and the server device for running the browser is simply called a browser device.
In the present embodiment, the user may specify the browser to send the storage request to the server device according to the own requirement, or may set a trigger condition of the browser to send the storage request to the outside in advance, and send the storage request to the server device in the current running process of the browser just in accordance with the set trigger condition. It can be understood that the triggering condition of the browser for sending the storage request is not limited, and can be specifically set and changed according to actual needs, for example, the browser can be triggered to send the storage request when reading the set key field.
Wherein the storage request includes a name, a value, and a storage path of the data to be stored. The name of the data to be stored is specifically determined according to the type of the data to be stored, the value of the data to be stored is specific content of the data to be stored, for example, when the data to be stored is a content of a certain part of a website, the name of the data to be stored can be the name of the website or the website address of the website, and the value of the data to be stored is the content of the website or a result obtained after data processing is performed on at least a part of the content of the website.
The storage path of the data to be stored is used for indicating that the data to be stored is stored in a specific position in localata in localtorage, namely, the address of the data to be stored in localata. In some embodiments, the storage path of the data to be stored may be imported through the option of the configuration item, and when the storage path of the data to be stored is not specified, the default root path in the option of the configuration item is set as the storage path of the data to be stored. In still other embodiments, 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, the value of the data to be stored may be set to the title and the whole text of the report article, or the browsing times, the file size, the source links, etc. of the report article, and when the report article has no title, the first few preset words of the report article may be set as the name of the data to be stored according to the setting, specifically according to the actual application.
Further, in another embodiment, when the user does not set the storage path, the storage path in the storage request is the root path of the browser, so the storage request 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 the system, and when the 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 as the storage information of the data to be stored into the currently stored local data to obtain updated local data.
After receiving a storage request from a browser, firstly reading the currently stored local data from the local storage, adding the name, the value and the storage path of the data to be stored as storage information of the data to be stored into the currently stored local data to obtain updated local data, and then storing the updated local data into the local storage through subsequent storage of the updated local data, thereby realizing 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 without a storage path concept, 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 in a fixed position in the local storage according to the setting of the system.
Further, referring to fig. 2, fig. 2 is a flow chart illustrating another embodiment of a method for storing browser data according to the present application. Specifically shown in fig. 2 is the step S120 illustrated in fig. 1: and adding the name, the value and the storage path of the data to be stored as the storage information of the data to be stored into the local data stored currently. In the present embodiment, step S120 includes steps S201 to S204.
S201: the local data is read from the local store.
Firstly, after receiving a storage request which is sent by a browser and at least comprises the name of the data to be stored and the value of the data to be stored, at least one local data is read from the local storage so as 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 a set rule, the local data read in step S201 is at least the local data corresponding to the current browser. In the present embodiment, it is not limited that one browser corresponds to one local data, nor that one local data corresponds to one browser only.
Further, in another embodiment, when the name of the data to be stored, the value of the data to be stored and the storage path are included in the storage request, 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 exists in the local data.
Further, when the local data in the local storage is divided according to the set rule, the local data may be read according to the set rule. If the local data in the local storage is divided according to 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 are divided according to the browsers, it can be understood that one browser may correspond to at least one local data, and in step S201, a 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 data to be stored exists in the local data stored currently.
After the corresponding local data are read, further judging whether the data to be stored exist in the read local data or not so as to avoid the situation of repeated storage. In the present embodiment, step S202 is to determine whether the local data currently stored has the same name as the data to be stored, and it is not required that the local data has a data which is identical to all contents of the data to be stored, so step S202 may also be understood as determining whether the local data currently stored has the same name as the data to be stored, so as to avoid the occurrence of repeated storage of the data with the same name.
Further, step S202 determines whether there is data to be stored in the local data currently stored includes: judging whether the data to be stored exists in the local data stored currently 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 the 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 in the storage path, if the stored data with the same name as the data to be stored exists in the local data, it is determined that the stored data with the same name as the data to be stored exists in the local data to be currently stored, and step S203 may be further executed.
In another embodiment, when the storage path in the storage request is a default root path, the method further directly queries whether the data stored under the root path in the local data currently stored has the same name as the data to be stored, so as to determine whether the local data currently stored has the same name as the data to be stored.
S203: and the storage information of the data to be stored is covered with the storage information of the corresponding data in the local data stored currently.
If the fact that the stored data with the same name as the data to be stored exists in the storage path of the corresponding data to be stored in the local data is obtained, the storage information of the current data to be stored is directly covered with the storage information of the corresponding stored data in the current local data, and therefore updating of the storage information is achieved.
Specifically, step S203 may be understood as covering the value of the data to be stored correspondingly, and further completing the addition of the storage information of the data to be stored to the local data, specifically, step S203 is covering the stored data having the same name and the same path as those of the data to be stored in the local data, and because the name and the storage path are the same, it may be understood as covering only the value of the stored data correspondingly, and further may be understood as covering the value of the stored data, and further may be understood as that the storage information in the current embodiment includes at least the value of the data to be stored, specifically covering the value of the data to be stored in the local data, which is the same as the name of the data to be stored.
S204: and adding the name, the value and the storage path of the data to be stored as the storage information of the newly added data into the currently stored local data.
If it is determined in step S202 that the data to be stored does not exist in the local data in the storage path corresponding to the data to be stored, 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 are added to the current local data as the storage information of the newly added data, so as to complete the data required to be stored by the storage request. Specifically, the storage information of the newly added data is added to the storage path of the corresponding data to be stored in the currently stored local data.
Further, adding the name, value and storage path of the data to be stored as the storage information of the newly added data to the currently stored local data includes: and adding a first key value pair for the local data, namely adding a first key value pair under a storage path of the local data corresponding to the data to be stored.
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 a first key value pair.
The key of the first key value pair is a storage path of 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. If the name of the data to be stored included in the storage request is "A1", the value of the data to be stored is "B1", and the storage path is "C1", in the present embodiment, the key of the first key-value pair is "C1" of the storage path of the data to be stored, and the value of the first key-value pair includes the name "A1" of the data to be stored and the value "B1" of the data to be stored.
Further, the name and value of the data to be stored form a second key-value pair as the value of the first key-value pair. 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 browser data storing method according to the present application. In the present embodiment, the structure of the first Key-Value pair 300 is specifically illustrated, where the first Key-Value pair 300 includes a Key 310 and a Value 320, the Key of the first Key-Value pair 300 (Key illustrated in fig. 3) is a storage path of data to be stored, the Value of the first Key-Value pair 300 (Value illustrated in fig. 3) may be a second Key-Value pair, the Key of the second Key-Value pair (Key 1 illustrated in fig. 3) is a name of the data to be stored, and the Value of the second Key-Value pair (Value 1 illustrated in fig. 3) 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 "A1", 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 "C1" of the data to be stored, 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, and the Key of the second Key-Value pair is the name "A1" of the data to be stored, and the Value of the second Key-Value pair is the Value "B1" of the data to be stored.
In other embodiments, when it is determined that the stored data having the same name as the data to be stored exists in the storage path of the corresponding data to be stored in the local data, the step of "overlaying the storage information of the stored data with the storage information of the corresponding data in the local data" may be understood as: and using the value of the data to be stored to correspondingly cover the value of the second key value pair in the first key value pair with the same name as the data to be stored, namely using the value of the data to be stored to cover the value of the second key value pair with the same name as the data to be stored.
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 of different levels, specifically, a plurality of local data may be included in the local storage, a plurality of first key value pairs may be included in one local data, 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 localdata, a storage path of data to be stored is used as a key of a sub-object in localdata, a value and a name of the corresponding data to be stored are integrally contained in one object and are integrally used as a value of the sub-object, and the value is stored according to a storage path identifier when being stored in localdata, so that the problem that local storage cannot be stored according to a path in the prior art is solved.
Further, when the value in the first key pair is the second key pair and it is determined that the local data has the same name as the data to be stored, step S203 covers the storage information of the data to be stored with the storage information of the corresponding data in the local data currently stored, and includes: and updating the value of a second key value pair of corresponding data in the local data stored at present to the value of the data to be stored, wherein the corresponding data is the 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 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 a storage path in the storage request.
After the name, the value and the storage path of the data to be stored are stored into the local data according to the storage path of the data to be stored so as to obtain updated local data, the obtained local data is further stored into the local storage, namely the name of the data to be stored, the value of the data to be stored and the local data of the storage path are stored into the local storage, and the storage of the data to be stored is completed.
In the embodiment illustrated in fig. 1, by adding the name, the value and the storage path of the data to be stored as the storage information of the data to be stored to the local data according to the storage path in the storage request, the data storage in the local data according to the storage path set by the user is realized, and compared with the prior art, the selection of the storage path is more flexible. The storage of the relative path of the local data is added in the local storage, so that the user can store the local data according to the path expected by 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 data storage path can only be an origin path and cannot be correspondingly stored based on different paths, the storage of the relative path of the local data can be performed in the local data, and the technical scheme provided by the application can be used for performing data storage under the corresponding sub-path in the local data according to the structure of the sub-path contained in the web application, so that the defect that the local data can only be stored to a fixed position in the local storage according to the setting of a system in the prior art is overcome, and the flexibility of data storage in the local storage is improved.
Referring to fig. 4, fig. 4 is a flowchart of a method for storing browser data 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 the storage information of the newly added data to the currently stored local data, and further include steps S401 to S403.
S401: and judging whether a first key value pair taking a storage path as a key exists in the currently stored local data.
Before a first key value pair is newly added to the local data, firstly judging whether the first key value pair taking the storage path of the current data to be stored as a key exists in the current stored local data. Specifically, sequentially reading keys of each first key value pair in the local data, sequentially judging whether the keys of each first key value pair are identical to the storage path of the data to be stored, if so, judging that the keys of each first key value pair are different from the storage path of the data to be stored, and if so, judging that the first key value pair taking the storage path of the data to be stored as the key does not exist in the local data, and executing step S402; otherwise, when it is determined that the key of a certain first key value pair in the local data is the same as the storage path of the data to be stored, it is determined that the first key value pair using the storage path as the key is already 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 data stored therein, the storage path may be a path designated by the user to be stored in the local data or an automatic default path, it is also understood in step S401 that it is determined whether the same data record as the data path to be stored has been already stored in the local data.
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 local data which is currently stored.
If the first key value pair taking the storage path as a key does not exist in the local data which is currently stored, 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 local data which is currently stored.
S403: the name and value of the data to be stored are taken as new values of the existing first key value pairs, and the new values are added into the existing first key value pairs.
The name and the value of the data to be stored are taken as a new value of the existing first key value pair, and the new value is added to the existing first key value pair, wherein the new value refers to the value newly added to the first key value pair. Step S403 may be understood as that if it is determined that the first key value pair using the storage path as a key exists in the local data, a value is newly added in the first key value pair using the storage path as a key, where the newly added value is the name and 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 a key.
When the value in the first key-value pair is the second key-value pair in an embodiment, step S403 may also be understood as adding a second key-value pair in the first key-value pair using the storage path of the data to be stored as a key, where the key in the second key-value pair is the name of the data to be stored, and the 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 judging whether the first key value pair using the storage path as a key exists in the local data stored currently, and then correspondingly selecting the specific mode of newly adding the first key value pair according to the judging result, the space in the local data is better and reasonably utilized, and the utilization rate of the local storage is further improved.
Referring to fig. 5, fig. 5 is a flowchart illustrating a method for storing browser data according to another embodiment of the present application. In the present embodiment, the method for storing browser data provided in the present application includes steps S501 to S505.
S501: a storage request from a browser is received.
S502: and adding the name, the value and the storage path of the data to be stored as storage information of the data to be stored into the local data.
S503: and storing the updated local data into a local storage.
The steps S501 to S503 in the present embodiment are the same as the steps S110 to S130 illustrated in fig. 1, and specific reference should be made to the above description of the corresponding parts, and the detailed description is omitted here. In the current embodiment, after storing the updated local data in the local storage in step S503, the method provided in the present application further includes step S504 and step S505.
S504: detecting whether the storage space range of the local storage is abnormal.
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 value is detected, when the remaining storage space in the local storage is smaller than or equal to the set threshold value, the storage space range of the local storage is obtained to be abnormal, otherwise, the current storage space range of the local storage is indicated to be not abnormal.
Wherein, the set threshold may be zero, when the set threshold is zero, step S504 is used to detect whether the local storage still has remaining storage space, and when the set threshold is set to a smaller value according to the actual requirement, step S504 is used to detect whether the storage space in the local storage can support the system to operate at a relatively high 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 re-storing the updated local data in the local storage.
If the abnormal storage space range of the local storage is detected, the data in the local storage is emptied, and then the updated local data is restored to the local storage.
In the current embodiment, after the local data is stored in the local storage, whether the storage space of the local storage is abnormal or not is further detected, and after the abnormality of the storage space of the local storage is detected, the data in the local storage is emptied, and then the local data is restored in the local storage, so that the situation that the storage space in the local storage overflows or is abnormal can be better solved, the blank of processing when the storage space in the local storage overflows in the prior art is made up, the local storage (localtorage) has wider application scenes, and the abnormal situation that the system operation becomes slow due to too little storage space in the local storage is avoided.
Referring to fig. 6, fig. 6 is a 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 from a browser is received.
Wherein the read request includes the 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 obtained 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 store includes at least one local data therein.
When the local storage includes a plurality of local data, and the local data in the local storage is divided according to a set rule, the corresponding local data is obtained according to the set rule. If the local storage is divided according to the browser type, the local data of the browser corresponding to the sending reading request is directly searched according to the local data distribution rule when the local data is obtained.
S603: and acquiring the corresponding value of the 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 value of the stored data is acquired from the local data according to the data name obtained by analyzing the read request and the association path of the browser. Specifically, as described above, the local data includes a plurality of first key-value pairs, the keys of the first key-value pairs are the storage paths of the stored data, and the values of the first key-value pairs are the names of the stored data and the values of the stored data, so step S603 finds the corresponding first key-value pairs in the local data according to the associated paths of the browser, then reads the corresponding values from the stored data in the local data according to the names of the data to be read, and further completes the acquisition of the values of the data to be read.
Further, the associated path of the browser is the path of the browser program. 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 includes:
and searching the stored data with the names consistent with the data names and the storage paths consistent with the associated paths from the local data, and acquiring the values 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 designated by the user, or may be a default root path when the user does not designate. The names in the local data are consistent with the data names, and the stored data with the consistent storage path and association path are: the key in the first key-value pair stored in the local data has the same path as the browser is associated with, and the name of the stored data included in the value in the first key-value pair is the same as the name of the data to be read.
S604: and feeding the acquired value back to the browser.
After the corresponding value of the stored data is obtained from the local data, the obtained value is fed back to the browser for the browser to call or display to the user.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application. In the current 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 performing the method described in any of the embodiments of fig. 1-6 and their counterparts.
The memory 702 includes a local storage (not shown), and stores a computer program, which is executed to implement the methods described in any of the embodiments of fig. 1 to 6 and corresponding embodiments.
The processor 701 is coupled to the memory 702, the processor 701 being configured to run a computer program for performing the method as described in any of the above figures 1 to 6 and their corresponding embodiments.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a memory device according to an embodiment of the present application. The storage means 800 stores a computer program 801 that can be run by a processor, the computer program 801 being for implementing the method as described in any of the above figures 1 to 6 and their corresponding embodiments. Specifically, the storage device 800 may be one of a memory, a personal computer, a server, a network device, a usb disk, and the like.
The foregoing description is only of embodiments of the present application, and is not intended to limit the scope of the patent application, and all equivalent structures or equivalent processes using the descriptions and the contents of the present application or other related technical fields are included in the scope of the patent application.

Claims (10)

1. A method for storing browser data, comprising:
receiving a storage request from a browser, wherein the storage request comprises a name and a value of data to be stored and a storage path set by a user for the data to be stored;
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 as the storage information of the data to be stored into the currently stored local data to obtain updated local data; in the updated local data, the storage path of the data to be stored is used as a key of a 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 so as to form the first key value pair;
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 a storage request.
2. The method for storing browser data according to claim 1, wherein adding the name, the value, and the storage path of the data to be stored as the storage information of the data to be stored to the currently stored local data includes:
judging whether the data to be stored exist in the local data stored currently or not;
if so, the storage information of the data to be stored is covered with the storage information of the corresponding data in the current stored local data;
if the data does not exist, the name, the value and the storage path of the data to be stored are added into the local data which are currently stored 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 local data currently stored includes:
judging whether the data to be stored exist in the local data stored currently or not by using the name and the storage path of the data to be stored.
4. The method according to claim 1, wherein the name and the value of the data to be stored form a second key-value pair as the value of the first key-value pair; 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.
5. The method for storing browser data according to claim 4, wherein adding the name, value and storage path of the data to be stored as the storage information of the newly added 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 data to be stored 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 so, taking the name and the value of the data to be stored as the new value of the existing first key value pair, and adding the new value into the existing first key value pair;
the step of covering the storage information of the to-be-stored data with the storage information of the corresponding data in the currently stored local data includes:
and updating the value of a second key value pair of corresponding data in the currently stored local data to the value of the data to be stored.
6. The method of storing browser data according to claim 1, wherein storing the updated local data into a local store comprises:
detecting whether the storage space range of the local storage is abnormal or not;
if yes, the data in the local storage is emptied, and the updated local data is restored to the local storage.
7. A method for reading browser data, comprising:
receiving a reading request from a browser, wherein the reading request comprises a data name to be read;
acquiring local data from local storage; the local data comprises storage information of data to be stored, wherein the storage information is added in response to a storage request of a browser, the storage request comprises a name and a value of the data to be stored and a storage path set by a user for the data to be stored, and the storage information of the data to be stored comprises the name and the value of the data to be stored and the storage path; the storage path of the data to be stored is used as a key of a 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 and are stored in the local data;
acquiring a corresponding value of stored data 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.
8. The method of claim 7, wherein the associated path of the browser is a path in which the browser program is located;
the obtaining the corresponding value of the stored data from the local data according to the data name and the associated path of the browser includes:
and searching stored data with the name consistent with the data name and the storage path consistent with the association path from the local data, and acquiring the value of the stored data.
9. 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 8.
10. A storage device storing a computer program executable by a processor for implementing the method of any one of claims 1-8.
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 CN112800303A (en) 2021-05-14
CN112800303B true 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)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Citations (8)

* 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
CN102447714A (en) * 2010-10-07 2012-05-09 鸿富锦精密工业(深圳)有限公司 Cookie management method
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
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

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8521841B2 (en) * 2007-10-11 2013-08-27 International Business Machines Corporation Efficient delivery of cross-linked reports with or without live access to a source data repository
US9172807B2 (en) * 2011-09-11 2015-10-27 ZenDesk, Inc. Techniques for customer relationship management
CN103294700B (en) * 2012-02-24 2018-01-12 腾讯科技(北京)有限公司 Method and apparatus are locally stored in a kind of data of browser-cross
CN106897618A (en) * 2015-12-21 2017-06-27 珠海市君天电子科技有限公司 Webpage access method and device

Patent Citations (8)

* 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
CN102447714A (en) * 2010-10-07 2012-05-09 鸿富锦精密工业(深圳)有限公司 Cookie management method
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
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住图片控.《网络与信息》.2011,第77页. *

Also Published As

Publication number Publication date
CN112800303A (en) 2021-05-14

Similar Documents

Publication Publication Date Title
KR102165707B1 (en) User history playlists and subscriptions
US7827166B2 (en) Handling dynamic URLs in crawl for better coverage of unique content
EP3493059B1 (en) Application data migration method and device
US8433996B2 (en) Hierarchical model for web browser navigation
RU2608668C2 (en) System and method for control and organisation of web-browser cache for offline browsing
WO2017215175A1 (en) Page processing method and device, terminal, and server
CN108090079B (en) Chat record processing method and device of instant chat tool
US9959192B1 (en) Debugging interface for inserted elements in a resource
US20140279787A1 (en) Systems And Methods for an Adaptive Application Recommender
US9112827B2 (en) Determining appropriate browsing applications for selected network resources
US20070220083A1 (en) Estimation of initial dynamic rendering control data
EP2745530B1 (en) Display device and method for providing content using the same
US20130246617A1 (en) Method and system for processing network data
US9942359B2 (en) Method and system for synchronizing software module hosts
US20180107686A1 (en) Search method and apparatus
CN105100839A (en) Video file downloading method, device, server and terminal equipment
CN108334516B (en) Information pushing method and device
US11113455B2 (en) Web page rendering on wireless devices
US20120054598A1 (en) Method and system for viewing web page and computer Program product thereof
TWI519980B (en) Method and device for displaying web page and computer-readable storage medium
US20200128086A1 (en) Maintaining session identifiers across multiple webpages for content selection
CN112800303B (en) Browser data storage and reading method and related device
EP3125541A1 (en) Data acquisition and interaction method, set top box, server and multimedia system
US9690769B2 (en) Method and system for completing an edit area of a web page
CN106055688B (en) Search result display method and device and mobile terminal

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