Method and device for processing cache objects
By receiving query messages in the cache system and determining the identification of the target cache area, the problem of unable to query cache objects when keys are lost in the application layer code is solved, and the success rate of cache object query is improved.
Patent Information
- Application Number
- CN202110082499.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-21
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2041-01-21
AI Technical Summary
In the prior art, the cache object cannot be queried when the key in the application layer code is lost, resulting in the cache object query failure.
By receiving a query message, including the identification of the target cache area corresponding to the object to be queryed, the target cache area is determined in the cache system, and the object to be queryed in the area.
Even if the key in the application layer code is lost, the object to be queried in the target cache area can be queried in the target cache area based on the identification of the target cache area contained in the query message, which improves the success rate of cache object query.
Smart Images

Figure CN113760985B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a method and device for processing cache objects. Background Art
[0002] Cache refers to a high-speed memory with faster access speed than general random access memory (RAM). When a cache object is read from the cache, the cache object reading latency is low, thereby improving the reading performance.
[0003] In the prior art, when the application layer has cache objects that need to be cached, the cache objects that need to be cached are usually stored in the cache in sequence in the form of key-value pairs. However, when the cache object is subsequently queried using the existing caching method, if the key in the application layer code is lost, the cache object cannot be queried, resulting in cache object query failure. Summary of the invention
[0004] The embodiments of the present application provide a method and device for processing cache objects, which solve the problem that the cache objects cannot be queried when the key in the code is lost, thereby improving the success rate of cache object queries.
[0005] In a first aspect, an embodiment of the present application provides a method for processing a cache object, and the method for processing a cache object may include:
[0006] Receive a query message; wherein the query message includes an identifier of a target cache area corresponding to the object to be queried, the cache system includes multiple cache areas, and the target cache area is one of the multiple cache areas.
[0007] The target cache area is determined in the cache system according to the identifier of the target cache area.
[0008] The target cache area is searched for the object to be queried.
[0009] In a possible implementation, the method for processing the cache object may further include:
[0010] Receive a cache indication message; wherein the cache indication message includes the object to be queried and an identifier of a target cache area corresponding to the object to be queried.
[0011] The target cache area is determined in the cache system according to an identifier of the target cache area corresponding to the object to be queried.
[0012] The object to be queried is stored in the target cache area.
[0013] In a possible implementation manner, the cache indication message further includes a check value corresponding to the object to be queried, and storing the object to be queried in the target cache area may include:
[0014] The object to be queried is verified according to the verification value corresponding to the object to be queried.
[0015] If the verification is successful, the object to be queried is stored in the target cache area.
[0016] In a possible implementation, the processing of the cache object may further include:
[0017] Receive a cache configuration message; wherein the cache configuration message includes an identifier of a cache space to which the target cache area belongs and a storage capacity of the cache space; wherein the identifier of the cache space is determined according to a business type to which the object to be queried belongs.
[0018] The target cache area corresponding to the object to be queried is determined in the cache system according to the identifier of the cache space and the storage capacity.
[0019] In a possible implementation, determining, in the cache system, the target cache area corresponding to the object to be queried according to the identifier of the cache space and the storage capacity may include:
[0020] According to the identifier of the cache space and the storage capacity, a cache space is allocated in the cache system for the object to be queried.
[0021] A region division result of the cache space is received, where the region division result includes the target cache region and an identifier of the target cache region.
[0022] In a possible implementation, the processing of the cache object may further include:
[0023] Output the area division strategy corresponding to the cache space.
[0024] In a possible implementation, storing the to-be-queried object in the target cache area includes:
[0025] Determine whether the size of the object to be queried is less than or equal to the remaining storage capacity of the target cache area.
[0026] If so, the object to be queried is stored in the target cache area.
[0027] In a second aspect, an embodiment of the present application further provides a cache object processing device, which may include:
[0028] The receiving unit is used to receive a query message; wherein the query message includes an identifier of a target cache area corresponding to the object to be queried, the cache system includes multiple cache areas, and the target cache area is one of the multiple cache areas.
[0029] The processing unit is used to determine the target cache area in the cache system according to the identifier of the target cache area; and query the object to be queried in the target cache area.
[0030] In a possible implementation manner, the cache object processing device may further include a cache unit.
[0031] The receiving unit is further configured to receive a cache indication message, wherein the cache indication message includes the object to be queried and an identifier of a target cache area corresponding to the object to be queried.
[0032] The processing unit is further configured to determine the target cache area in the cache system according to an identifier of the target cache area corresponding to the object to be queried.
[0033] The cache unit is used to store the object to be queried in the target cache area.
[0034] In a possible implementation, the cache indication message further includes a verification value corresponding to the object to be queried, and the processing unit is further configured to verify the object to be queried according to the verification value corresponding to the object to be queried.
[0035] The cache unit is specifically configured to store the object to be queried in the target cache area if the verification is successful.
[0036] In a possible implementation, the receiving unit is also used to receive a cache configuration message; wherein the cache configuration message includes an identifier of the cache space to which the target cache area belongs and a storage capacity of the cache space; wherein the identifier of the cache space is determined based on a business type to which the object to be queried belongs.
[0037] The processing unit is further configured to determine, in the cache system, the target cache area corresponding to the object to be queried according to the identifier of the cache space and the storage capacity.
[0038] In a possible implementation, the processing unit is specifically configured to allocate cache space for the object to be queried in the cache system according to an identifier of the cache space and the storage capacity.
[0039] The receiving unit is further configured to receive a region division result of the cache space, wherein the region division result includes the target cache region and an identifier of the target cache region.
[0040] In a possible implementation manner, the cache object processing device may further include an output unit.
[0041] The output unit is used to output the area division strategy corresponding to the cache space.
[0042] In a possible implementation, the processing unit is further configured to determine whether the size of the object to be queried is less than or equal to the remaining storage capacity of the target cache area.
[0043] The cache unit is specifically configured to store the object to be queried in the target cache area if yes.
[0044] In a third aspect, an embodiment of the present application further provides a cache object processing device, which may include a processor and a memory; wherein:
[0045] The memory is used to store computer programs.
[0046] The processor is used to read the computer program stored in the memory and execute the cache object processing method described in any possible implementation manner of the first aspect according to the computer program in the memory.
[0047] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, the method for processing cache objects described in any possible implementation of the first aspect above is implemented.
[0048] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the method for processing cache objects described in any possible implementation of the first aspect above.
[0049] The method and device for processing cache objects provided in the embodiments of the present application first receive a query message when querying an object to be queried. Since the query message includes an identifier of a target cache area corresponding to the object to be queried, the target cache area can be determined in the cache system according to the identifier of the target cache area, and the object to be queried can be queried in the target cache area. In this way, even if the key of the cache object in the application layer code is lost, the object to be queried can be queried in the target cache area according to the identifier of the target cache area included in the query message, thereby solving the problem of cache object query failure caused by inability to query the cache object when the key in the application layer code is lost, thereby improving the success rate of cache object query. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0051] Figure 1 A schematic diagram of an application scenario provided in an embodiment of the present application;
[0052] Figure 2 A flowchart of a method for processing a cache object provided in an embodiment of the present application;
[0053] Figure 3 A schematic diagram of the division of a cache system provided in an embodiment of the present application;
[0054] Figure 4 A flowchart of another method for processing cache objects provided in an embodiment of the present application;
[0055] Figure 5 A schematic diagram of the division of another cache system provided in an embodiment of the present application;
[0056] Figure 6 A schematic diagram of the structure of a cache object processing device provided in an embodiment of the present application;
[0057] Figure 7 A schematic diagram of the structure of another cache object processing device provided in an embodiment of the present application.
[0058] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0059] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0060] In the embodiments of the present application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. In the text description of the present application, the character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0061] The method for processing cache objects provided in the embodiment of the present application can be applied to the scenario of data caching. For example, redis, memcached, custom map cache, etc. In the prior art, when the application layer has cache objects that need to be cached, the cache objects that need to be cached are usually stored in the cache in sequence in the form of key-value pairs. For example, when receiving a cache indication of cache object 1, cache object 1 can be stored in the cache according to the cache indication of cache object 1; when receiving cache indication 2 of 2, if there is enough storage capacity in the cache, cache object 2 can be stored in the cache according to the cache indication of cache object 2; and so on, until the cache indication of the latest cache object is received, if there is not enough storage capacity in the cache, the earliest cache object needs to be removed and sufficient storage capacity needs to be reserved for storing the latest cache object in the cache. However, using the existing caching method, when the cache object is subsequently queried, if the key in the application layer code is lost, the cache object cannot be queried, resulting in a cache object query failure.
[0062] In order to solve the problem of being unable to query cache objects when the key in the code is lost, thereby improving the success rate of cache object queries, a new management design solution can be used to manage the storage location, size, length, etc. of cache objects in an orderly manner. In this way, even if the key in the application layer code is lost, the storage information of the cache object can be quickly and efficiently located, thereby restoring the data query at the application layer. In order to achieve orderly management of the storage location of cache objects, a three-dimensional design pattern of spatial stratification can be used. For an example, see Figure 1 As shown, Figure 1A schematic diagram of an application scenario provided for an embodiment of the present application, in which the cache system, that is, the entire cache, can be managed in a spatial form, and the cache system can be divided into multiple cache spaces. Taking three cache spaces as an example, the three cache spaces can be divided into cache space 1, cache space 2 and cache space 3; and each cache space can be further divided into multiple cache areas, which are used to store cache objects, thereby realizing orderly and organized management of the storage location of cache objects.
[0063] Based on the above concept, an embodiment of the present application provides a method for processing cache objects, receiving a query message; wherein the query message includes an identifier of a target cache area corresponding to the object to be queried, the cache system includes multiple cache areas, and the target cache area is one of the multiple cache areas; and based on the identifier of the target cache area, the target cache area is determined in the cache system; and then the object to be queried is queried in the target cache area.
[0064] The cache area is used to store cache objects. It is understandable that in the embodiment of the present application, a cache area can be used to cache one cache object or multiple cache objects, that is, multiple cache objects can be cached in one cache area. However, in order to facilitate the management of cache objects, generally, one cache object cannot be cached in multiple cache areas.
[0065] For example, the object to be queried may be a document, an image, or a piece of video data, and may be specifically set according to actual needs.
[0066] It can be seen that in the embodiment of the present application, when querying the object to be queried, since the query message includes the identifier of the target cache area corresponding to the object to be queried, it is possible to determine the target cache area in the cache system according to the identifier of the target cache area, and query the object to be queried in the target cache area. In this way, even if the key in the application layer code is lost, the object to be queried can be queried in the target cache area according to the identifier of the target cache area included in the query message, which solves the problem of cache object query failure caused by the inability to query the cache object when the key in the application layer code is lost, thereby improving the success rate of cache object query.
[0067] The following will describe in detail the cache object processing method provided by the present application through specific embodiments. It is understandable that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0068] Figure 2This is a flow chart of a method for processing a cache object provided in an embodiment of the present application. The method for processing a cache object can be executed by software and / or hardware devices. For example, the hardware device can be a cache object processing device, and the cache object processing device can be a server. For example, see Figure 2 As shown, the processing method of the cache object may include:
[0069] S201. Receive a query message.
[0070] The query message includes an identifier of a target cache area corresponding to the object to be queried, the cache system includes multiple cache areas, and the target cache area is one of the multiple cache areas.
[0071] In the embodiment of the present application, in order to achieve orderly and organized management of the storage location of the cache object, a spatial layered three-dimensional design mode can be adopted to divide the cache system into multiple cache spaces, each of which can be further divided into multiple cache areas, and the cache areas are used to store cache objects, thereby achieving orderly and organized management of the storage location of the cache object. For example, see Figure 3 As shown, Figure 3 A schematic diagram of the division of a cache system provided in an embodiment of the present application, Figure 3 The entire area shown is the cache system, that is, the entire cache. The entire cache system can include two large grids, each of which represents a cache space; each large grid is divided into two small grids, each of which represents a cache area. The cache area is used to cache cache objects that need to be cached, and the size of the small grid space determines the size and number of cache objects stored.
[0072] It is precisely because of the above-mentioned use of the cache system Figure 3 The control layered three-dimensional design mode shown is managed so that each target cache area corresponds to its own identifier. Therefore, after receiving the identifier of the target cache area, the target cache area corresponding to the identifier of the target cache area can be searched in multiple cache areas included in the cache system according to the identifier of the target cache area, so as to determine the target cache area, that is, execute the following S202:
[0073] S202: Determine the target cache area in the cache system according to the identifier of the target cache area.
[0074] Different cache areas have different corresponding identifiers.
[0075] After the target cache area is determined in the cache system according to the identifier of the target cache area, the to-be-queried object can be searched in the determined target cache area, that is, the following S203 is executed:
[0076] S203: Search the target cache area for the object to be queried.
[0077] After the object to be queried is found in the target cache area, the object to be queried may be fed back to the application layer so that the application layer can obtain the object to be queried.
[0078] It can be seen that in the embodiment of the present application, when querying the object to be queried, since the query message includes the identifier of the target cache area corresponding to the object to be queried, it is possible to determine the target cache area in the cache system according to the identifier of the target cache area, and query the object to be queried in the target cache area. In this way, even if the key of the cache object in the application layer code is lost, the object to be queried can be queried in the target cache area according to the identifier of the target cache area included in the query message, which solves the problem of cache object query failure caused by the inability to query the cache object when the key in the application layer code is lost, thereby improving the success rate of cache object query.
[0079] Based on the above Figure 2 In the embodiment shown, when searching for the object to be queried in the target cache area, it is necessary to divide the cache system in advance so that the cache system includes multiple cache areas, and cache the object to be queried in the target cache area, so that after receiving the query message including the identifier of the target cache area, the object to be queried can be queried in the target cache area according to the identifier of the target cache area included in the query message. For an example, see Figure 4 As shown, Figure 4 A flowchart of another method for processing a cache object provided in an embodiment of the present application, the method for processing a cache object may include:
[0080] S401: Receive a cache configuration message.
[0081] The cache configuration message includes an identifier of a cache space to which the target cache area belongs and a storage capacity of the cache space; wherein the identifier of the cache space is determined according to a business type to which the object to be queried belongs.
[0082] For examples, see Figure 5 As shown, Figure 5 A schematic diagram of the division of another cache system provided in an embodiment of the present application, the application layer can send a cache configuration message to the server, so that after receiving the cache configuration message, the cache configuration message allocates cache space for the object to be queried in the cache system according to the identifier and storage capacity of the cache space included in the cache configuration message, that is, executes the following S402:
[0083] S402: Allocate cache space for the object to be queried in the cache system according to the identifier and storage capacity of the cache space.
[0084] After receiving the cache configuration message including the identifier of the cache space to which the target cache area belongs and the storage capacity of the cache space, the server can divide the cache system according to the identifier of the cache space to which the target cache area belongs and the storage capacity of the cache space to obtain the cache space to which the target cache area belongs, that is, allocate cache space in the cache system for the object to be queried.
[0085] After allocating cache space for the object to be queried, the cache space allocated for the object to be queried can be displayed to the application layer, so that the application layer can further divide the cache space according to business needs, and subdivide the cache space into multiple cache areas, each cache area is used to cache the cache object to be cached, and the entire cache space division process is invisible to the cache system in the server. However, after the cache space division is completed, the application layer needs to send the division result to the cache system in the server, so that the cache system obtains the regional division result of the cache space, that is, executes the following S403:
[0086] S403: Receive a region division result of the cache space, where the region division result includes a target cache region and an identifier of the target cache region.
[0087] For example, before receiving the area division result of the cache space from the application layer, the cache system in the server can output the area division strategy corresponding to the cache space to the application layer in order to ensure that the application layer's division method meets the requirements of the cache system when dividing the cache space. Therefore, the application layer can divide the cache space based on the area division strategy, thereby further allocating cache areas for objects to be queried in the cache space.
[0088] It can be seen that in the above S401-S403, by receiving the cache configuration message, and according to the identifier and storage capacity of the cache space included in the cache configuration message, cache space is allocated in the cache system for the object to be queried; then the area division result of the cache space is received, and the area division result includes the target cache area and the identifier of the target cache area, that is, a cache area is further allocated in the cache space for the object to be queried, that is, through the three-dimensional design mode of spatial layering, the entire cache system is managed, and orderly, sized, lengthed and restricted management of the cache system is realized.
[0089] After the entire cache system is managed through the three-dimensional design mode of spatial stratification, when the application layer has a cache demand, since the division of the cache system is dominated by the application layer, the application layer can determine the target cache area that needs to be cached according to the business demand, and send a cache indication message including the object to be queried and the identifier of the target cache area corresponding to the object to be queried to the cache system in the server, so that the cache system in the server receives the cache indication message, that is, executes the following S404:
[0090] S404: Receive a cache indication message.
[0091] The cache indication message includes the object to be queried and the identifier of the target cache area corresponding to the object to be queried.
[0092] S405: Determine the target cache area in the cache system according to the identifier of the target cache area corresponding to the object to be queried.
[0093] After receiving a cache indication message including an object to be queried and an identifier of a target cache area corresponding to the object to be queried, the cache system in the server can determine the target cache area in the cache system based on the identifier of the target cache area corresponding to the object to be queried, and store the object to be queried in the target cache area.
[0094] S406: Store the object to be queried in the target cache area.
[0095] For example, before storing the object to be queried in the target cache area, it can be determined whether the size of the object to be queried is less than or equal to the remaining storage capacity of the target cache area; if the size of the object to be queried is less than or equal to the remaining storage capacity of the target cache area, it means that the remaining capacity of the current target cache area is sufficient to store the object to be queried, and the object to be queried is stored in the target cache area; on the contrary, if the size of the object to be queried is greater than the remaining storage capacity of the target cache area, it means that the remaining capacity of the current target cache area is insufficient to store the object to be queried, and a prompt message can be output to the application layer to prompt the application layer to reselect the cache area through the prompt message to store the object to be queried.
[0096] It can be understood that when the object to be queried is stored in the target cache area, in order to ensure the legitimacy of the cache object, the verification value corresponding to the object to be queried can be carried in the cache indication message, and the verification value corresponding to the object to be queried can be sent to the cache system of the server, so that the cache system of the server can first verify the object to be queried according to the verification value corresponding to the object to be queried; if the verification is successful, it means that the object to be queried is a legal cache object, and the object to be queried will be stored in the target cache area.
[0097] It can be seen that in the above S405-S406, by receiving the cache configuration message, and according to the identifier of the target cache area corresponding to the object to be queried and the object to be queried included in the cache configuration message, the target cache area is determined in the cache system; then the object to be queried is stored in the target cache area, thereby realizing the caching of the cache object through the three-dimensional design pattern of spatial layering; in this way, when querying the cache object subsequently, even if the key of the cache object in the application layer code is lost, the object to be queried can be queried in the target cache area according to the identifier of the target cache area included in the query message, which solves the problem of cache object query failure caused by the inability to query the cache object when the key in the application layer code is lost, thereby improving the success rate of cache object query.
[0098] Figure 6 A schematic diagram of a cache object processing device 60 provided in an embodiment of the present application, for example, see Figure 6 As shown, the cache object processing device 60 may include:
[0099] The receiving unit 601 is used to receive a query message; wherein the query message includes an identifier of a target cache area corresponding to the object to be queried, the cache system includes multiple cache areas, and the target cache area is one of the multiple cache areas.
[0100] The processing unit 602 is used to determine the target cache area in the cache system according to the identifier of the target cache area; and search the target cache area for the object to be queried.
[0101] Optionally, the cache object processing device 60 may further include a cache unit 603 .
[0102] The receiving unit 601 is further configured to receive a cache indication message; wherein the cache indication message includes an object to be queried and an identifier of a target cache area corresponding to the object to be queried.
[0103] The processing unit 602 is further configured to determine the target cache area in the cache system according to the identifier of the target cache area corresponding to the object to be queried.
[0104] The cache unit 603 is used to store the object to be queried in the target cache area.
[0105] Optionally, the cache indication message further includes a verification value corresponding to the object to be queried, and the processing unit 602 is further configured to verify the object to be queried according to the verification value corresponding to the object to be queried.
[0106] The cache unit 603 is specifically configured to store the object to be queried in a target cache area if the verification is successful.
[0107] Optionally, the receiving unit 601 is also used to receive a cache configuration message; wherein the cache configuration message includes an identifier of the cache space to which the target cache area belongs and a storage capacity of the cache space; wherein the identifier of the cache space is determined based on the business type to which the object to be queried belongs.
[0108] The processing unit 602 is further configured to determine a target cache area corresponding to the object to be queried in the cache system according to the identifier and storage capacity of the cache space.
[0109] Optionally, the processing unit 602 is specifically configured to allocate cache space for the object to be queried in the cache system according to the identifier and storage capacity of the cache space.
[0110] The receiving unit 601 is further configured to receive a region division result of the cache space, where the region division result includes a target cache region and an identifier of the target cache region.
[0111] Optionally, the cache object processing device 60 may further include an output unit 604 .
[0112] The output unit 604 is used to output the area division strategy corresponding to the cache space.
[0113] Optionally, the processing unit 602 is further configured to determine whether the size of the object to be queried is less than or equal to the remaining storage capacity of the target cache area.
[0114] The cache unit 603 is specifically configured to store the object to be queried in a target cache area if yes.
[0115] The cache object processing device 60 provided in the embodiment of the present application can execute the technical solution of the cache object processing method in any of the above-mentioned embodiments. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the cache object processing method. Please refer to the implementation principle and beneficial effects of the cache object processing method, which will not be repeated here.
[0116] Figure 7 A schematic diagram of the structure of another cache object processing device 70 provided in an embodiment of the present application, for example, see Figure 7 As shown, the cache object processing device 70 may include a processor 701 and a memory 702; wherein,
[0117] The memory 702 is used to store computer programs.
[0118] The processor 701 is used to read the computer program stored in the memory 702 and execute the technical solution of the method for processing cache objects in any of the above embodiments according to the computer program in the memory 702.
[0119] Optionally, the memory 702 may be independent or integrated with the processor 701. When the memory 702 is a device independent of the processor 701, the cache object processing device may further include: a bus for connecting the memory 702 and the processor 701.
[0120] Optionally, this embodiment further includes: a communication interface, which can be connected to the processor 701 through a bus. The processor 701 can control the communication interface to implement the acquisition and sending functions of the processing device of the cache object.
[0121] The cache object processing device 70 shown in the embodiment of the present application can execute the technical solution of the cache object processing method in any of the above-mentioned embodiments. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the cache object processing method. Please refer to the implementation principle and beneficial effects of the cache object processing method, which will not be repeated here.
[0122] An embodiment of the present application also provides a computer-readable storage medium, which stores computer execution instructions. When the processor executes the computer execution instructions, the technical solution of the cache object processing method in any of the above embodiments is implemented. The implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the cache object processing method. Please refer to the implementation principle and beneficial effects of the cache object processing method, which will not be repeated here.
[0123] An embodiment of the present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the technical solution of the cache object processing method in any of the above embodiments. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the cache object processing method. Please refer to the implementation principle and beneficial effects of the cache object processing method, which will not be repeated here.
[0124] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0125] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0126] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the methods of various embodiments of the present application.
[0127] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0128] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.
[0129] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0130] The computer-readable storage medium may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium may be any available medium that can be accessed by a general or special purpose computer.
[0131] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for processing a cache object, characterized in that: include: Receive a cache indication message; wherein the cache indication message includes an object to be queried and an identifier of a target cache area corresponding to the object to be queried; Determine the target cache area in the cache system according to the identifier of the target cache area corresponding to the object to be queried; storing the object to be queried in the target cache area; Receive a query message; wherein the query message includes an identifier of a target cache area corresponding to the object to be queried, the cache system includes multiple cache areas, and the target cache area is one of the multiple cache areas; Determining the target cache area in the cache system according to the identifier of the target cache area; The target cache area is searched for the object to be queried.
2. The method according to claim 1, characterized in that The cache indication message further includes a check value corresponding to the object to be queried, and storing the object to be queried in the target cache area includes: Verifying the object to be queried according to the verification value corresponding to the object to be queried; If the verification is successful, the object to be queried is stored in the target cache area.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: Receive a cache configuration message; wherein the cache configuration message includes an identifier of a cache space to which the target cache area belongs and a storage capacity of the cache space; wherein the identifier of the cache space is determined according to a business type to which the object to be queried belongs; The target cache area corresponding to the object to be queried is determined in the cache system according to the identifier of the cache space and the storage capacity.
4. The method according to claim 3, characterized in that Determining the target cache area corresponding to the to-be-queried object in the cache system according to the identifier of the cache space and the storage capacity includes: Allocating cache space for the object to be queried in the cache system according to the identifier of the cache space and the storage capacity; A region division result of the cache space is received, where the region division result includes the target cache region and an identifier of the target cache region.
5. The method according to claim 4, characterized in that The method further comprises: Output the area division strategy corresponding to the cache space.
6. The method according to claim 1 or 2, characterized in that: The storing the object to be queried in the target cache area includes: Determine whether the size of the object to be queried is less than or equal to the remaining storage capacity of the target cache area; If so, the object to be queried is stored in the target cache area.
7. A cache object processing device, characterized in that: include: The receiving unit is further configured to receive a cache indication message; wherein the cache indication message includes an object to be queried and an identifier of a target cache area corresponding to the object to be queried; The processing unit is further configured to determine the target cache area in the cache system according to the identifier of the target cache area corresponding to the object to be queried; A cache unit, used for storing the object to be queried in the target cache area; A receiving unit, configured to receive a query message; wherein the query message includes an identifier of a target cache area corresponding to the object to be queried, the cache system includes multiple cache areas, and the target cache area is one of the multiple cache areas; The processing unit is used to determine the target cache area in the cache system according to the identifier of the target cache area; and query the object to be queried in the target cache area.
8. The device according to claim 7, characterized in that The cache indication message also includes a check value corresponding to the object to be queried, and the processing unit is further configured to verify the object to be queried according to the check value corresponding to the object to be queried; The cache unit is specifically configured to store the object to be queried in the target cache area if the verification is successful.
9. The device according to claim 7 or 8, characterized in that The receiving unit is further configured to receive a cache configuration message; wherein the cache configuration message includes an identifier of a cache space to which the target cache area belongs and a storage capacity of the cache space; wherein the identifier of the cache space is determined according to a business type to which the object to be queried belongs; The processing unit is further configured to determine, in the cache system, the target cache area corresponding to the object to be queried according to the identifier of the cache space and the storage capacity.
10. The device according to claim 7, characterized in that The processing unit is specifically configured to allocate cache space for the object to be queried in the cache system according to the identifier and storage capacity of the cache space; The receiving unit is further configured to receive a region division result of the cache space, wherein the region division result includes the target cache region and an identifier of the target cache region.
11. The device according to claim 10, characterized in that The device also includes an output unit; The output unit is used to output the area division strategy corresponding to the cache space.
12. The device according to claim 7 or 8, characterized in that The processing unit is further used to determine whether the size of the object to be queried is less than or equal to the remaining storage capacity of the target cache area; The cache unit is specifically configured to store the object to be queried in the target cache area if yes.
13. A cache object processing device, characterized in that: comprising a processor and a memory; wherein, The memory is used to store computer programs; The processor is used to read the computer program stored in the memory and execute the cache object processing method described in any one of claims 1 to 6 according to the computer program in the memory.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the processor executes the computer-executable instructions, the cache object processing method described in any one of claims 1 to 6 is implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for processing a cache object described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Data caching method, device and apparatus, and storage medium
CN109324761A
Data access method and device
CN110968603A