Data processing method, data processing device and electronic equipment
By parsing time-related characters in the target input in a large language model and setting the cache validity period, the cache data error problem caused by time information changes is solved, ensuring that the data is stored and invalidated within the validity period, and improving user experience and cache management efficiency.
Patent Information
- Application Number
- CN202411045640.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-11-19
AI Technical Summary
When the large language model deals with problems containing time information, the time information changes over time and leads to cache data errors, affecting the user experience.
By parsing the target input, if it contains time-related characters, set the cache validity period and clear the cache data to ensure that the cached data is stored and invalidated during the validity period, and avoid the acquisition of incorrect data.
Effectively manage cached data, avoid false data presentation, improve user experience and improve cache utilization.
Smart Images

Figure CN118981479A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, a data processing device and an electronic device. Background Art
[0002] At present, after obtaining the questions input by the user, the Large Language Model (LLM) can generate corresponding cache data based on the questions and store the cache data in the database. When the user enters the same or similar questions again, the corresponding cache data can be obtained from the database. However, some questions may contain time information, and some time information may change with the current time. If the time information contained in the question changes with the time when the question was first parsed and cache data was generated when the user enters the question again, the wrong cache data may be obtained, affecting the user experience. Summary of the invention
[0003] Embodiments of the present application provide a data processing method, a data processing device, and an electronic device.
[0004] On the one hand, an embodiment of the present application provides an information processing method, including:
[0005] In response to obtaining a target input, parsing the target input;
[0006] If the target input satisfies the first condition, the target input is processed according to the first strategy, so that the cache data related to the target input is stored within the cache validity period and is cleared when it is invalid;
[0007] The first condition indicates that the target input includes a target character, and the time indicated by the target character can change with the current time; and the cache validity period is related to the target character and / or the current time.
[0008] Optionally, the cache data includes first-level cache data stored in the first cache space and second-level cache data stored in the second cache space;
[0009] The first-level cache data includes user input and executable code output by the target model, and each user input corresponds to the executable code one by one;
[0010] The secondary cache data includes executable codes and display data output by the target model, each executable code corresponds to the display data one by one; and the corresponding display data can be obtained from the database by running the executable code;
[0011] The first-level cache data and the second-level cache data include or do not include a target flag that is within the cache validity period.
[0012] Optionally, processing the target input according to the first strategy includes:
[0013] If the first cache data contains user input that satisfies a second condition, obtaining executable code corresponding to the user input; the second condition indicates a similarity match and a target flag that is within the cache validity period;
[0014] If the second cache data contains executable code that meets the second condition, display data corresponding to the executable code is obtained.
[0015] Optionally, processing the target input according to the first strategy includes:
[0016] If the first cache data contains user input that satisfies a second condition, obtaining executable code corresponding to the user input; the second condition indicates a similarity match and a target flag that is within the cache validity period;
[0017] If there is no executable code satisfying the second condition in the second cache data, executing the executable code corresponding to the user input, and obtaining display data corresponding to the executable code from the database;
[0018] The executable code corresponding to the user input and the display data corresponding to the executable code are stored in the second cache space, and a target flag within the cache validity period is set.
[0019] Optionally, processing the target input according to the first strategy includes:
[0020] If there is no user input satisfying the second condition in the first cache data, parsing the user input using the target model, and outputting executable code corresponding to the user input;
[0021] Storing the user input and the corresponding executable code in the first cache space, and setting a target flag within the cache validity period;
[0022] Executing the executable code corresponding to the user input, and obtaining display data corresponding to the executable code from a database;
[0023] The executable code corresponding to the user input and the display data corresponding to the executable code are stored in the second cache space, and a target flag within the cache validity period is set.
[0024] Optionally, the method further includes:
[0025] The display data corresponding to the executable code is counted to obtain the data row or data table associated with the user input, and the data row or data table associated with the user input is processed into a target structure for display.
[0026] Optionally, the method further comprises:
[0027] Monitoring the first-level cache data and the second-level cache data including a target flag within a cache validity period to determine whether the cache data associated with the target flag exceeds the cache validity period;
[0028] If the cache data associated with the target flag exceeds the cache validity period, the executable code and / or corresponding display data associated with the target flag are deleted.
[0029] Optionally, the method further comprises:
[0030] If the target input does not satisfy the first condition, the target input is processed according to the second strategy, so that the cache data related to the target input is stored within the cache validity period, cleared when invalid, or the cache validity period is not set; the cache validity period is independent of the target character and / or the current time.
[0031] On the other hand, an embodiment of the present application further provides a data processing device, including:
[0032] An acquisition module, configured to parse the target input in response to obtaining the target input;
[0033] a processing module, configured to process the target input according to a first strategy if the target input satisfies a first condition, so that cache data related to the target input is stored within a cache validity period and cleared when invalid;
[0034] The first condition indicates that the target input includes a target character, and the time indicated by the target character can change with the current time; and the cache validity period is related to the target character and / or the current time.
[0035] On the other hand, an embodiment of the present application further provides an electronic device, including a memory and a processor, wherein an executable program is stored in the memory, and the processor executes the executable program to implement the steps of the above method. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A flowchart of a data processing method according to an embodiment of the present application;
[0037] Figure 2 For the embodiments of this application Figure 1 A flowchart of an embodiment of step S200;
[0038] Figure 3 For the embodiments of this application Figure 1 A flowchart of another embodiment of step S200;
[0039] Figure 4 For the embodiments of this application Figure 1 A flowchart of another embodiment of step S200;
[0040] Figure 5 Another flow chart of the data processing method according to an embodiment of the present application;
[0041] Figure 6 This is a structural block diagram of a data processing device according to an embodiment of the present application;
[0042] Figure 7 This is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0043] Various aspects and features of the present application are described herein with reference to the accompanying drawings.
[0044] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.
[0045] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0046] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.
[0047] It should also be understood that although the present application has been described with reference to some specific examples, those skilled in the art will be able to readily implement many other equivalent forms of the present application.
[0048] The above and other aspects, features and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.
[0049] Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments applied for are merely examples of the present application, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that obscure the present application. Therefore, the specific structural and functional details applied for herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present application in a variety of ways with substantially any suitable detailed structure.
[0050] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present application.
[0051] Figure 1 A data processing method provided by an embodiment of the present application is shown in FIG. Figure 1 As shown, including:
[0052] S100, in response to obtaining a target input, parsing the target input;
[0053] The data processing method of this embodiment is applied to electronic devices, which may be computers, mobile phones, and other electronic devices that have the function of parsing user input questions. The electronic device can also use a large language model (LLM, Large Language Model) to generate executable code based on user input questions, and store cache data related to the user input questions.
[0054] In this embodiment, in response to obtaining the target input, the target input is parsed. Specifically, after obtaining the target input, the electronic device can parse the prompt word based on the target input. It can be understood that the prompt word based on the target input is not only related to the target input, but also related to the prompt word set by the target model. The target input is a question input by the user, and the question input by the user can be an input that can be supported by the model, such as text and images containing different types of characters. For example, the target input can be a question that the user has entered before, and the target input can also be a new question that the user enters for the first time. If the target input is a question that the user has entered before, the electronic device can directly parse the target input and retrieve the cached data related to the target input from the database; if the target input is a new question that the user enters for the first time, the target input can be given to the large language model, and the target input can be parsed by the large language model to obtain the cached data related to the target input.
[0055] S200, if the target input satisfies a first condition, processing the target input according to a first strategy, so that cache data related to the target input is stored within a cache validity period and cleared when invalid;
[0056] The first condition indicates that the target input includes a target character, and the time indicated by the target character can change with the current time; and the cache validity period is related to the target character and / or the current time.
[0057] In this embodiment, when parsing the target input, if the target input meets the first condition, the target input is processed according to the first strategy, so that the cache data related to the target input is stored within the cache validity period and is cleared when it expires; the first condition indicates that the target input contains the target character, and the time referred to by the target character can change with the change of the current time; for example, the target character can be a word used to indicate time, such as today, yesterday, etc., which are based on the current time and are used to indicate a specific date related to the current date. The cache validity period is related to the target character and / or the current time, and the cache validity period is set based on the time referred to by the target character and / or the current time. The first strategy is to obtain the cache data related to the target input according to the target character contained in the target input and the cache validity period of the cache data, or to obtain the cache data related to the target input according to the target character contained in the target input, and set the cache validity period for the cache data related to the target input. The cache data related to the target input is stored in the database within the cache validity period, and is cleared from the database when the cache validity period is exceeded.
[0058] Specifically, if the target input is a question that the user has entered before, and the cached data related to the target input is within the cache validity period, the cached data related to the target input can be retrieved from the database, and the data required by the user can be output based on the cached data related to the target input. For example, on June 1, the user enters the question "Help me check yesterday's sales data and who is the sales champion." The "yesterday" referred to in the question refers to a specific date related to the current date June 1, that is, May 31. The sales data on May 31 and the data related to the sales champion can be retrieved and presented to the user.
[0059] If the target input is a new question entered by the user for the first time, the target input can be given to the large language model, and the target input can be parsed by the large language model to obtain cache data related to the target input, and a cache validity period is set for the cache data related to the target input. For example, on June 1, the user first enters the question "Help me check yesterday's sales data and see who is the sales champion." The large language model will parse the user's question, generate cache data related to the question, and set a cache validity period for the cache data related to the question. The "yesterday" referred to in the question represents a specific date related to the current date of June 1, that is, May 31. Based on the current time of June 1 obtained for the question and the time May 31 referred to by the question, a cache validity period is set for the cache data related to the question. The cache validity period of the cache data related to the question is within June 1. After June 1, the cache data related to the question will be cleared from the database.
[0060] If the target input is a question that the user has entered before, but the cache data related to the target input is not within the cache validity period and has been cleared, the target input can be re-parsed to obtain the cache data related to the target input, and the data required by the user can be output based on the cache data related to the target input to avoid obtaining erroneous cache data that is not within the cache validity period. For example, the user enters the question "Help me check yesterday's sales data and who is the sales champion", and the "yesterday" referred to in the question refers to a specific date related to the current date June 2, that is, June 1. The sales data on June 1 and the data related to the sales champion can be retrieved and presented to the user. However, the cache validity period of the cache data related to the question is within June 1, and the current time is June 2, which has exceeded the cache validity period of the cache data related to the question, and the cache data related to the question has been cleared. In this case, the user's question can be re-parsed to generate cache data related to the question, set a cache validity period for the cache data related to the question, and present the relevant data of the question to the user.
[0061] In the above manner, the present application obtains cache data related to the target input according to the target character and the cache validity period of the cache data, or obtains cache data related to the target input according to the target character, and sets a cache validity period for the cache data related to the target input, so that the cache data related to the target input is stored within the cache validity period and cleared when invalidated. When the question input by the user is associated with time, the cache data related to the question within the cache validity period is obtained, and the relevant data of the question is presented to the user; and the cache data that is not within the cache validity period will not be obtained, so as to avoid presenting erroneous data to the user, and at the same time, the cache can be effectively managed to improve the cache utilization rate.
[0062] In one embodiment of the present application, the cache data includes level 1 cache data stored in the first cache space and level 2 cache data stored in the second cache space;
[0063] The first-level cache data includes user input and executable code output by the target model, and each user input corresponds to the executable code one by one;
[0064] In this embodiment, after parsing the question input by the user, the target model will output the executable code associated with the question. The target model can be a large language model, and each question corresponds to the executable code associated with the question. The question can contain a text vector, and the executable code can contain an SQL statement (Structured Query Language). The question and the corresponding executable code are a set of associated first-level cache data. The executable code is a machine-executable coded language, such as a Python script, which is used to query the data required by the user from the database to answer the user's question. The executable code in this embodiment is generated and output by the model. Specifically, the target model can parse the prompt words based on the question and generate executable codes associated with the prompt words. For example, the question input by the user is "Help me check yesterday's sales data who is the sales champion", the large language model can parse the prompt words "yesterday", "sales data", "sales champion" in the question, generate executable codes associated with the question, and store the question and the associated executable code as a set of associated first-level cache data in the first cache space.
[0065] The secondary cache data includes executable codes and display data output by the target model, each executable code corresponds to the display data one by one; and the corresponding display data can be obtained from the database by running the executable code;
[0066] In this embodiment, after the target model outputs the executable code associated with the question, the corresponding display data can be obtained from the database, and each executable code corresponds to the display data one by one. The display data is associated with the question input by the user, and the display data may include a data row or a data table associated with the question input by the user. The executable code and the corresponding display data are a set of associated secondary cache data. For example, the question input by the user is "Help me check yesterday's sales data and who is the sales champion". After the large language model generates the executable code associated with the question, it runs the executable code associated with the question, obtains the data row or data table corresponding to the question from the database, and stores the executable code associated with the question and the corresponding data row or data table as a set of associated secondary cache data in the second cache space.
[0067] The first-level cache data and the second-level cache data include or do not include a target flag that is within the cache validity period.
[0068] In this embodiment, in the process of parsing the question input by the user, if the time indicated by the characters contained in the question input by the user changes with the change of the current time, the cache validity period is set for the first-level cache data obtained by parsing the question input by the user, and the target flag within the cache validity period is set for the first-level cache data; the cache validity period is set for the second-level cache data obtained based on the first-level cache data, and the target flag within the cache validity period is set for the second-level cache data. The target flag can represent the timeliness label of the cache validity period of the cache data, and the target flag is set based on the cache validity period of the cache data. If the time indicated by the characters contained in the question input by the user does not change with the change of the current time, the cache validity period can be set for the first-level cache data obtained by parsing the question input by the user (the cache validity period is not reflected by the validity period flag, but is determined by the cache mechanism, such as the first-in-first-out mechanism of the cache queue, etc., of course, the cache validity period can also be not set. In this case, the cache data is permanently valid unless the user actively clears it), but there is no need to set the target flag within the cache validity period; the cache validity period can be set for the second-level cache data obtained based on the first-level cache data, but there is no need to set the target flag within the cache validity period.
[0069] In one embodiment of the present application, Figure 2 As shown, the processing of the target input according to the first strategy includes:
[0070] S210, if the first cache data contains user input that satisfies a second condition, obtaining executable code corresponding to the user input; the second condition indicates a similarity match and a target flag that is within the cache validity period;
[0071] In this embodiment, in the process of processing the target input according to the first strategy, the target input is first matched with the first cache data. If the first cache data contains user input that matches the target input in similarity, and the user input has a target flag that is within the cache validity period, it indicates that the target input is a question that the user has entered before, or the user has entered a question similar to the target input before, and the target input contains target characters, and the time referred to by the target characters can change with the current time; the user input and the target input have the same or similar target characters, and when the user input is stored, the cache validity period is set based on the time referred to by the target character and / or the current time of obtaining the user input, and the user input is within the cache validity period, the user input is trusted data, and the executable code corresponding to the user input can be directly obtained as the executable code corresponding to the target input.
[0072] For example, the user enters the target question "Help me check who is the sales champion in yesterday's sales data" at 23:00 on June 1st. The user entered the question "Who is the sales champion in yesterday's sales data" at 10:00 on June 1st. The first cache data related to the question is stored in the database, and the cache validity period and the time limit label are set for the first cache data related to the question. The time limit label indicates that the cache validity period of the first cache data related to the question is within June 1st. When the user enters the target question at 23:00 on June 1st, the questions similar to the target question in the first cache data are still within the cache validity period of June 1st, indicating that the first cache data is credible data, and the executable code corresponding to the questions similar to the target question can be directly retrieved.
[0073] S220: If the second cache data contains executable code that meets the second condition, obtain display data corresponding to the executable code.
[0074] In this embodiment, after matching with the first cache data, further matching is performed with the second cache data. Specifically, after obtaining the executable code corresponding to the user input, the executable code corresponding to the user input is matched with the second cache data. If the second cache data contains executable code that matches the executable code corresponding to the user input in similarity, and the executable code has a target flag that is within the cache validity period, it indicates that the executable code has set a cache validity period based on the time referred to by the target character and / or the current time of obtaining the user input when storing, and the executable code is within the cache validity period. The executable code is trusted data, and the display data corresponding to the executable code can be directly obtained as the display data corresponding to the target input.
[0075] For example, a user enters the target question "Help me check who is the sales champion in yesterday's sales data" at 23:00 on June 1st, and obtains the executable code corresponding to the question in the first cache data. The executable code corresponding to the question is matched with the second cache data. If the second cache data contains executable code that matches the executable code corresponding to the question in similarity, and the executable code has an expiration tag that is within the cache validity period, the expiration tag indicates that the cache validity period of the executable code is within June 1st, indicating that the second cache data is credible data, and the executable code corresponding to the question in the second cache data can be directly retrieved, and the data row or data table corresponding to the executable code can be obtained.
[0076] In one embodiment of the present application, Figure 3 As shown, the processing of the target input according to the first strategy further includes:
[0077] S230, if the first cache data contains user input that satisfies a second condition, obtaining executable code corresponding to the user input; the second condition indicates a similarity match and a target flag that is within the cache validity period;
[0078] In this embodiment, in the process of processing the target input according to the first strategy, the target input is first matched with the first cache data. If the first cache data contains user input that matches the target input in similarity, and the user input has a target flag that is within the cache validity period, it indicates that the target input is a question that the user has entered before, or the user has entered a question similar to the target input before, and the target input contains target characters, and the time referred to by the target characters can change with the current time; the user input and the target input have the same or similar target characters, and when the user input is stored, the cache validity period is set based on the time referred to by the target character and / or the current time of obtaining the user input, and the user input is within the cache validity period, the user input is trusted data, and the executable code corresponding to the user input can be directly obtained as the executable code corresponding to the target input.
[0079] S240: If there is no executable code satisfying the second condition in the second cache data, execute the executable code corresponding to the user input, and obtain display data corresponding to the executable code from a database;
[0080] In this embodiment, the executable code corresponding to the user input is matched with the second cache data. If there is no executable code in the second cache data that matches the executable code corresponding to the user input in similarity, or there is an executable code in the second cache data that matches the executable code corresponding to the user input in similarity, but the executable code does not have a target flag within the cache validity period; it indicates that there is no executable code associated with the executable code corresponding to the user input in the second cache data; or there is an executable code associated with the executable code corresponding to the user input in the second cache data, but the executable code does not set the target flag within the cache validity period when it is stored, and it is impossible to determine whether the parameter indicating time in the executable code is associated with the time indicated by the executable code corresponding to the user input, and the data obtained based on the executable code may be wrong data for the executable code corresponding to the user input. In this case, after obtaining the executable code corresponding to the user input in the first cache data, the executable code corresponding to the user input is executed, and the display data corresponding to the executable code is obtained from the database.
[0081] For example, on June 1, the user once input the question "Who is the sales champion according to yesterday's sales data?" and obtained the executable code associated with the question. The executable code associated with the question is run to obtain the data row or data table corresponding to the question from the database, and the executable code associated with the question and the corresponding data row or data table are stored in the second cache space as a set of associated secondary cache data. On June 2, the user again inputs the question "Help me check who is the sales champion according to yesterday's sales data?" and obtains the executable code associated with the question. The second cache data has an executable code that matches the executable code associated with the question in similarity. However, the executable code in the second cache data does not have a time limit tag set for the cache validity period, and the executable code cannot accurately represent the specific time range of its cache validity period. That is, when the user inputs the question about "Who is the sales champion according to yesterday's sales data" again on June 2, it is necessary to obtain the executable code corresponding to the question in the first cache data, and then execute the executable code corresponding to the question to obtain the data row or data table corresponding to the executable code from the database.
[0082] S250: Store the executable code corresponding to the user input and the display data corresponding to the executable code in the second cache space, and set a target flag within the cache validity period.
[0083] In this embodiment, the executable code corresponding to the user input is executed, and the display data corresponding to the executable code is obtained from the database, indicating that the time referred to by the target character contained in the target input has changed relative to the previous input of the same or similar question as the target input. In this case, the executable code corresponding to the user input and the display data corresponding to the executable code need to be stored in the second cache space, and the target flag within the cache validity period is set based on the time referred to by the target character contained in the target input and / or the current time of obtaining the target input.
[0084] For example, on June 2, the user enters the question again, "Help me check yesterday's sales data and see who is the sales champion." The executable code corresponding to the question is obtained from the first cache data, and then the executable code corresponding to the question is executed, and the display data corresponding to the executable code is obtained from the database. The "yesterday" referred to in the question refers to a specific date related to the current date June 2, that is, June 1. It is necessary to set a cache validity period and an expiration tag for the executable code and display data corresponding to the question based on the current time June 2 when the question is obtained and the time June 1 referred to by the question. The expiration tag indicates that the cache validity period of the executable code and display data related to the question is within June 2.
[0085] In one embodiment of the present application, Figure 4As shown, the processing of the target input according to the first strategy further includes:
[0086] S260: if there is no user input satisfying the second condition in the first cache data, parse the user input using the target model, and output executable code corresponding to the user input;
[0087] In this embodiment, in the process of processing the target input according to the first strategy, the target input is first matched with the first cache data. If there is no user input matching the similarity of the target input in the first cache data, or there is a user input matching the similarity of the target input in the first cache data, but the user input does not have a target flag within the cache validity period; it indicates that the target input is not a question that the user has entered before, or the user has entered a question similar to the target input, but it is impossible to determine whether the time indicated by the question is associated with the time referred to by the target input, and the executable code obtained based on the question may be wrong for the target input. In this case, the large language model can be used to parse the user input and output the executable code corresponding to the user input.
[0088] S270, storing the user input and the corresponding executable code in the first cache space, and setting a target flag within the cache validity period;
[0089] In this embodiment, after the user input is parsed using the target model and the executable code corresponding to the user input is output, the user input and the corresponding executable code are stored in the first cache space, and a target flag within the cache validity period is set. Specifically, the question input by the user is parsed using the large language model, and an executable code associated with the question is generated. The question and the associated executable code are stored as a set of associated first-level cache data in the first cache space, and a time-limit tag within the cache validity period is set for the question and the associated executable code.
[0090] S280, executing the executable code corresponding to the user input, and obtaining display data corresponding to the executable code from a database;
[0091] In this embodiment, after the target model is used to parse the user input and the executable code corresponding to the user input is generated, the executable code corresponding to the user input is executed to obtain the display data corresponding to the executable code from the database. Specifically, the executable code corresponding to the user input is executed to obtain the corresponding display data from the database, including the data row or data table associated with the question input by the user. The executable code and the corresponding display data can be used as a set of associated secondary cache data.
[0092] S290: Store the executable code corresponding to the user input and the display data corresponding to the executable code in the second cache space, and set a target flag within the cache validity period.
[0093] In this embodiment, after executing the executable code corresponding to the user input and obtaining the display data corresponding to the executable code from the database, the executable code corresponding to the user input and the display data corresponding to the executable code can be stored in the second cache space, and a target flag within the cache validity period is set. Specifically, the executable code corresponding to the question input by the user and the display data corresponding to the executable code are stored in the second cache space as a group of associated secondary cache data, and a time limit tag within the cache validity period is set for the executable code and the corresponding display data.
[0094] In one embodiment of the present application, the method further includes:
[0095] The display data corresponding to the executable code is counted to obtain the data row or data table associated with the user input, and the data row or data table associated with the user input is processed into a target structure for display.
[0096] In this embodiment, after executing the executable code corresponding to the user input, the display data corresponding to the executable code can be obtained from the database, the display data corresponding to the executable code can be counted, the data row or data table associated with the user input can be obtained, and the data row or data table associated with the user input can be processed into a target structure for display. For example, the question input by the user is "Help me check yesterday's sales data and who is the sales champion", and the executable code corresponding to the question is executed, and the data row or data table associated with the question can be obtained from the database, and the data row or data table associated with the question can be processed into a statistical chart of sales data for display to the user.
[0097] In one embodiment of the present application, Figure 5 As shown, the method also includes:
[0098] S300, monitoring the first-level cache data and the second-level cache data including a target flag within a cache validity period to determine whether the cache data associated with the target flag exceeds the cache validity period;
[0099] In this embodiment, after parsing the target input to obtain the first-level cache data and the second-level cache data including the target flag within the cache validity period, the first-level cache data and the second-level cache data including the target flag within the cache validity period are monitored to determine whether the cache data associated with the target flag has exceeded the cache validity period. Specifically, the user input and the executable code including the target flag within the cache validity period are monitored, and the executable code and the corresponding display data including the target flag within the cache validity period are monitored to determine whether the user input and the executable code associated with the target flag, and the executable code and the corresponding display data have exceeded the cache validity period.
[0100] S400: If the cache data associated with the target flag exceeds the cache validity period, delete the executable code and / or corresponding display data associated with the target flag.
[0101] In this embodiment, during the process of monitoring cache data including a target flag within the cache validity period, if the cache data associated with the target flag exceeds the cache validity period, the executable code and / or corresponding display data associated with the target flag are deleted. Specifically, if the user input and executable code including the target flag within the cache validity period exceed the cache validity period, the user input and executable code associated with the target flag are deleted; if the executable code and corresponding display data including the target flag within the cache validity period exceed the cache validity period, the executable code and corresponding display data associated with the target flag are deleted to avoid obtaining erroneous data.
[0102] In one embodiment of the present application, the method further includes:
[0103] If the target input does not satisfy the first condition, the target input is processed according to the second strategy, so that the cache data related to the target input is stored within the cache validity period, cleared when invalid, or the cache validity period is not set; the cache validity period is independent of the target character and / or the current time.
[0104] In this embodiment, when parsing the target input, if the target input does not meet the first condition, the target input is processed according to the second strategy, so that the cache data related to the target input is stored within the cache validity period, is invalidated and cleared, or the cache validity period is not set. The target input does not meet the first condition, indicating that the time referred to by the target input will not change with the change of the current time; the target input can be processed according to the second strategy, and the second strategy is to obtain the cache data related to the target input according to the content indicated by the target input and the cache validity period of the cache data, or to obtain the cache data related to the target input according to the content indicated by the target input, and set the cache validity period for the cache data related to the target input or not set the cache validity period. The cache validity period is independent of the target character and / or the current time. The cache validity period can be set to a fixed validity period, or set in the order of the generation time of the cache data. For example, when new cache data is generated, the cache data generated earlier in time will be cleared. When matching the target input with the cache data, it is not necessary to determine whether the cache data has an expiration tag; when storing the cache data associated with the target input, it is not necessary to set the expiration tag.
[0105] Figure 6 The structure diagram of the data processing device provided in the embodiment of the present application is shown, which specifically includes:
[0106] An acquisition module, configured to parse the target input in response to obtaining the target input;
[0107] a processing module, configured to process the target input according to a first strategy if the target input satisfies a first condition, so that cache data related to the target input is stored within a cache validity period and cleared when invalid;
[0108] The first condition indicates that the target input includes a target character, and the time indicated by the target character can change with the current time; and the cache validity period is related to the target character and / or the current time.
[0109] In one embodiment of the present application, the processing module is further configured to:
[0110] If the first cache data contains user input that satisfies a second condition, obtaining executable code corresponding to the user input; the second condition indicates a similarity match and a target flag that is within the cache validity period;
[0111] If the second cache data contains executable code that meets the second condition, display data corresponding to the executable code is obtained.
[0112] In one embodiment of the present application, the processing module is further configured to:
[0113] If the first cache data contains user input that satisfies a second condition, obtaining executable code corresponding to the user input; the second condition indicates a similarity match and a target flag that is within the cache validity period;
[0114] If there is no executable code satisfying the second condition in the second cache data, executing the executable code corresponding to the user input, and obtaining display data corresponding to the executable code from the database;
[0115] The executable code corresponding to the user input and the display data corresponding to the executable code are stored in the second cache space, and a target flag within the cache validity period is set.
[0116] In one embodiment of the present application, the processing module is further configured to:
[0117] If there is no user input satisfying the second condition in the first cache data, parsing the user input using the target model, and outputting executable code corresponding to the user input;
[0118] Storing the user input and the corresponding executable code in the first cache space, and setting a target flag within the cache validity period;
[0119] Executing the executable code corresponding to the user input, and obtaining display data corresponding to the executable code from a database;
[0120] The executable code corresponding to the user input and the display data corresponding to the executable code are stored in the second cache space, and a target flag within the cache validity period is set.
[0121] In one embodiment of the present application, the acquisition module is further configured as follows:
[0122] The display data corresponding to the executable code is counted to obtain the data row or data table associated with the user input, and the data row or data table associated with the user input is processed into a target structure for display.
[0123] In one embodiment of the present application, the processing module is further configured to:
[0124] Monitoring the first-level cache data and the second-level cache data including a target flag within a cache validity period to determine whether the cache data associated with the target flag exceeds the cache validity period;
[0125] If the cache data associated with the target flag exceeds the cache validity period, the executable code and / or corresponding display data associated with the target flag are deleted.
[0126] In one embodiment of the present application, the processing module is further configured to:
[0127] If the target input does not satisfy the first condition, the target input is processed according to the second strategy, so that the cache data related to the target input is stored within the cache validity period, cleared when invalid, or the cache validity period is not set; the cache validity period is independent of the target character and / or the current time.
[0128] like Figure 7 As shown, this embodiment also includes an electronic device, including:
[0129] A memory for storing executable programs;
[0130] The processor is used to execute the executable program to implement the above method.
[0131] Since the principle of solving the problem by the electronic device in the present application is similar to the above-mentioned method in the present application, the implementation of the electronic device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0132] Multiple embodiments of the present application are described in detail above, but the present application is not limited to these specific embodiments. Those skilled in the art can make various variations and modifications to the embodiments based on the concept of the present application, and these variations and modifications should all fall within the scope of protection required by the present application.
Claims
1. A data processing method, comprising: In response to obtaining a target input, parsing the target input; If the target input satisfies the first condition, the target input is processed according to the first policy, so that the cache data related to the target input is stored within the cache validity period and is cleared when invalid; The first condition indicates that the target input includes a target character, and the time indicated by the target character can change with the current time; and the cache validity period is related to the target character and / or the current time.
2. The data processing method according to claim 1, wherein the cache data includes first-level cache data stored in the first cache space and second-level cache data stored in the second cache space; The first-level cache data includes user input and executable code output by the target model, and each user input corresponds to the executable code in a one-to-one manner; The secondary cache data includes executable codes and display data output by the target model, and each executable code corresponds to the display data one by one; running the executable code can obtain the corresponding display data from the database; The first-level cache data and the second-level cache data include or do not include a target flag that is within a cache validity period.
3. The data processing method according to claim 2, wherein processing the target input according to the first strategy comprises: If the first cache data contains user input that meets the second condition, obtaining executable code corresponding to the user input; The second condition represents a similarity match and a target flag within the cache validity period; If the second cache data contains executable code that meets the second condition, display data corresponding to the executable code is obtained.
4. The data processing method according to claim 2, wherein processing the target input according to the first strategy comprises: If the first cache data contains user input that meets the second condition, obtaining executable code corresponding to the user input; The second condition represents a similarity match and a target flag within the cache validity period; If there is no executable code meeting the second condition in the second cache data, executing the executable code corresponding to the user input, and obtaining display data corresponding to the executable code from the database; The executable code corresponding to the user input and the display data corresponding to the executable code are stored in the second cache space, and a target flag within the cache validity period is set.
5. The data processing method according to claim 2, wherein processing the target input according to the first strategy comprises: If there is no user input that meets the second condition in the first cache data, parsing the user input using the target model and outputting executable code corresponding to the user input; Storing the user input and the corresponding executable code in the first cache space, and setting a target flag within the cache validity period; Executing the executable code corresponding to the user input, and obtaining display data corresponding to the executable code from a database; The executable code corresponding to the user input and the display data corresponding to the executable code are stored in the second cache space, and a target flag within the cache validity period is set.
6. The data processing method according to any one of claims 3 to 5, further comprising: The display data corresponding to the executable code is counted to obtain the data row or data table associated with the user input, and the data row or data table associated with the user input is processed into a target structure for display.
7. The data processing method according to any one of claims 3 to 5, further comprising: monitoring the first-level cache data and the second-level cache data including a target flag within a cache validity period to determine whether the cache data associated with the target flag exceeds the cache validity period; If the cache data associated with the target flag exceeds the cache validity period, the executable code and / or corresponding display data associated with the target flag are deleted.
8. The data processing method according to claim 2, further comprising: If the target input does not meet the first condition, process the target input according to the second strategy, so that the cache data related to the target input is stored within the cache validity period, is cleared upon expiration, or does not set a cache validity period; The cache validity period is independent of the target character and / or the current time.
9. A data processing device comprising: an acquisition module, configured to parse the target input in response to obtaining the target input; a processing module, configured to process the target input according to a first strategy if the target input satisfies a first condition, so that cache data related to the target input is stored within a cache validity period and cleared when invalid; The first condition indicates that the target input includes a target character, and the time indicated by the target character can change with the current time; and the cache validity period is related to the target character and / or the current time.
10. An electronic device comprising a memory and a processor, wherein the memory stores an executable program, and the processor executes the executable program to implement the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Server load balancing method and device
CN104601675A
Processing method and processing device for buffered data
CN106569733A
Data processing method and device, storage medium and electronic device
CN112711612A
Data processing method and device based on timeliness, electronic equipment and storage medium
CN113407714A
