CN110704721A - Client data processing method and device, terminal equipment and readable storage medium - Google Patents

Client data processing method and device, terminal equipment and readable storage medium Download PDF

Info

Publication number
CN110704721A
CN110704721A CN201910960303.0A CN201910960303A CN110704721A CN 110704721 A CN110704721 A CN 110704721A CN 201910960303 A CN201910960303 A CN 201910960303A CN 110704721 A CN110704721 A CN 110704721A
Authority
CN
China
Prior art keywords
data
accessed
client data
storage
module
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.)
Pending
Application number
CN201910960303.0A
Other languages
Chinese (zh)
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.)
Miaozhen Information Technology Co Ltd
Miaozhen Systems Information Technology Co Ltd
Original Assignee
Miaozhen Systems Information Technology 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 Miaozhen Systems Information Technology Co Ltd filed Critical Miaozhen Systems Information Technology Co Ltd
Priority to CN201910960303.0A priority Critical patent/CN110704721A/en
Publication of CN110704721A publication Critical patent/CN110704721A/en
Pending legal-status Critical Current

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/953Querying, e.g. by the use of web search engines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions

Abstract

The application provides a client data processing method, a client data processing device, terminal equipment and a readable storage medium, and relates to the technical field of Internet. According to the method and the device, after client data to be stored and the data valid duration corresponding to the client data are obtained, whether a current browser supports a LocalStorage mode or not is detected, the termination time when the client data become in a failure state is calculated according to the data valid duration when the client data are supported, then the target key name of the client data is calculated, the client data and the termination time are directly packaged into a target key value existing in a character string mode, and finally the incidence relation between the target key name and the target key value is established for storage, so that the browser supporting the LocalStorage does not need to execute JSON object creation operation, does not need to consider the compatibility problem and the format conversion performance problem of JSON.

Description

