Data caching and task processing method, device, equipment and storage medium
By caching the associated data according to the cache rules when receiving data requests, the problem of uncertain cache time points in the prior art is solved, and the data reading speed is improved.
Patent Information
- Application Number
- CN202010739298.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-28
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2040-07-28
AI Technical Summary
In the prior art, the data cache strategy cannot accurately determine the cache time point before reading the data, resulting in a reduced data reading speed or a timely cache.
By receiving a data request, a cache rule matching it is determined and data cached according to the cache rule, including data associated with the data request, is determined according to the cache rule before reading the data.
Ensure that the cache is completed before reading the data, improve the data reading speed, avoid cache during reading, and improve data access efficiency.
Smart Images

Figure CN113297267B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data caching and task processing method, apparatus, device, and storage medium. Background Art
[0002] In the field of data processing technology, data can usually be stored in a database and read from the database when needed. In order to increase the data reading speed, the data can usually be cached so that subsequent data reading can directly read the cache.
[0003] In the prior art, there are two main data caching strategies: the first is to read cached data and if no corresponding cached data exists, the data is read from the database for caching; the second is to cache all data in advance.
[0004] After studying the above solutions, the applicant found that the first solution would reduce the data reading speed, and the second solution required caching data at a time point before reading the data, but this time point could not be accurately determined, and thus it could not be guaranteed that the caching could be completed before reading the data. Summary of the Invention
[0005] The embodiment of the present application provides a data caching and task processing method to complete caching before reading data and improve the data reading speed.
[0006] Correspondingly, the embodiments of the present application also provide a data caching and task processing device, equipment and storage medium to ensure the implementation and application of the above method.
[0007] In order to solve the above problems, an embodiment of the present application discloses a data caching method, which includes: receiving a data request; determining whether there is a caching rule that matches the data request, caching data obtained according to the caching rule to read the cached data, and the data obtained by the caching rule includes: data associated with the data corresponding to the data request.
[0008] An embodiment of the present application discloses a task processing method, which includes: executing the first data task in response to an execution request of the first data task; caching data obtained according to a caching rule, wherein the data obtained according to the caching rule includes: data associated with the data corresponding to the first data task; and executing the second data task according to the cached data in response to an execution request of the second data task, wherein the second data task is a data task located after the first data task according to a preset sorting rule.
[0009] An embodiment of the present application also discloses a data caching device, which includes: a data request receiving module for receiving a data request; a data caching module for determining whether there is a caching rule that matches the data request, caching data obtained according to the caching rule, and reading the cached data, wherein the data obtained by the caching rule includes: data associated with the data corresponding to the data request.
[0010] An embodiment of the present application also discloses a task processing device, which includes: a first data task acquisition module, used to execute the first data task in response to an execution request of the first data task; a task data caching module, used to cache data obtained according to caching rules, and the data obtained according to the caching rules includes: data associated with the data corresponding to the first data task; a second data task execution module, used to execute the second data task according to the cached data in response to an execution request of the second data task, and the second data task is a data task located after the first data task determined according to a preset sorting rule.
[0011] An embodiment of the present application further discloses an electronic device, comprising: a processor; and a memory on which executable code is stored. When the executable code is executed, the processor executes a method as described in any one of the embodiments of the present application.
[0012] The embodiments of the present application also disclose one or more machine-readable media on which executable codes are stored. When the executable codes are executed, the processor executes the method as described in any one of the embodiments of the present application.
[0013] Compared with the prior art, the embodiments of the present application have the following advantages:
[0014] In an embodiment of the present application, when a data request is received, data associated with the data corresponding to the data request can be cached according to the cache rules, so that when reading the data, it can be read from the cached data. When the present application receives a data request before reading the data, the data is cached according to the cache rules to ensure that the data caching is completed before the data is read, avoiding data caching when reading the data, which helps to improve the data reading speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a structural diagram of a service system of this application;
[0016] Figure 2 This is a schematic diagram of the process of processing a data read request by a service system of the present application;
[0017] Figure 3 This is a schematic diagram of the process of processing a data write request by a service system of the present application;
[0018] Figure 4 This is a flowchart of the steps of an embodiment of a data caching method of the present application;
[0019] Figure 5 This is a schematic diagram of the interaction between a management client and a rule server in this application;
[0020] Figure 6 This is a flowchart of the steps of an embodiment of a task processing method of the present application;
[0021] Figure 7 This is a structural block diagram of an embodiment of a data cache device of the present application;
[0022] Figure 8 This is a structural block diagram of an embodiment of a task processing device of the present application;
[0023] Figure 9 It is a structural diagram of a device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0025] This application is used to cache data associated with the read data or the written data when reading data from the storage service end or writing data to the storage service end, so as to improve the subsequent reading speed of the data. This application can be applied to any application scenario that requires reading data from the storage service end or writing data to the storage service end, one of which is a typical application scenario such as Figure 1 In the service system shown, the scheduling server is connected to the user client, cache server, storage service, and rule server respectively. Users can operate on the user client to access the page, and the user client generates a data request based on the user operation and sends it to the scheduling server; when the data request is a data read request, such as Figure 2 The service system shown in the figure processes data read requests. After receiving the data read request, the scheduling server reads data from the storage service according to the data read request. On the other hand, the scheduling server sends a rule acquisition request to the rule server to obtain the cache rule and matches the data read request with the cache rule. If the match is successful, the data obtained by the matching cache rule is cached to the cache server. When the data request is a data write request, such as Figure 3The diagram shows the process of the service system processing data write requests. After receiving the data write request, the scheduling server, on the one hand, writes data to the storage service according to the data write request. On the other hand, the scheduling server also sends a rule acquisition request to the rule server to obtain the cache rule, and matches the data write request with the cache rule. If the match is successful, the data obtained by the matching cache rule is cached to the cache server.
[0026] Among them, the user client is the client corresponding to the scheduling server. The user client provides services to users. The user client can be an application running on any physical device. The physical device may include but is not limited to: mobile phones, PCs (Personal Computers), and tablet computers.
[0027] The scheduling server is the background server of the user client, which is used to receive data requests from the user client and return response data to the user client according to the data request. The response data can be the success information of the user client reading data or the user client writing data.
[0028] The storage service client is used to store data in the form of hard disks, magnetic disks, etc. The commonly used storage service client is the database.
[0029] The cache server is used to cache data. Its data storage method is different from that of the storage service. The cache server stores data in the cache. The data reading speed of the cache server is faster than that of the storage service.
[0030] The rule server is used to store cache rules, which are used to determine the relationship between cached data and the data corresponding to the data request. The cache rules can be pre-configured. When configuring cache rules, the correlation between the data can be determined according to the specific application scenario and requirements, so as to configure the cache rules according to the correlation between the data. For example, a cache rule can be set based on the associated data DATA1 and data DATA2. For example, if data DATA3 is associated with data DATA4 and data DATA5 respectively, a cache rule can be constructed based on data DATA3 and data DATA4, and another cache rule can be constructed based on data DATA3 and data DATA5, or only one cache rule can be constructed based on data DATA3 and DATA4 and DATA5.
[0031] It can be understood that the scheduling server, cache server, storage service and rule server can be servers that respectively implement the above functions. These servers can all be physical servers or virtual machines set on physical servers. One or more virtual machines can be set on a physical server, and one physical server can be set with a virtual machine with multiple functions. For example, the scheduling server and the rule server can be set in one physical server, the cache server can be set in one physical server, and the storage service can be set in one physical server.
[0032] Based on the above service system, the present application is described in detail from the scheduling service side below, and the steps in the following embodiments are executed by the scheduling service side.
[0033] Reference Figure 4 , shows a step flow chart of an embodiment of a data caching method of the present application.
[0034] Step 101: Receive a data request.
[0035] The data request includes a data write request and a data read request. The data write request is used to store data to the storage service end, and the data read request is used to read data from the storage service end.
[0036] Step 102: Determine whether there is a cache rule matching the data request, cache data obtained according to the cache rule, and read the cached data. The data obtained according to the cache rule includes data associated with the data corresponding to the data request.
[0037] Specifically, the data request carries a data identifier, so that the data identifier in the data request can be matched with the specified data identifier in the cache rule. If the data identifier in the data request is consistent with the specified data identifier in the cache rule, it is determined that the data request matches the cache rule; if the data identifier in the data request is inconsistent with the specified data identifier in the cache rule, it is determined that the data request does not match the cache rule. In this application, the cache rule that caches data associated with the data corresponding to the data request can be referred to as the first type of cache rule, and the specified data identifier is referred to as the first data identifier in the first type of cache rule. In addition, in actual applications, there is also a cache rule that caches data corresponding to the data request, which can be referred to as the second type of cache rule, and the specified data identifier is referred to as the third data identifier in the second type of cache rule.
[0038] For example, there are five first-type cache rules in the following format: DATAID1-DATAID2, DATAID3-DATAID4, DATAID5-DATAID6, DATAID7-DATAID8, DATAID9-DATAID10, where DATAID1, DATAID3, DATAID5, DATAID7, and DATAID9 are the first data identifiers of the five cache rules respectively, the data identifier in the data request REQ1 is DATAID1, and the data identifier in the data request REQ2 is DATAID2, so the data request REQ1 matches the cache rule with the first data identifier DATAID1; there is no matching cache rule for the data request REQ2.
[0039] For another example, there are five second-type cache rules in the following format: DATAID11, DATAID12, DATAID13, DATAID14, DATAID15, where DATAID11, DATAID12, DATAID13, DATAID14, DATAID15 are all third data identifiers in the cache rules, the data identifier in the data request REQ3 is DATAID11, and the data identifier in the data request REQ4 is DATAID16, so the data request REQ3 matches the cache rule with the third data identifier DATAID11; there is no matching cache rule for the data request REQ4.
[0040] In actual applications, different cache rules can also be set for different types of data requests, specifying whether the data request to which the cache rule applies is a data write request or a data read request. For example, for the cache rule: "write": ["DATAID1"], it means that the cache rule is used for data write requests, and the write data of the data write request is cached, and the data identifier of the write data of the data write request is DATAID1. For another example, for the cache rule: "read": {"DATAID1": ["DATAID2", "DATAID3"]}, it means that the cache rule is used for data read requests, and the data associated with the read data of the data read request is cached, and the data identifier of the read data of the data read request is DATAID1, and the data identifiers of the data associated with the read data of the data read request are DATAID2 and DATAID3.
[0041] In the present application, the first type of cache rule is used to cache data associated with the data corresponding to the data request, and the second type of cache rule is used to cache the data corresponding to the data request.
[0042] Specifically, in one example, a first data identifier and a second data identifier associated with the first data identifier can be specified in a first type of cache rule, so that when the data identifier in the data request is consistent with the first data identifier, the data associated with the data corresponding to the data request is cached. For example, there are five cache rules in the following format: DATAID1-DATAID2, DATAID3-DATAID4, DATAID5-DATAID6, DATAID7-DATAID8, DATAID9-DATAID10, where DATAID1, DATAID3, DATAID5, DATAID7, and DATAID9 are the first data identifiers of the five cache rules respectively, and DATAID2, DATAID4, DATAID6, DATAID8, and DATAID10 are the second data identifiers. For the data request REQ1, the corresponding data is the data corresponding to the data identifier DATAID1. Since the data identifier associated with the first data identifier DATAID1 is the second data identifier DATAID2, the data associated with the data corresponding to the data request REQ1, that is, the data corresponding to the second data identifier DATA2, can be cached.
[0043] In another example, a third data identifier can be specified in the second type of cache rule, thereby caching the data corresponding to the data request when the data identifier in the data request is consistent with the third data identifier. For example, there are five cache rules in the following format: DATAID11, DATAID12, DATAID13, DATAID14, DATAID15, where DATAID11, DATAID12, DATAID13, DATAID14, and DATAID15 are third data identifiers. For data request REQ3, the corresponding data is the data corresponding to data identifier DATAID11, thereby caching the data corresponding to the third data identifier DATA11.
[0044] It should be noted that if there is no caching rule matching the data request, data caching will not be performed. For example, when the above data requests REQ2 and REQ4 are received, data caching will not be performed.
[0045] Optionally, the cache rule carries a first data identifier and a second data identifier; and determining that there is a cache rule matching the data request and caching the data obtained according to the cache rule includes sub-step 1021:
[0046] Sub-step 1021: Determine whether there is a cache rule in which the first data identifier matches the data identifier corresponding to the data request, and cache the data corresponding to the second data identifier carried by the matching cache rule.
[0047] It is understandable that a first data identifier and an associated second data identifier are set in the cache rule, wherein the first data identifier is used to determine whether the cache rule matches the data request, and the second data identifier is used to determine the cached data when the match is successful.
[0048] In actual applications, in order to distinguish the first data identifier from the second data identifier, the first data identifier and the second data identifier can be set in a preset order and separated by a separator. For example, DATAID1-DATAID2, wherein the identifier DATAID1 located before the separator "-" is the first data identifier, and the identifier DATAID2 located after the separator "-" is the second data identifier. For another example, DATAID1-DATAID2-DATAID3-DATAID4, wherein the identifier DATAID1 located before the first separator "-" is the first data identifier, and the identifiers DATAID2, DATAID3 and DATAID4 located after each separator "-" are all second data identifiers, thereby realizing the caching of the data corresponding to the three data identifiers DATAID2, DATAID3 and DATAID4 associated with the first data identifier DATAID1.
[0049] In this application, since the cached data is data associated with the data corresponding to the data request, regardless of whether the data request is a data read request or a data write request, the cached data needs to be obtained from the storage service end and sent to the cache server end for caching.
[0050] The present application can implement associated data caching through a first type of caching rule consisting of a first data identifier and a second data identifier.
[0051] In actual applications, in addition to caching data corresponding to the data associated with the data request, the cache rule may also cache data associated with the data request. Specifically, the cache rule carries a third data identifier. When there is a cache rule matching the data request, the data determined according to the cache rule is cached, including sub-step 1022:
[0052] Sub-step 1022: determining whether there is a cache rule in which the third data identifier matches the data identifier corresponding to the data request, and caching the data corresponding to the third data identifier carried by the matching cache rule.
[0053] It's understood that the third data identifier is set in the cache rule. This third data identifier is used not only to determine whether the cache rule matches the data request, but also to determine the cached data if a match is successful. It should be noted that the first and second data identifiers are used to distinguish two different identifiers within the same cache rule, while the third data identifier is used to distinguish between different cache rules.
[0054] Under normal circumstances, the first data identifier and the second data identifier have different values. Under special circumstances, when the first data identifier and the second data identifier have the same value, the cache rule has the same effect as the cache rule containing the third data identifier. For example, for a cache rule of DATAID1-DATAID1, the first data identifier and the second data identifier are both DATAID1, thereby caching the data corresponding to the data identifier DATAID1; and for a cache rule of DATAID1, the third data identifier is DATAID1, thereby also caching the data corresponding to the data identifier DATAID1.
[0055] Based on the above principles, in order to save storage resources on the rule server, if the data corresponding to the data request is to be cached, a cache rule consisting of a third data identifier can be set, and a cache rule consisting of two identical first data identifiers and second data identifiers can be avoided. The two identical first data identifiers and second data identifiers store the same data identifier twice, while the third data identifier only stores the data identifier once.
[0056] In this application, a cache rule can set only one third data identifier or multiple third data identifiers. For example, data identifier DATAID1, so data identifier DATAID1 is the third data identifier, which is used to cache the data corresponding to data identifier DATAID1. For another example, DATAID1~DATAID2~DATAID3~DATAID4, where the four identifiers before or after the delimiter "~" are all third data identifiers, to cache the data corresponding to data identifier DATAID1, data identifier DATAID2, data identifier DATAID3, and data identifier DATAID4.
[0057] It can be seen that when there is no delimiter in the cache rule, the only identifier in the cache rule is the third data identifier, and the cache rule is used to cache the data corresponding to the third data identifier. When there is a delimiter in the cache rule, different delimiters can be used to determine different cache rules, that is, to determine whether the cache rule is used to cache the data corresponding to the third data identifier or to cache the data corresponding to the second data identifier associated with the first data identifier. If the delimiter included in the cache rule is the first preset delimiter, the cache rule is determined to be used to cache the data corresponding to the second data identifier associated with the first data identifier; if the delimiter included in the cache rule is the second preset delimiter, the cache rule is determined to be used to cache the data corresponding to the third data identifier. For example, the above-mentioned delimiter “-” is the first preset delimiter, and the above-mentioned delimiter “~” is the second preset delimiter. For the cache rule: DATAID1-DATAID2-DATAID3-DATAID4, since it contains the first preset delimiter “-”, the cache rule is used to cache the data corresponding to the second data identifier associated with the first data identifier; for the cache rule: DATAID1~DATAID2~DATAID3~DATAID4, since it contains the second preset delimiter “~”, the cache rule is used to cache the data corresponding to the third data identifier.
[0058] In addition, in order to simultaneously cache the data corresponding to the data request and the data associated with the data corresponding to the data request, a cache rule consisting of a first data identifier and a second data identifier can be set, and a cache rule consisting of a third data identifier can be set at the same time, and the first data identifier and the third data identifier are the same. In this way, when a data request is received, if the data identifier corresponding to the data request is the same as the first data identifier and the third data identifier, the data corresponding to the data request and the data associated with the data corresponding to the data request can be cached at the same time.
[0059] The present application can cache the data corresponding to the third data identifier through a cache rule composed of the third data identifier.
[0060] Optionally, based on the above sub-step 1022, caching the data corresponding to the third data identifier carried by the matching caching rule includes sub-steps 10221 to 10222:
[0061] Sub-step 10221: If the data request is a data read request, the data corresponding to the third data identifier is obtained from the storage service end for caching.
[0062] Sub-step 10222: If the data request is a data write request, extract the write data from the data write request as the data corresponding to the third data identifier for caching.
[0063] It can be understood that when the data request is a data read request, the data corresponding to the data request is the read data of the data read request, and the read data needs to be obtained from the storage service end and sent to the cache server for caching; when the data request is a data write request, the data corresponding to the data request is the write data carried in the data write request, and the write data can be extracted from the data write request and sent to the cache server for caching.
[0064] When caching data corresponding to a data request, the present application can determine the source of the cached data based on the type of data request, so that the written data can be directly cached when the data is written, which helps to improve the caching speed.
[0065] Optionally, caching the data obtained according to the caching rule includes sub-step 1023:
[0066] Sub-step 1023: Send a cache data write request to the cache server to store the data obtained by the cache rule in the cache server.
[0067] Among them, the cache data write request is sent by the scheduling server to the cache server. The cache data write request carries the data obtained by the cache rule. The data obtained by the cache rule can be called cache data after caching. The data obtained by the cache rule here includes the data associated with the data corresponding to the data request in sub-step 1021.
[0068] Specifically, caching can be performed in a synchronous manner, that is, a cache data write request is sent immediately after the data is determined according to the cache rule. The synchronous caching helps to improve the real-time performance of the cache.
[0069] In addition, caching can also be performed asynchronously. For example, cache data write requests are sent at preset time intervals. When the data requests successfully match the cache rules a large number of times, asynchronous caching helps avoid continuously sending cache data write requests and occupying transmission resources between the scheduling server and the cache server.
[0070] Optionally, the determining that there is a cache rule matching the data request and caching the data obtained according to the cache rule includes sub-steps 1024 to 1025:
[0071] Sub-step 1024, obtaining preset cache rules from the rule server.
[0072] The preset caching rules may be some or all of the caching rules in the rule server. Some caching rules may be determined by a certain policy. For example, a caching rule for a storage service client may be used to cache data on the storage service client. Another example is a caching rule for a certain type of data request, which may be used to cache data for that type of data request.
[0073] Sub-step 1025: determining whether there is a cache rule matching the data request in the preset cache rules, and caching the data obtained according to the cache rule.
[0074] Specifically, a cache rule whose first data identifier matches the data identifier in the data request, or a cache rule whose third data identifier matches the data identifier in the data request is determined from some or all cache rules as the cache rule that matches the data request.
[0075] Optionally, before obtaining the preset cache rules from the rule server, steps 103 to 104 are further included:
[0076] Step 103: Receive a first cache rule write request from the management client, where the first cache rule write request includes an identifier of the storage space and a corresponding cache rule.
[0077] The management client is used to manage cache rules, including but not limited to: configuring cache rules, deleting cache rules, and modifying cache rules. Figure 5 The diagram shows the interaction between the management client and the rule server. The management client communicates with the rule server and can manage cache rules in the rule server through rule management requests. The rule management requests carry newly configured cache rules, deleted cache rules, or modified cache rules. The management client provides a management interface where rule maintainers can view all cache rules, select a cache rule to delete or modify, and configure a new cache rule.
[0078] After a user configures and submits a new cache rule, the management client generates a cache rule write request that carries the cache rule. If the cache rule also includes a storage space identifier, this cache rule is referred to as a first cache rule write request. The storage space is the storage space on the storage service client specified by the user when configuring the cache rule. Therefore, the cache rule applies only to caching data within that storage space and not to data in other storage spaces.
[0079] A bucket is a container for storing data, and each piece of data belongs to one of the buckets. It is understood that a cache rule can be set to one or more applicable buckets.
[0080] Sub-step 104: storing the identifier of the storage space and the corresponding cache rule in the rule server according to the corresponding relationship.
[0081] In this application, data of the same type of service can be stored in the same storage space to facilitate reading and writing data.
[0082] This application can configure cache rules based on the storage space, avoiding the need to set cache rules separately for each service in the storage space, saving storage resources on the rule server.
[0083] Based on the sub-steps 103 to 104, the step of obtaining the preset cache rules from the rule server includes sub-steps 10241 to 10242:
[0084] Sub-step 10241: Determine the identifier of the storage space where the data corresponding to the data request is located.
[0085] In one example, the identifier of the storage space may be added by the user client to the data request; in another example, the identifier of the storage space may be determined when reading or writing data.
[0086] Sub-step 10242: Acquire, from a rule server according to the identifier of the storage space, a cache rule corresponding to the storage space as a preset cache rule.
[0087] Specifically, when the identifier of the storage space where the data corresponding to the data request is located is consistent with the identifier of one of the storage spaces in the rule server, it is determined that the cache rule corresponding to the identifier of the storage space is the preset cache rule.
[0088] This application can obtain the cache rules corresponding to the storage space where the data corresponding to the data request is located to cache the data, thereby realizing storage space-based caching.
[0089] Optionally, before obtaining the preset cache rules from the rule server, steps 105 to 106 are further included:
[0090] Step 105: Receive a second cache rule write request from the client, where the second cache rule write request includes data attributes and corresponding cache rules.
[0091] When a cache rule also includes a data attribute, the cache rule is referred to as a second cache rule write request. The data attribute is specified by the user when configuring the cache rule, so the cache rule only caches data with that data attribute and does not cache data with other data attributes. For example, a service type can be used as a data attribute. When configuring a cache rule, the user can specify a service type to cache data for that service type.
[0092] It will be appreciated that a cache rule may set one or more applicable data attributes.
[0093] Step 106: Store the data attributes and corresponding cache rules in the rule server according to the corresponding relationship.
[0094] This application can configure caching rules based on data attributes. For a special service, personalized caching rules can be set for it.
[0095] The step of obtaining the preset cache rules from the rule server includes sub-steps 10243 to 10244:
[0096] Sub-step 10243: Determine the data attribute corresponding to the data request.
[0097] In one example, the data attributes may be added by the user client to the data request; in another example, the data attributes may be determined when reading or writing data.
[0098] Sub-step 10244: Obtain corresponding cache rules from the rule server according to the data attributes as preset cache rules.
[0099] Specifically, when the data attribute corresponding to the data request is consistent with one of the data attributes in the rule server, it is determined that the cache rule corresponding to the data attribute is the preset cache rule.
[0100] This application can obtain the cache rules corresponding to the data attributes corresponding to the data request to cache the data, thereby realizing personalized caching.
[0101] Optionally, the data is stored in units of data objects, and the data objects include: data identification, data attributes and data content.
[0102] Among them, the data object (Object) is the basic unit for storing data, which can also be called a storage object. The data identifier in the data object is used to uniquely identify the data object, and the data attribute is used to represent the attribute information of the data. It can be expressed in the form of a key-value pair, with the primary key being the attribute identifier and the value being the attribute value; the data content is the specific data of the data object. For example, if the data object is represented by {data identifier, primary key: value, data content}, the following example can be obtained: {DATAID1, DATATYPE: CHAR, XIAOMING}, where DATAID1 is the data identifier, DATATYPE is the primary key of the data attribute, and CHAR is the value of the data attribute, that is, the data attribute is the data type, the data type is specifically character type, and the data content is XIAOMING.
[0103] The data cache of the present application can be applied to application scenarios in which data is stored in units of data objects. Data objects are usually stored in a storage space, thereby achieving caching of data objects.
[0104] Optionally, based on the data corresponding to the data request cached in sub-steps 1022, 10221, and 10222, the method further includes steps 107 to 108:
[0105] Step 107: Receive a data deletion request.
[0106] The data deletion request carries a data identifier to be deleted, so as to delete the data corresponding to the data identifier to be deleted from the storage service end. The data identifier to be deleted is the data identifier corresponding to the data deletion request.
[0107] Step 108: If the data identifier corresponding to the data deletion request matches the third data identifier, the data corresponding to the data deletion request is deleted from the cached data.
[0108] The data corresponding to the data deletion request is the data corresponding to the to-be-deleted identifier.
[0109] In this application, when the identifier of the data to be deleted matches the third data identifier in the cache rule, it is determined that the data deletion request matches the cache rule, and the data corresponding to the identifier of the data to be deleted is deleted from the cache server. When the identifier of the data to be deleted does not match the third data identifier in the cache rule, it is determined that there is no matching cache rule for the data deletion request, indicating that the data to be deleted is not cached, and thus there is no need to delete the cached data from the cache server.
[0110] After receiving a data deletion request, this application does not directly delete the cached data from the cache server, but first determines whether the data deletion request matches the cache rule. In this way, when the data corresponding to the data identifier to be deleted is not cached according to the cache rule, the cached data will not be deleted from the cache server, thereby saving the time consumed in searching the cache server for the data corresponding to the identifier to be deleted.
[0111] In summary, the present application provides a data caching method, which includes: receiving a data request; determining whether there is a caching rule that matches the data request, caching the data obtained according to the caching rule, and reading the cached data, wherein the data obtained by the caching rule includes: data associated with the data corresponding to the data request. When receiving a data request, the present application can cache the data associated with the data corresponding to the data request according to the caching rule, so that the data can be read from the cached data when reading the data. When receiving a data request before reading the data, the present application caches the data according to the caching rule, ensuring that the data caching is completed before the data is read, avoiding data caching when reading the data, and helping to improve the data reading speed.
[0112] Reference Figure 6 , shows a step flow chart of an embodiment of a task processing method of the present application.
[0113] Step 201: In response to an execution request of a first data task, execute the first data task.
[0114] The first data task is any task for processing data, including but not limited to: a data writing task and a data reading task. The data writing task is used to store data to the storage service end, and the data reading task is used to read data from the storage service end.
[0115] Step 202: Cache the data obtained according to the caching rule, where the data obtained according to the caching rule includes: data associated with the data corresponding to the first data task.
[0116] When the first data task is a data writing task, the data corresponding to the first data task is write data; when the first data task is a data reading task, the data corresponding to the first data task is read data.
[0117] The present application is used to cache data associated with write data and / or data associated with read data when a first data task is received. In one example, a first data identifier and a second data identifier associated with the first data identifier can be specified in a cache rule, so that when the data identifier in the first data task is consistent with the first data identifier, the data associated with the data corresponding to the first data task is cached. For example, there are five cache rules in the following format: DATAID1-DATAID2, DATAID3-DATAID4, DATAID5-DATAID6, DATAID7-DATAID8, DATAID9-DATAID10, where DATAID1, DATAID3, DATAID5, DATAID7, and DATAID9 are the first data identifiers of the five cache rules respectively, and DATAID2, DATAID4, DATAID6, DATAID8, and DATAID10 are the second data identifiers. For the first data task TASK1, the corresponding data is the data corresponding to the data identifier DATAID1. Since the data associated with the data of the first data identifier DATAID1 is the data corresponding to the second data identifier DATA2, the data associated with the data corresponding to the first data task TASK1, that is, the data corresponding to the second data identifier DATA2, can be cached.
[0118] In actual applications, in addition to caching data associated with the data corresponding to the first data task, the data corresponding to the first data task can also be cached. Specifically, a third data identifier can be specified in the cache rule, so that when the data identifier corresponding to the first data task is consistent with the third data identifier, the data corresponding to the first data task is cached. For example, there are five cache rules in the following format: DATAID11, DATAID12, DATAID13, DATAID14, DATAID15, where DATAID11, DATAID12, DATAID13, DATAID14, DATAID15 are third data identifiers. For the first data task TASK2, the corresponding data is the data corresponding to the data identifier DATAID11, thereby caching the data corresponding to the third data identifier DATA11.
[0119] It should be noted that if there is no cache rule matching the first data task, data caching is not performed.
[0120] Step 203 : In response to an execution request of a second data task, executing the second data task according to the cached data, wherein the second data task is a data task that is determined to be located after the first data task according to a preset sorting rule.
[0121] In the present application, the second data task is executed after the first data task, so that the data corresponding to the second data task can be cached in advance when the first data task is executed, so that the data corresponding to the second data task can be directly read from the cache server when the second data task is executed, without the need to obtain the corresponding data from the storage service when the second data task is executed, thereby improving the data reading speed of the second data task and improving the execution efficiency of the second data task.
[0122] The execution order between the above-mentioned first data task and the second data task is determined according to a preset sorting rule, which may include but is not limited to: a sorting rule based on a preset time sequence between data reading tasks, and a sorting rule based on the dependency relationship between data tasks.
[0123] Optionally, the first data task and the second data task are both data read requests, the preset sorting rule includes: a sorting rule based on a preset time sequence between data read tasks, the data obtained according to the cache rule includes data associated with the data corresponding to the first data task, and executing the second data task based on the cached data includes sub-step 2031:
[0124] Sub-step 2031 : Read the cached data as read data for the second data task.
[0125] In one application scenario, the read data of multiple data reading tasks is sequential. Therefore, it is necessary to determine the time sequence of the multiple data reading tasks based on this sequence so that the reading tasks can be executed in this time sequence. Finally, the read data of these multiple data reading tasks are concatenated into the total response data in this order. Therefore, based on the pre-set time sequence sorting rule between the data reading tasks, the earlier data reading tasks can be sorted before the later data reading tasks, so that the later data reading tasks can be executed after the earlier data reading tasks.
[0126] This application can sort the earlier data reading tasks before the later data reading tasks, and cache the read data of the later data reading tasks when executing the earlier data reading tasks, so that when executing the later data reading tasks, the cached data can be read from the cache server as the later read data, which helps to improve the execution efficiency of the data reading tasks.
[0127] In practical applications, in addition to caching data associated with the data corresponding to the first data task, data corresponding to the first data task may also be cached. The preset sorting rules include: sorting rules based on dependencies between data tasks, the first data task is a data write task, the second data task is a data read task, the data obtained according to the caching rules include: data corresponding to the first data task, and executing the second data task based on the cached data includes sub-step 2032:
[0128] Sub-step 2032: Read the cached data as the read data of the second data task.
[0129] In one application scenario, the data written by a data writing task TASK1 is usually used as the read data of a data reading task TASK2. This relationship between the data writing task TASK1 and the data reading task TASK2 is called a dependency relationship between data tasks, and the data reading task TASK2 depends on the data writing task TASK1. In this application, the data writing task TASK1 can be called the first data task, and the data reading task TASK2 can be called the second data task, that is, the second data task depends on the first data task. Based on the sorting rules of the dependency relationship between data tasks, the dependent first data task can be sorted before the second data task that depends on the first data task, so that the second data task can be executed after the first data task is executed.
[0130] This application can sort the dependent data writing tasks before the data reading tasks, and cache the write data when executing the data writing tasks, so that when executing the data reading tasks, the cached data can be read from the cache server as the read data of the data reading tasks, which helps to improve the execution efficiency of the data reading tasks.
[0131] Optionally, the preset sorting rule includes a sorting rule based on a dependency relationship between data tasks, the second data task is a data calculation task, the data obtained according to the cache rule includes data corresponding to the first data task, and executing the second data task based on the cached data includes sub-step 2033:
[0132] Sub-step 2033: Read the cached data as input data for the second data task to perform data calculation, so as to perform data calculation of the second data task.
[0133] In an application scenario, the data corresponding to a data task TASK1 is usually used as the input data of a data calculation task TASK2, so as to perform data calculation on the input data to obtain a calculation result. This relationship between data task TASK1 and data calculation task TASK2 is called a dependency relationship between data tasks, and data calculation task TASK2 depends on data task TASK1. In this application, data task TASK1 can be called the first data task, and data calculation task TASK2 can be called the second data task, that is, the data calculation task depends on the first data task. The sorting rule based on the dependency relationship between data tasks can sort the dependent first data task before the data calculation task that depends on the first data task, so that the data calculation task is executed after the first data task is executed.
[0134] The present application can sort the dependent first data task before the data calculation task, and cache the data corresponding to the first data task, that is, read data or write data, when executing the first data task, so that when executing the data calculation task, the cached data can be read from the cache server as the input data of the data calculation task, which helps to improve the execution efficiency of the data calculation task.
[0135] In summary, the present application provides a task processing method, the method comprising: in response to an execution request of a first data task, executing the first data task; caching data obtained according to a cache rule, the data obtained according to the cache rule comprising: data associated with the data corresponding to the first data task; in response to an execution request of a second data task, executing the second data task according to the cached data, the second data task being a data task located after the first data task determined according to a preset sorting rule. The present application can cache data associated with the data corresponding to the first data task during the execution of the first data task before the execution of the second data task, and when executing the second data task, can execute the second data task according to the cached data, thereby avoiding reading data from the storage service end when executing the second data task, helping to improve the data reading speed when executing the second data task, and thereby improving the execution efficiency of the second data task.
[0136] Reference Figure 7 , shows a structural block diagram of an embodiment of a data caching device of the present application.
[0137] The data request receiving module 301 is configured to receive a data request.
[0138] The data cache module 302 is used to determine whether there is a cache rule matching the data request, cache the data obtained according to the cache rule, and read the cached data. The data obtained according to the cache rule includes: data associated with the data corresponding to the data request.
[0139] Optionally, the cache rule carries a first data identifier and a second data identifier; the data cache module 302 includes a first data cache submodule:
[0140] The first data caching submodule is configured to determine whether there is a caching rule in which the first data identifier matches the data identifier corresponding to the data request, and cache data corresponding to the second data identifier carried by the matching caching rule.
[0141] Optionally, the data cache module 302 includes a cache write request sending submodule:
[0142] The cache write request sending submodule is used to send a cache data write request to the cache server to store the data obtained by the cache rule in the cache server.
[0143] Optionally, the data caching module 302 includes a preset caching rule acquisition submodule and a caching rule determination submodule:
[0144] The preset cache rule acquisition submodule is used to obtain the preset cache rules from the rule server.
[0145] The third data caching submodule is configured to determine whether a caching rule matching the data request exists in the preset caching rules, and cache the data obtained according to the caching rule.
[0146] Optionally, the device further includes a first rule writing module and a first rule storage module:
[0147] The first rule writing module is configured to receive a first cache rule writing request from a management client, where the first cache rule writing request includes an identifier of a storage space and a corresponding cache rule.
[0148] The first rule storage module is configured to store the identifier of the storage space and the corresponding cache rule in the rule server according to a corresponding relationship.
[0149] Based on the first rule writing module and the first rule storage module, the preset cache rule acquisition submodule includes a storage space determination unit and a first preset cache rule acquisition unit:
[0150] The storage space determining unit is used to determine the identifier of the storage space where the data corresponding to the data request is located.
[0151] The first preset cache rule obtaining unit is configured to obtain, from a rule server according to an identifier of the storage space, a cache rule corresponding to the storage space as a preset cache rule.
[0152] Optionally, the device further includes a second rule writing module and a second rule storage module:
[0153] The second rule writing module is configured to receive a second cache rule writing request from a client, where the second cache rule writing request includes data attributes and corresponding cache rules.
[0154] The second rule storage module is used to store the data attributes and the corresponding cache rules in the rule server according to the corresponding relationship.
[0155] Based on the second rule writing module and the second rule storage module, the preset cache rule acquisition submodule includes a data attribute acquisition unit and a second preset cache rule acquisition unit:
[0156] The data attribute obtaining unit is used to determine the data attribute corresponding to the data request.
[0157] The second preset cache rule obtaining unit is configured to obtain corresponding cache rules from the rule server according to the data attributes as preset cache rules.
[0158] Optionally, the data is stored in units of data objects, and the data objects include: data identification, data attributes and data content.
[0159] In summary, the present application provides a data caching device, which includes: a data request receiving module for receiving a data request; a data caching module for determining whether there is a caching rule that matches the data request, caching the data obtained according to the caching rule, and reading the cached data. The data obtained by the caching rule includes: data associated with the data corresponding to the data request. When receiving a data request, the present application can cache the data associated with the data corresponding to the data request according to the caching rule, so that the data can be read from the cached data when reading the data. When receiving a data request before reading the data, the present application caches the data according to the caching rule, ensuring that the data caching is completed before reading the data, avoiding data caching when reading the data, and helping to improve the data reading speed.
[0160] Reference Figure 8 , shows a structural block diagram of an embodiment of a task processing device of the present application.
[0161] The first data task acquisition module 401 is configured to execute the first data task in response to an execution request of the first data task.
[0162] The task data caching module 402 is configured to cache data obtained according to a caching rule, where the data obtained according to the caching rule includes data associated with the data corresponding to the first data task.
[0163] The second data task execution module 403 is used to respond to an execution request of a second data task and execute the second data task according to the cached data. The second data task is a data task that is determined to be located after the first data task according to a preset sorting rule.
[0164] Optionally, the first data task and the second data task are both data read requests, the preset sorting rule includes: a sorting rule based on a preset time sequence between data read tasks, the data obtained according to the cache rule includes data associated with the data corresponding to the first data task, and the second data task execution module 403 includes a first data reading submodule:
[0165] The first data reading submodule is configured to read the cached data as read data for the second data task.
[0166] Optionally, the preset sorting rule includes: a sorting rule based on a dependency relationship between data tasks; the second data task is a data calculation task; the data obtained according to the cache rule includes: data corresponding to the first data task; the second data task execution module 403 includes a data calculation submodule:
[0167] The data calculation submodule is used to read the cached data as input data for the second data task to perform data calculation, so as to perform data calculation for the second data task.
[0168] In summary, the present application provides a task processing device, which includes: a first data task acquisition module, which is used to execute the first data task in response to the execution request of the first data task; a task data cache module, which is used to cache the data obtained according to the cache rule, and the data obtained according to the cache rule includes: data associated with the data corresponding to the first data task; a second data task execution module, which is used to execute the second data task according to the cached data in response to the execution request of the second data task, and the second data task is a data task located after the first data task determined according to a preset sorting rule. The present application can cache data associated with the data corresponding to the first data task during the execution of the first data task before the execution of the second data task, and when executing the second data task, the second data task can be executed according to the cached data, thereby avoiding reading data from the storage service end when executing the second data task, helping to improve the data reading speed when executing the second data task, and thereby improving the execution efficiency of the second data task.
[0169] An embodiment of the present application further provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute instructions (instructions) of each method step in the embodiment of the present application.
[0170] The present application provides one or more machine-readable media having instructions stored thereon, which, when executed by one or more processors, cause an electronic device to perform one or more of the methods described in the above embodiments. In the present application, the electronic device includes various types of devices such as terminal devices and server (cluster).
[0171] The embodiments of the present disclosure may be implemented as a device configured as desired using any appropriate hardware, firmware, software, or any combination thereof, and the device may include electronic devices such as terminal devices and server (clusters). Figure 9 An exemplary apparatus 500 that can be used to implement various embodiments described in this application is schematically illustrated.
[0172] For one embodiment, Figure 9 An exemplary apparatus 500 is shown having one or more processors 502, a control module (chip set) 504 coupled to at least one of the processor(s) 502, a memory 506 coupled to the control module 504, a non-volatile memory (NVM) / storage device 508 coupled to the control module 504, one or more input / output devices 510 coupled to the control module 504, and a network interface 512 coupled to the control module 504.
[0173] The processor 502 may include one or more single-core or multi-core processors, and the processor 502 may include any combination of general-purpose processors or dedicated processors (e.g., graphics processors, application processors, baseband processors, etc.). In some embodiments, the apparatus 500 can serve as a terminal device, a server (cluster), or other device described in the embodiments of the present application.
[0174] In some embodiments, the apparatus 500 may include one or more computer-readable media (e.g., memory 506 or NVM / storage 508) having instructions 514 and one or more processors 502 configured in combination with the one or more computer-readable media to execute the instructions 514 to implement a module to perform the actions described in the present disclosure.
[0175] For one embodiment, the control module 504 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 502 and / or any suitable device or component in communication with the control module 504 .
[0176] The control module 504 may include a memory controller module to provide an interface to the memory 506. The memory controller module may be a hardware module, a software module, and / or a firmware module.
[0177] The memory 506 can be used, for example, to load and store data and / or instructions 514 for the device 500. For one embodiment, the memory 506 can include any suitable volatile memory, such as a suitable DRAM. In some embodiments, the memory 506 can include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).
[0178] For one embodiment, the control module 504 may include one or more input / output controllers to provide interfaces to the NVM / storage device 508 and the input / output device(s) 510 .
[0179] For example, NVM / storage 508 may be used to store data and / or instructions 514. NVM / storage 508 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disk (CD) drives, and / or one or more digital versatile disk (DVD) drives).
[0180] NVM / storage device 508 may include storage resources that are physically part of the device on which apparatus 500 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 508 may be accessible over a network via input / output device(s) 510.
[0181] (One or more) input / output devices 510 may provide an interface for apparatus 500 to communicate with any other appropriate devices. Input / output devices 510 may include communication components, audio components, sensor components, etc. Network interface 512 may provide an interface for apparatus 500 to communicate via one or more networks. Apparatus 500 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, for example, accessing a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof for wireless communication.
[0182] For one embodiment, at least one of the processor(s) 502 may be packaged together with the logic of one or more controllers (e.g., a memory controller module) of the control module 504. For one embodiment, at least one of the processor(s) 502 may be packaged together with the logic of one or more controllers of the control module 504 to form a system-in-package (SiP). For one embodiment, at least one of the processor(s) 502 may be integrated on the same die with the logic of one or more controllers of the control module 504. For one embodiment, at least one of the processor(s) 502 may be integrated on the same die with the logic of one or more controllers of the control module 504 to form a system-on-chip (SoC).
[0183] In various embodiments, the apparatus 500 may be, but is not limited to, a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). In various embodiments, the apparatus 500 may have more or fewer components and / or a different architecture. For example, in some embodiments, the apparatus 500 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application-specific integrated circuit (ASIC), and a speaker.
[0184] Among them, the main control chip can be used as a processor or control module in the detection device, sensor data, location information, etc. are stored in the memory or NVM / storage device, the sensor group can be used as an input / output device, and the communication interface may include a network interface.
[0185] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0186] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0187] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0188] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0189] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0190] Although preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic inventive concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0191] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0192] The above is a detailed introduction to a data caching method and task processing method, device, equipment and storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data caching method, comprising: Receive data requests; determining that there is a cache rule that matches the data request, caching data obtained according to the cache rule to read the cached data, wherein the cache rule is used to determine a relationship between the cached data and the data corresponding to the data request, and the data obtained according to the cache rule includes data associated with the data corresponding to the data request; The cache rule carries a first data identifier and a second data identifier; and determining that a cache rule matching the data request exists and caching data obtained according to the cache rule includes: Determining that there is a cache rule in which the first data identifier matches the data identifier corresponding to the data request, and caching the data corresponding to the second data identifier carried by the matching cache rule; The caching rule further carries a third data identifier; and determining that there is a caching rule that matches the data request, and caching the data obtained according to the caching rule, further includes: Determining that there is a cache rule in which the third data identifier matches the data identifier corresponding to the data request, and caching the data corresponding to the third data identifier carried by the matching cache rule; The first data identifier and the second data identifier are used to distinguish two identifiers with different functions in the same cache rule, and the third data identifier is used to distinguish identifiers between different cache rules.
2. The method according to claim 1, characterized in that Caching the data obtained according to the caching rule includes: Send a cache data write request to the cache server to store the data obtained by the cache rule in the cache server.
3. The method according to claim 1, characterized in that The determining that there is a cache rule matching the data request, and caching the data obtained according to the cache rule, includes: Get the preset cache rules from the rule server; It is determined that there is a cache rule matching the data request in the preset cache rules, and the data obtained according to the cache rule is cached.
4. The method according to claim 3, characterized in that Before obtaining the preset cache rules from the rule server, the method further includes: Receive a first cache rule write request from a management client, where the first cache rule write request includes an identifier of a storage space and a corresponding cache rule; Storing the identifier of the storage space and the corresponding cache rule in the rule server according to the corresponding relationship; The step of obtaining the preset cache rules from the rule server includes: Determining an identifier of a storage space where data corresponding to the data request is located; According to the identifier of the storage space, a cache rule corresponding to the storage space is obtained from a rule server as a preset cache rule.
5. The method according to claim 4, characterized in that Before obtaining the preset cache rules from the rule server, the method further includes: Receive a second cache rule write request from the client, where the second cache rule write request includes data attributes and corresponding cache rules; Storing the data attributes and corresponding cache rules in the rule server according to the corresponding relationship; The step of obtaining the preset cache rules from the rule server includes: Determining a data attribute corresponding to the data request; According to the data attributes, corresponding cache rules are obtained from the rule server as preset cache rules.
6. The method according to claim 1, characterized in that The data is stored in units of data objects, and the data objects include: data identification, data attributes and data content.
7. A task processing method, the method comprising: In response to an execution request of a first data task, executing the first data task; caching data obtained according to a caching rule, wherein the caching rule is used to determine a relationship between the cached data and the data corresponding to the data request, the data obtained according to the caching rule including: data associated with the data corresponding to the first data task; In response to an execution request for a second data task, executing the second data task according to the cached data, the second data task being a data task that is determined to be located after the first data task according to a preset sorting rule; The caching rule carries a first data identifier and a second data identifier; and caching the data obtained according to the caching rule includes: When it is determined that there is a cache rule in which the first data identifier matches the data identifier corresponding to the first data task, cache the data corresponding to the second data identifier carried in the matching cache rule; The caching rule further carries a third data identifier; and caching the data obtained according to the caching rule further includes: Determining that there is a cache rule in which the third data identifier matches the data identifier corresponding to the data request, and caching the data corresponding to the third data identifier carried by the matching cache rule; The first data identifier and the second data identifier are used to distinguish two identifiers with different functions in the same cache rule, and the third data identifier is used to distinguish identifiers between different cache rules.
8. The method according to claim 7, characterized in that The first data task and the second data task are both data read requests, the preset sorting rule includes: a sorting rule based on a preset time sequence between data read tasks, the data obtained according to the cache rule includes data associated with the data corresponding to the first data task, and executing the second data task based on the cached data includes: The cached data is read as read data of the second data task.
9. The method according to claim 7, characterized in that The preset sorting rule includes a sorting rule based on a dependency relationship between data tasks, the second data task is a data calculation task, the data obtained according to the cache rule includes data corresponding to the first data task, and executing the second data task based on the cached data includes: The cached data is read as input data for the second data task to perform data calculation, so as to perform data calculation of the second data task.
10. A data caching device, comprising: A data request receiving module, used for receiving data requests; a data caching module, configured to determine whether a caching rule matches the data request, cache data obtained according to the caching rule, and read the cached data, wherein the caching rule is configured to determine a relationship between the cached data and the data corresponding to the data request, and the data obtained according to the caching rule includes data associated with the data corresponding to the data request; The cache rule carries a first data identifier and a second data identifier; the data cache module includes a first data cache submodule; The first data caching submodule is configured to determine whether there is a caching rule in which the first data identifier matches the data identifier corresponding to the data request, and cache the data corresponding to the second data identifier carried by the matching caching rule; The cache rule also carries a third data identifier; the data cache module includes a second data cache submodule; The second data caching submodule is configured to determine whether there is a caching rule in which the third data identifier matches the data identifier corresponding to the data request, and cache the data corresponding to the third data identifier carried by the matching caching rule; The first data identifier and the second data identifier are used to distinguish two identifiers with different functions in the same cache rule, and the third data identifier is used to distinguish identifiers between different cache rules.
11. A task processing device, comprising: a first data task acquisition module, configured to execute the first data task in response to an execution request of the first data task; a task data caching module, configured to cache data obtained according to a caching rule, wherein the caching rule is configured to determine a relationship between the cached data and data corresponding to the data request, wherein the data obtained according to the caching rule includes data associated with the data corresponding to the first data task; a second data task execution module, configured to execute a second data task according to the cached data in response to an execution request of the second data task, wherein the second data task is a data task that is determined to be located after the first data task according to a preset sorting rule; The cache rule carries a first data identifier and a second data identifier; the task data cache module is further configured to cache the data corresponding to the second data identifier carried by the matching cache rule when it is determined that there is a cache rule in which the first data identifier matches the data identifier corresponding to the first data task; The cache rule further carries a third data identifier; the task data cache module is further configured to determine whether there is a cache rule in which the third data identifier matches the data identifier corresponding to the data request, and cache the data corresponding to the third data identifier carried by the matching cache rule; The first data identifier and the second data identifier are used to distinguish two identifiers with different functions in the same cache rule, and the third data identifier is used to distinguish identifiers between different cache rules.
12. An electronic device, characterized in that: include: processor; and A memory having executable codes stored thereon, which, when executed, causes the processor to perform the method according to any one of claims 1 to 9.
13. One or more machine-readable media having executable codes stored thereon, which, when executed, cause a processor to perform the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Cache dynamic configuration method and device, computer equipment and storage medium
CN110113385A