Client data processing method and device, terminal equipment and readable storage medium
Technical Field
The present application relates to the field of internet technologies, and in particular, to a client data processing method, an apparatus, a terminal device, and a readable storage medium.
Background
With the continuous development of internet technology, the degree of function integration of browsers is higher and higher, and the browsers are gradually developed into new browsers with certain data storage capacity from crude browsers which cannot store data initially. The local storage (LocalStorage) technology is a solution for local storage of data provided by the HTML5 standard, and a browser supporting the LocalStorage mode can complete storage operation of browser data by using the LocalStorage technology.
In the case of the LocalStorage technology, the data stored by the technology exists in character strings, and the stored data has no time limit, and unless the stored data is deleted manually, the stored data is stored permanently, so that a large amount of data storage resources of the browser are occupied by useless data, and the data storage resources are wasted.
Therefore, the mainstream practice in the industry is to create a corresponding JSON object based on browser data to be stored and time limitation for the data, convert the created JSON object into a character string by using a JSON. However, in practice, a browser supporting LocalStorage technology does not necessarily support json.stringiness function, but when a large amount of browser data needs to be stored, the browser supporting json.stringiness function is prone to have insufficient format conversion performance, and the data storage function of the browser is affected.
Disclosure of Invention
In view of the above, an object of the present application is to provide a client data processing method, an apparatus, a terminal device, and a readable storage medium, which can complete a storage operation on client data with a time limitation without considering the compatibility problem of a browser supporting LocalStorage with a JSON.
In order to achieve the above purpose, the embodiments of the present application employ the following technical solutions:
in a first aspect, an embodiment of the present application provides a client data processing method, where the method includes:
the method comprises the steps of obtaining client data to be stored and data effective duration corresponding to the client data, wherein the client data and the data effective duration exist in a character string mode, and the data effective duration is the maximum duration for maintaining the effective state of the client data;
detecting whether a current browser supports a local storage mode;
when detecting that the current browser supports a LocalStorage mode, calculating the termination time when the client data is converted from an effective state to a failure state according to the effective duration of the data and the starting time when the client data is stored;
calculating a target key name corresponding to the client data, and directly packaging the client data and the termination time into a target key value in a character string form;
and establishing an incidence relation between the target key name and the target key value, and storing the incidence relation.
In an alternative embodiment, the method further comprises:
when detecting that the current browser does not support a LocalStorage mode, calculating a target key name corresponding to the client data, taking the client data as a target key value, and generating a user data UserData object based on the target key name and the target key value;
determining an object storage position of the UserData object, and configuring the data storage duration of the object storage position according to the data effective duration;
loading the UserData object into the object storage location for storage.
In an alternative embodiment, the method further comprises:
receiving a data access request, wherein the data access request comprises a key name to be accessed;
detecting whether a current browser supports a LocalStorage mode;
when detecting that the current browser supports a LocalStorage mode, searching a key value to be accessed corresponding to the key name to be accessed according to the stored incidence relation between the target key name and the target key value;
analyzing the key value to be accessed to obtain corresponding client data to be accessed and the termination time of the client data to be accessed;
comparing the data access time when the data access request is received with the termination time obtained by analysis;
and if the data access time does not exceed the termination time obtained by analysis, outputting the client data to be accessed as a data access result, otherwise, deleting the association relation corresponding to the key name to be accessed, and outputting a data access result as null.
In an alternative embodiment, the method further comprises:
when detecting that the current browser does not support a LocalStorage mode, searching a target object storage position for storing a UserData object to be accessed including the key name to be accessed;
calculating corresponding storage termination time according to the storage starting time and the data storage duration when the user data object to be accessed is stored in the target object storage position;
comparing the data access time with the storage termination time;
and if the data access time does not exceed the storage termination time, extracting the UserData object to be accessed from the target object storage position, extracting a key value to be accessed corresponding to the key name to be accessed from the UserData object to be accessed, and outputting the key value as a data access result, otherwise, outputting the data access result to be null.
In a second aspect, an embodiment of the present application provides a client data processing apparatus, where the apparatus includes:
the data acquisition module is used for acquiring client data to be stored and corresponding data valid duration, wherein the client data and the data valid duration exist in a character string form, and the data valid duration is the maximum duration for maintaining the valid state of the client data;
the mode detection module is used for detecting whether the current browser supports a local storage mode;
the time calculation module is used for calculating the termination time when the client data is converted from the effective state to the failure state according to the effective data duration and the starting time when the client data is stored when the current browser is detected to support the LocalStorage mode;
the data encapsulation module is used for calculating a target key name corresponding to the client data and directly encapsulating the client data and the termination time into a target key value in a character string form;
and the data storage module is used for establishing an incidence relation between the target key name and the target key value and storing the incidence relation.
In an alternative embodiment, the apparatus further comprises:
the object generation module is used for calculating a target key name corresponding to the client data when the current browser is detected not to support a LocalStorage mode, taking the client data as a target key value, and generating a user data UserData object based on the target key name and the target key value;
the storage configuration module is used for determining the object storage position of the UserData object and configuring the data storage duration of the object storage position according to the data effective duration;
and the data storage module is also used for loading the UserData object into the object storage position for storage.
In an alternative embodiment, the apparatus further comprises:
the device comprises a request receiving module, a data access module and a data processing module, wherein the request receiving module is used for receiving a data access request, and the data access request comprises a key name to be accessed;
the mode detection module is further used for detecting whether the current browser supports a LocalStorage mode;
the key value searching module is used for searching a key value to be accessed corresponding to the key name to be accessed according to the stored incidence relation between the target key name and the target key value when the current browser is detected to support the LocalStorage mode;
the key value analysis module is used for analyzing the key value to be accessed to obtain the corresponding client data to be accessed and the termination time of the client data to be accessed;
the time comparison module is used for comparing the data access time when the data access request is received with the termination time obtained by analysis;
and the access output module is used for outputting the client data to be accessed as a data access result if the data access time does not exceed the termination time obtained by analysis, and otherwise, deleting the association relation corresponding to the key name to be accessed and outputting a data access result as null.
In an alternative embodiment, the apparatus further comprises:
the position searching module is used for searching a target object storage position for storing the user data object to be accessed including the key name to be accessed when the current browser is detected not to support the LocalStorage mode;
the time calculation module is also used for calculating the corresponding storage termination time according to the storage starting time and the data storage duration when the user data object to be accessed is stored in the target object storage position;
the time comparison module is further configured to compare the data access time with the storage termination time;
the access output module is further configured to extract the UserData object to be accessed from the target object storage location if the data access time does not exceed the storage termination time, extract a key value to be accessed corresponding to the key name to be accessed from the UserData object to be accessed, and output the key value as a data access result, otherwise, output the data access result as null.
In a third aspect, an embodiment of the present application provides a terminal device, which includes a processor and a memory, where the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the client data processing method in any one of the foregoing embodiments.
In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the client data processing method described in any one of the foregoing embodiments.
Compared with the background art, the method has the following beneficial effects:
after client data to be stored in a character string form and the effective time length of the data corresponding to the client data are acquired, whether a current browser supports a LocalStorage mode or not is detected, and calculates the termination time of the client data when the client data becomes invalid state according to the effective time of the data and the start time when the client data is stored, and finally, the storage operation of the client data with time limitation is finished by establishing the incidence relation between the target key name and the target key value for storage, so that a browser supporting LocalStorage does not need to execute JSON object creation operation, and does not need to consider the compatibility problem and format conversion performance problem of JSON.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a schematic structural block diagram of a terminal device according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a client data processing method according to an embodiment of the present application;
fig. 3 is a second flowchart of a client data processing method according to an embodiment of the present application;
fig. 4 is a functional block diagram of a client data processing apparatus according to an embodiment of the present application;
fig. 5 is a second functional block diagram of a client data processing apparatus according to an embodiment of the present application.
Icon: 10-a terminal device; 11-a memory; 12-a processor; 13-a communication unit; 100-a client data processing apparatus; 110-a data acquisition module; 120-a mode detection module; 130-time calculation module; 140-a data encapsulation module; 150-a data storage module; 160-an object generation module; 170-storing the configuration module; 180-request receiving module; 190-key value lookup module; 210-a key value parsing module; 220-time comparison module; 230-access output module; 240-location lookup module.
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, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
It is to be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic block diagram of a terminal device 10 according to an embodiment of the present disclosure. In this embodiment, the terminal device 10 may run a client program corresponding to a browser, and store and access client data generated by the browser during running. When the terminal device 10 performs the storage operation with time limitation on the generated client data, it is not necessary to consider the compatibility problem of the browser supporting LocalStorage on the JSON. The terminal device 10 may be, but is not limited to, a personal computer, a smart phone, a tablet computer, and the like.
In the present embodiment, the terminal device 10 includes a client data processing apparatus 100, a memory 11, a processor 12, and a communication unit 13. The various elements of the memory 11, the processor 12 and the communication unit 13 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the memory 11, the processor 12 and the communication unit 13 may be electrically connected to each other through one or more communication buses or signal lines.
In this embodiment, the memory 11 may be used for storing a program, and the processor 12 may execute the program accordingly after receiving the execution instruction. The Memory 11 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. A client program corresponding to a browser running on the terminal device 10 may be stored in the memory 11, and the memory 11 stores client data corresponding to the browser.
In this embodiment, the processor 12 may be an integrated circuit chip having signal processing capabilities. The Processor 12 may be a general-purpose Processor including a Central Processing Unit (CPU), a Network Processor (NP), and the like. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like that implements or executes the methods, steps and logic blocks disclosed in the embodiments of the present application.
In this embodiment, the communication unit 13 is configured to establish a communication connection between the terminal device 10 and another electronic device through a network, and to transmit and receive data through the network. For example, the terminal device 10 performs data interaction with a server through the communication unit 13.
In the present embodiment, the client data processing apparatus 100 includes at least one software functional module capable of being stored in the memory 11 in the form of software or firmware or being solidified in the operating system of the terminal device 10. The processor 12 may be used to execute executable modules stored by the memory 11, such as software functional modules and computer programs included in the client data processing device 100. The terminal device 10 makes the browser supporting LocalStorage running on the terminal device 10 need not consider the compatibility problem of JSON.
It is understood that the block diagram shown in fig. 1 is only a structural component diagram of the terminal device 10, and the terminal device 10 may include more or less components than those shown in fig. 1, or have a different configuration from that shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
In the present application, in order to ensure that the browser running on the terminal device 10 can complete the storage operation of the client data with time limitation without executing JSON object creation operation and without considering compatibility problem and format conversion performance problem of JSON. The following describes a client data processing method provided by the present application.
Optionally, referring to fig. 2, fig. 2 is a schematic flowchart of a client data processing method according to an embodiment of the present application. In the embodiment of the present application, specific flows and steps of the client data processing method shown in fig. 2 are as follows.
Step S310, obtain the client data to be stored and the data validity duration corresponding to the client data.
In this embodiment, the client data and the data valid duration both exist in the form of a character string, where the data valid duration is a maximum duration during which the corresponding client data can be maintained in a valid state during the storage process, and the valid state is used to indicate that the corresponding client data can be called or used. The valid duration of the data may be, but is not limited to, one week, one month, two months, etc., and the value may be configured differently according to the requirement.
Step S320, detecting whether the current browser supports LocalStorage mode.
In this embodiment, the current browser is a browser currently used by the terminal device 10, and the client data to be stored obtained by the terminal device 10 corresponds to the current browser. After the terminal device 10 obtains the client data to be stored and the data valid duration corresponding to the client data, it is determined whether to execute an operation of storing the client data corresponding to the browser supporting the LocalStorage mode by detecting whether the current browser supports the LocalStorage mode.
Step S330, according to the effective duration of the data and the initial time when the client data is stored, calculating the termination time when the client data is converted from the effective state to the invalid state.
In this embodiment, when the terminal device 10 detects that the current browser supports the LocalStorage mode, the terminal device 10 correspondingly executes the step S330. The starting time when the client data is stored is used to indicate a time point when the terminal device 10 starts to store the obtained client data after completing the LocalStorage mode compatibility detection operation on the browser. The terminal device 10 adds the start time when the client data is stored to the data validity time to obtain the end time when the client data is converted from the valid state to the invalid state after being stored, where the invalid state is used to indicate that the corresponding client data cannot be called or used.
Step S340, calculating a target key name corresponding to the client data, and directly encapsulating the client data and the termination time as a target key value existing in a character string form.
In this embodiment, the terminal device 10 may obtain the target key name of the client data by associating the plaintext key of the client data with the corresponding web page address, encrypting the plaintext key into the internal key through the message digest algorithm version 5 algorithm, and fixing the additional letter K at the head of the internal key. The terminal device 10 may complete the binding between the client data and the termination time by separating the termination time from the client data by using a middle vertical line, and encapsulate to obtain a final target key value, so as to add a time limit corresponding to the termination time to the client data, and also to complete the storage operation of the client data with the time limit in a manner of creating a JSON object and performing format conversion on the created JSON object, so that the terminal device 10 does not need to consider the compatibility problem of a browser supporting LocalStorage on JSON a string function. The target key value may be expressed in the form of < time | value > or < value | time >, value represents specific content of the corresponding client data, and time represents an end time of the corresponding client data.
And step S350, establishing an incidence relation between the target key name and the target key value, and storing the incidence relation.
In this embodiment, when the terminal device 10 calculates a target key name and a target key value corresponding to the client data to be stored, the storage operation of the client data with time limitation is completed by creating an association relationship between the target key name and the target key value and storing the created association relationship in the memory 11, so as to correspondingly improve the storage efficiency of the client data with time limitation.
In this application, in order to ensure that the terminal device 10 can store the client data to be stored even when the current browser cannot support LocalStorage, the client data processing method shown in fig. 2 may further include the following steps S360 to S380.
Step S360, calculating a target key name corresponding to the client data, and generating a UserData object based on the target key name and the target key value by taking the client data as the target key value.
In this embodiment, when the terminal device 10 detects that the current browser does not support the LocalStorage mode, the terminal device 10 correspondingly executes the step S360 to simulate a LocalStorage storage process by using UserData behavior. Specifically, the terminal device 10 creates an invisible text box, then binds the UserData behavior to the text box, so that the text box becomes an object template supporting the UserData behavior, and loads a target key name corresponding to the client data and the client data into the text box by using a setattette method, thereby forming a corresponding UserData object.
Step S370, determining the object storage location of the UserData object, and configuring the data storage duration of the object storage location with the data validity duration.
In this embodiment, the terminal device 10 determines an object storage location for storing the obtained UserData object by using a load method, and then configures an expires attribute of the object storage location by using a data valid duration corresponding to the client data to be stored, so as to complete a data storage duration configuration operation on the object storage location. The data storage duration is used for representing the maximum duration of the stored corresponding UserData object, and when the duration of the stored UserData object in the object storage location exceeds the data storage duration, the terminal device 10 automatically deletes the stored UserData object.
And step S380, loading the UserData object into the object storage position for storage.
In this embodiment, the terminal device 10 loads the generated UserData object corresponding to the client data to be stored to the corresponding object storage location for storage by using a save method, so as to expand the storage scheme of the terminal device 10 for the client data corresponding to different browsers.
In the present application, in order to ensure that the user can access the client data stored in the terminal device 10, the terminal device 10 can access the client data stored in the terminal device based on the client data processing method shown in fig. 3 by providing the client data processing method shown in fig. 3. The client data processing method shown in fig. 3 is described below accordingly.
Step S410, receiving a data access request, where the data access request includes a key name to be accessed.
In this embodiment, when the terminal device 10 receives a data access request for performing data access on a current browser, the terminal device 10 may obtain a key name to be accessed corresponding to client data that needs to be accessed by analyzing the data access request.
Step S420, detecting whether the current browser supports LocalStorage mode.
In this embodiment, the terminal device 10 determines whether to execute an operation of accessing client data corresponding to the browser supporting the LocalStorage mode by detecting whether the current browser supports the LocalStorage mode.
And step S430, searching the key value to be accessed corresponding to the key name to be accessed according to the stored incidence relation between the target key name and the target key value.
In this embodiment, when the terminal device 10 detects that the current browser supports the LocalStorage mode, the terminal device 10 correspondingly executes the step S430. At this time, the terminal device 10 searches for a target association relationship corresponding to the key name to be accessed through an association relationship between the stored target key name and the target key value, and extracts the key value to be accessed corresponding to the key name to be accessed from the target association relationship. In this process, when the browser running on the terminal device 10 supports the LocalStorage mode, the corresponding client data is stored in the target key value existing in the form of a character string directly, and when the terminal device 10 accesses the target key value, it is not necessary to use the stored character string converted into the JSON object by using the JSON.
Step S440, analyzing the key value to be accessed to obtain the corresponding client data to be accessed and the termination time of the client data to be accessed.
In this embodiment, when detecting that the current browser supports the LocalStorage mode, the terminal device 10 may obtain the client data to be accessed included in the key value to be accessed and the termination time of the client data to be accessed by performing data analysis on the searched key value to be accessed.
Step S450 compares the data access time when the data access request is received with the analyzed termination time.
In this embodiment, when the terminal device 10 obtains the termination time included in the key value to be accessed, by comparing the data access time with the termination time obtained through analysis, it is determined whether to output the client data to be accessed obtained through analysis, so as to complete a corresponding data access operation.
Step S460, if the data access time does not exceed the termination time obtained by the analysis, outputting the client data to be accessed as a data access result, otherwise, deleting the association relationship corresponding to the key name to be accessed, and outputting the data access result as null.
In this embodiment, if the data access time exceeds the termination time obtained by analysis, it indicates that the client data corresponding to the key value to be accessed has become a failure state, and at this time, the terminal device 10 cannot output the client data to be accessed, which is included in the key value to be accessed, as a data access result, delete the association relationship corresponding to the key name to be accessed, and then correspondingly output the data access result as null.
In this application, in order to ensure that the terminal device 10 can normally access the client data stored through the UserData behavior even when the current browser cannot support LocalStorage, the client data processing method shown in fig. 3 may further include the following steps S470 to S510.
In step S470, a target object storage location for storing the UserData object to be accessed including the key name to be accessed is searched.
In this embodiment, when the terminal device 10 detects that the current browser does not support the LocalStorage mode, the terminal device 10 correspondingly executes the step S470. Wherein, the terminal device 10 determines the target object storage position in which the user data object to be accessed including the key name to be accessed is stored by using a load method.
And step S480, calculating the corresponding storage termination time according to the storage starting time and the data storage duration when the user data object to be accessed is stored in the target object storage position.
In this embodiment, the terminal device 10 obtains the maximum storage time of the UserData object to be accessed in the target object storage location, that is, the storage termination time, by adding the start time when the target object storage location stores the UserData object to be accessed and the data storage duration of the target object storage location.
In step S490, the data access time is compared with the storage termination time.
In this embodiment, the terminal device 10 compares the data access time when the data access request is received with the calculated storage termination time of the UserData object to be accessed, and determines whether to output the client data content included in the UserData object to be accessed, so as to complete the corresponding data access operation.
Step S510, if the data access time does not exceed the storage termination time, extracting the UserData object to be accessed from the target object storage location, and extracting the key value to be accessed corresponding to the key name to be accessed from the UserData object to be accessed as the data access result for outputting, otherwise, outputting the data access result as null.
In this embodiment, if the data access time exceeds the storage termination time corresponding to the UserData object to be accessed, it indicates that the client data corresponding to the key name to be accessed has become a failure state, and at this time, the terminal device 10 cannot output the client data to be accessed included in the UserData object to be accessed as a data access result, delete the client data to be accessed and delete the UserData object to be accessed, and output the data access result as null correspondingly.
In the present application, in order to ensure that the client data processing apparatus 100 included in the terminal device 10 can be normally implemented, the functions of the client data processing apparatus 100 are implemented by dividing functional modules. The following describes the specific components of the client data processing apparatus 100 provided in the present application.
Optionally, referring to fig. 4, fig. 4 is a schematic functional module diagram of a client data processing apparatus 100 according to an embodiment of the present application. In the embodiment of the present application, the client data processing apparatus 100 includes a data obtaining module 110, a pattern detecting module 120, a time calculating module 130, a data encapsulating module 140, and a data storing module 150.
The data obtaining module 110 is configured to obtain client data to be stored and data valid duration corresponding to the client data, where the client data and the data valid duration exist in a character string, and the data valid duration is a maximum duration for maintaining a valid state of the client data.
The mode detection module 120 is configured to detect whether the current browser supports a LocalStorage mode.
The time calculating module 130 is configured to calculate, when it is detected that the current browser supports the LocalStorage mode, a termination time when the client data is changed from the valid state to the invalid state according to the data valid duration and the start time when the client data is stored.
The data encapsulation module 140 is configured to calculate a target key name corresponding to the client data, and directly encapsulate the client data and the termination time as a target key value existing in a character string form;
the data storage module 150 is configured to establish an association relationship between the target key name and the target key value, and store the association relationship.
In the embodiment of the present application, the client data processing apparatus 100 may further include an object generation module 160 and a storage configuration module 170.
The object generating module 160 is configured to, when it is detected that the current browser does not support the LocalStorage mode, calculate a target key name corresponding to the client data, and generate a UserData object based on the target key name and the target key value by using the client data as a target key value.
The storage configuration module 170 is configured to determine an object storage location of the UserData object, and configure the data storage duration of the object storage location according to the data validity duration.
The data storage module 150 is further configured to load the UserData object into the object storage location for storage.
Optionally, referring to fig. 5, fig. 5 is a second functional module schematic diagram of the client data processing apparatus 100 according to the embodiment of the present application. In this embodiment, the client data processing apparatus 100 may further include a request receiving module 180, a key value searching module 190, a key value parsing module 210, a time comparing module 220, and an access outputting module 230.
The request receiving module 180 is configured to receive a data access request, where the data access request includes a key name to be accessed.
The mode detection module 120 is further configured to detect whether the current browser supports a LocalStorage mode.
The key value searching module 190 is configured to search, when it is detected that the current browser supports the LocalStorage mode, a key value to be accessed corresponding to the key name to be accessed according to an association relationship between a stored target key name and the target key value.
The key value analyzing module 210 is configured to analyze the key value to be accessed to obtain the corresponding client data to be accessed and the termination time of the client data to be accessed.
The time comparison module 220 is configured to compare the data access time when the data access request is received with the termination time obtained through analysis.
The access output module 230 is configured to output the client data to be accessed as a data access result if the data access time does not exceed the termination time obtained by the analysis, and otherwise, delete the association relationship corresponding to the key name to be accessed and output a data access result as null.
In the embodiment of the present application, the client data processing apparatus 100 may further include a location lookup module 240.
The location searching module 240 is configured to search, when it is detected that the current browser does not support the LocalStorage mode, a target object storage location for storing the UserData object to be accessed including the key name to be accessed.
The time calculating module 130 is further configured to calculate a corresponding storage termination time according to the storage start time and the data storage duration when the target object storage location stores the user data object to be accessed.
The time comparing module 220 is further configured to compare the data access time with the storage termination time.
The access output module 230 is further configured to, if the data access time does not exceed the storage termination time, extract the UserData object to be accessed from the target object storage location, and extract, from the UserData object to be accessed, the key value to be accessed corresponding to the key name to be accessed as a data access result for output, otherwise, output the data access result as null.
It should be noted that the basic principle and the technical effect of the client data processing apparatus 100 provided in the embodiment of the present application are the same as those of the client data processing method described above, and for the sake of brief description, no mention is made in this embodiment, and reference may be made to the corresponding description of the client data processing method described above.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a readable storage medium, which includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned readable storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
To sum up, in the client data processing method, apparatus, terminal device and readable storage medium provided by the present application, after acquiring client data to be stored in a character string form and a data valid duration corresponding thereto, the present application detects whether a current browser supports a LocalStorage mode, and calculates a termination time when the client data becomes a failure state according to the data valid duration and a start time when the client data is stored when supported, then calculates a target key name of the client data, directly encapsulates the client data and the obtained termination time into a target key value in a character string form, and finally stores by establishing an association relationship between the target key name and the target key value, thereby completing a storage operation of the client data with a time limit, so that the browser supporting LocalStorage does not need to execute a JSON object creation operation, the compatibility problem of the JSON.Stringify function and the format conversion performance problem do not need to be considered, and the storage efficiency of the client data with time limitation is improved.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A method for processing client data, the method comprising:
the method comprises the steps of obtaining client data to be stored and data effective duration corresponding to the client data, wherein the client data and the data effective duration exist in a character string mode, and the data effective duration is the maximum duration for maintaining the effective state of the client data;
detecting whether a current browser supports a local storage mode;
when detecting that the current browser supports a LocalStorage mode, calculating the termination time when the client data is converted from an effective state to a failure state according to the effective duration of the data and the starting time when the client data is stored;
calculating a target key name corresponding to the client data, and directly packaging the client data and the termination time into a target key value in a character string form;
and establishing an incidence relation between the target key name and the target key value, and storing the incidence relation.
2. The method of claim 1, further comprising:
when detecting that the current browser does not support a LocalStorage mode, calculating a target key name corresponding to the client data, taking the client data as a target key value, and generating a user data UserData object based on the target key name and the target key value;
determining an object storage position of the UserData object, and configuring the data storage duration of the object storage position according to the data effective duration;
loading the UserData object into the object storage location for storage.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
receiving a data access request, wherein the data access request comprises a key name to be accessed;
detecting whether a current browser supports a LocalStorage mode;
when detecting that the current browser supports a LocalStorage mode, searching a key value to be accessed corresponding to the key name to be accessed according to the stored incidence relation between the target key name and the target key value;
analyzing the key value to be accessed to obtain corresponding client data to be accessed and the termination time of the client data to be accessed;
comparing the data access time when the data access request is received with the termination time obtained by analysis;
and if the data access time does not exceed the termination time obtained by analysis, outputting the client data to be accessed as a data access result, otherwise, deleting the association relation corresponding to the key name to be accessed, and outputting a data access result as null.
4. The method of claim 3, further comprising:
when detecting that the current browser does not support a LocalStorage mode, searching a target object storage position for storing a UserData object to be accessed including the key name to be accessed;
calculating corresponding storage termination time according to the storage starting time and the data storage duration when the user data object to be accessed is stored in the target object storage position;
comparing the data access time with the storage termination time;
and if the data access time does not exceed the storage termination time, extracting the UserData object to be accessed from the target object storage position, extracting a key value to be accessed corresponding to the key name to be accessed from the UserData object to be accessed, and outputting the key value as a data access result, otherwise, outputting the data access result to be null.
5. A client data processing apparatus, characterized in that the apparatus comprises:
the data acquisition module is used for acquiring client data to be stored and corresponding data valid duration, wherein the client data and the data valid duration exist in a character string form, and the data valid duration is the maximum duration for maintaining the valid state of the client data;
the mode detection module is used for detecting whether the current browser supports a local storage mode;
the time calculation module is used for calculating the termination time when the client data is converted from the effective state to the failure state according to the effective data duration and the starting time when the client data is stored when the current browser is detected to support the LocalStorage mode;
the data encapsulation module is used for calculating a target key name corresponding to the client data and directly encapsulating the client data and the termination time into a target key value in a character string form;
and the data storage module is used for establishing an incidence relation between the target key name and the target key value and storing the incidence relation.
6. The apparatus of claim 5, further comprising:
the object generation module is used for calculating a target key name corresponding to the client data when the current browser is detected not to support a LocalStorage mode, taking the client data as a target key value, and generating a user data UserData object based on the target key name and the target key value;
the storage configuration module is used for determining the object storage position of the UserData object and configuring the data storage duration of the object storage position according to the data effective duration;
the data storage module is also used for loading the UserData object into the object storage position for storage.
7. The apparatus of claim 5 or 6, further comprising:
the device comprises a request receiving module, a data access module and a data processing module, wherein the request receiving module is used for receiving a data access request, and the data access request comprises a key name to be accessed;
the mode detection module is further used for detecting whether the current browser supports a LocalStorage mode;
the key value searching module is used for searching a key value to be accessed corresponding to the key name to be accessed according to the stored incidence relation between the target key name and the target key value when the current browser is detected to support the LocalStorage mode;
the key value analysis module is used for analyzing the key value to be accessed to obtain the corresponding client data to be accessed and the termination time of the client data to be accessed;
the time comparison module is used for comparing the data access time when the data access request is received with the termination time obtained by analysis;
and the access output module is used for outputting the client data to be accessed as a data access result if the data access time does not exceed the termination time obtained by analysis, and otherwise, deleting the association relation corresponding to the key name to be accessed and outputting a data access result as null.
8. The apparatus of claim 7, further comprising:
the position searching module is used for searching a target object storage position for storing the user data object to be accessed including the key name to be accessed when the current browser is detected not to support the LocalStorage mode;
the time calculation module is also used for calculating the corresponding storage termination time according to the storage starting time and the data storage duration when the user data object to be accessed is stored in the target object storage position;
the time comparison module is further configured to compare the data access time with the storage termination time;
the access output module is further configured to extract the UserData object to be accessed from the target object storage location if the data access time does not exceed the storage termination time, extract a key value to be accessed corresponding to the key name to be accessed from the UserData object to be accessed, and output the key value as a data access result, otherwise, output the data access result as null.
9. A terminal device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor to implement the client data processing method of any one of claims 1 to 4.
10. A readable storage medium on which a computer program is stored, which, when executed by a processor, implements the client data processing method of any one of claims 1 to 4.
CN201910960303.0A 2019-10-10 2019-10-10 Client data processing method and device, terminal equipment and readable storage medium Pending CN110704721A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910960303.0A CN110704721A (en) 2019-10-10 2019-10-10 Client data processing method and device, terminal equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910960303.0A CN110704721A (en) 2019-10-10 2019-10-10 Client data processing method and device, terminal equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN110704721A true CN110704721A (en) 2020-01-17

Family

ID=69199186

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910960303.0A Pending CN110704721A (en) 2019-10-10 2019-10-10 Client data processing method and device, terminal equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN110704721A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377804A (en) * 2021-06-30 2021-09-10 北京三快在线科技有限公司 Data processing method and device, storage medium and electronic equipment
CN113495908A (en) * 2020-04-03 2021-10-12 北京京东振世信息技术有限公司 Data statistical method and device
CN115604254A (en) * 2022-12-15 2023-01-13 济南丽阳神州智能科技有限公司(Cn) Breakpoint examination continuation processing method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103294700A (en) * 2012-02-24 2013-09-11 腾讯科技(北京)有限公司 Cross-browser data local storage method and device
CN106980694A (en) * 2017-04-01 2017-07-25 北京奇虎科技有限公司 Browser page information interacting method, device and mobile terminal
US20180324557A1 (en) * 2012-10-02 2018-11-08 Razer (Asia-Pacific) Pte. Ltd. Managing user data on an electronic device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103294700A (en) * 2012-02-24 2013-09-11 腾讯科技(北京)有限公司 Cross-browser data local storage method and device
US20180324557A1 (en) * 2012-10-02 2018-11-08 Razer (Asia-Pacific) Pte. Ltd. Managing user data on an electronic device
CN106980694A (en) * 2017-04-01 2017-07-25 北京奇虎科技有限公司 Browser page information interacting method, device and mobile terminal

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113495908A (en) * 2020-04-03 2021-10-12 北京京东振世信息技术有限公司 Data statistical method and device
CN113377804A (en) * 2021-06-30 2021-09-10 北京三快在线科技有限公司 Data processing method and device, storage medium and electronic equipment
CN115604254A (en) * 2022-12-15 2023-01-13 济南丽阳神州智能科技有限公司(Cn) Breakpoint examination continuation processing method and device

Similar Documents

Publication Publication Date Title
US7765505B2 (en) Design rule management method, design rule management program, rule management apparatus and rule verification apparatus
CN110704721A (en) Client data processing method and device, terminal equipment and readable storage medium
TWI670611B (en) Web file sending method, webpage rendering method and device, webpage rendering system
US8468145B2 (en) Indexing of URLs with fragments
CN107562600B (en) Page detection method and device, computing equipment and storage medium
CN107766344B (en) Template rendering method and device and browser
CN110851680B (en) Web crawler identification method and device
CN106649446B (en) Information pushing method and device
CN104063401A (en) Webpage style address merging method and device
CN107783770B (en) Page configuration updating method, device, server and medium
CN104320312A (en) Network application safety test tool and fuzz test case generation method and system
CN109657434B (en) Application access method and device
CN105550179A (en) Webpage collection method and browser plug-in
CN104899203B (en) Webpage generation method and device and terminal equipment
CN113360300B (en) Interface call link generation method, device, equipment and readable storage medium
CN108021411A (en) A kind of discovery system of calling service relation and discovery method
US20160117392A1 (en) Information search method and apparatus
CN104834589A (en) Webpage detection method and device
CN106528066B (en) Business process operation method and device
CN110598115A (en) Sensitive webpage identification method and system based on artificial intelligence multi-engine
CN110209890A (en) The querying method and user equipment of information browse data on block chain
CN109033831A (en) A kind of method for detecting virus, device, electronic equipment and storage medium
CN110532457B (en) Method and system for acquiring network segment ID
CN104123301A (en) Method and device controlling running of browser
CN104270358B (en) Trustable network transaction system client monitor and its implementation

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200117