Method, device, and storage medium for managing cached data

By adding a management program to the cached data operation function of each business in the server, a second cached data operation function for managing cached data is generated, and a problem that technicians need to write management functions for each business is solved, automated cached data management is realized, and development efficiency is improved.

CN113886439BActive Publication Date: 2025-06-13TENCENT MUSIC ENTERTAINMENT TECH (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111095298.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-17
Publication Date
2025-06-13
Estimated Expiration
2041-09-17

AI Technical Summary

Technical Problem

When processing multi-service data in a server, technicians need to write cached data management functions for each business, which increases the workload and reduces development efficiency.

Method used

By determining the cached data operation function of the target service in the business execution program and adding a hypervisor to the function to record the execution information, a second cached data operation function for managing the cached data is generated. After this function is executed, the execution information is sent to the management device.

Benefits of technology

Without the need for technicians to write management functions for each business, they can automatically collect execution information of cached data operation functions, reducing the workload of technicians and improving development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113886439B_ABST
    Figure CN113886439B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device and storage medium for managing cache data, belonging to the field of Internet technologies. The method includes: obtaining a service execution program corresponding to a target service; determining a first cache data operation function in the service execution program that operates on the cache data of the target service; adding a management program for determining the execution information of the function in the first cache data operation function to obtain a second cache data operation function; executing the second cache data operation function to obtain the execution information of the second cache data operation function; and sending the execution information of the second cache data operation function to a management device. Using the present application can reduce the workload of technical personnel and improve development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technologies, and particularly to a method, device, and storage medium for managing cache data. Background Art

[0002] With the development of Internet and big data technologies, there are more and more services and data to be processed in a server. For example, in the background server corresponding to an online shopping application, a large number of online shopping orders need to be processed every day. When processing each online shopping order, data related to the order, such as user data and merchant data, etc., need to be obtained.

[0003] In related technologies, in order to improve the efficiency of a server in processing various services, after a service execution program corresponding to each service runs, a cache (server cache) can be set in the running memory corresponding to the service execution program. Then, service data required for processing the corresponding service can be obtained from a data storage server. When the corresponding service needs to be processed, the corresponding service data can be directly read from the cache, which can improve the speed of obtaining service data, and thus can improve the efficiency of the server in processing the corresponding service.

[0004] In practical applications, in addition to writing functions (cache data operation functions) for accessing and storing service data in the cache in the program code for processing services, technicians also need to set up management functions for managing the service data in the cache, such as determining the number of times different service data in each cache are read, the number of read failures, etc., for subsequent optimization of the cache data operation functions. In this way, technicians need to write corresponding management functions for each service data stored in the cache. Thus, the workload of technicians is also increased, resulting in a lower development efficiency. Summary of the Invention

[0005] Embodiments of this application provide a method, device, and storage medium for managing cache data, which can reduce the workload of technicians and improve the development efficiency of technicians. The technical solutions are as follows:

[0006] In a first aspect, a method for managing cache data is provided. The method includes:

[0007] Obtain a service execution program corresponding to a target service;

[0008] Determine a first cache data operation function in the service execution program that operates on the cache data of the target service;

[0009] Add a management program for determining the execution information of the function to the first cache data operation function to obtain a second cache data operation function;

[0010] Execute the second cache data operation function to obtain the execution information of the second cache data operation function;

[0011] Send the execution information of the second cache data operation function to the management device.

[0012] Optionally, determining the first cache data operation function that operates on the cache data of the target service in the service execution program includes:

[0013] Based on the service type identifier included in the service execution program, determine the service type to which the target service belongs;

[0014] In the preset correspondence between the service type and the cache data operation function, determine the first cache data operation function corresponding to the target service.

[0015] Optionally, the execution information includes at least one of the number of function executions, the function execution result, the function execution duration, and the function name of other functions that call the cache data operation function.

[0016] Optionally, the first cache data operation function includes at least one of a cache data writing function, a cache data reading function, and a cache data deleting function;

[0017] Adding a management program for determining the execution information of the function in the first cache data operation function includes:

[0018] Based on the correspondence between the management program and the program adding position, determine the target adding position of the management program in the first cache data operation function;

[0019] Add the management program at the target adding position of the first cache data operation function.

[0020] Optionally, the first cache data operation function is a cache data reading function, and executing the second cache data operation function to obtain the execution information of the second cache data operation function includes:

[0021] Determine the target service object to which the cache data read by the second cache data operation function belongs;

[0022] Determine the number of times the cache data corresponding to the target service object is read;

[0023] The method further includes:

[0024] Among the number of times the cache data corresponding to each service object is read, determine the service object identifiers of the preset number of service objects with the highest corresponding read times;

[0025] Send the preset number of business object identifiers to the management terminal.

[0026] Optionally, after obtaining the service execution program corresponding to the target service, the method further includes:

[0027] Based on the service execution program, determine the attribute information of the cached data of the target service, where the attribute information includes at least one of the data source information, data name, and data structure of the cached data of the target service;

[0028] Send the attribute information of the cached data of the target service to the management device, and the management device is used to display the function name of the received first cached data operation function and the attribute information of the cached data.

[0029] Optionally, the method further includes:

[0030] Receive the operation instruction of the cached data operation function sent by the management device, where the operation instruction carries the data identifier corresponding to the cached data of the target service;

[0031] Execute the target cached data operation function based on the data identifier.

[0032] In a second aspect, a device for managing cached data is provided, and the device includes:

[0033] An acquisition module, configured to acquire a service execution program corresponding to a target service;

[0034] A determination module, configured to determine, in the service execution program, a first cached data operation function for operating on the cached data of the target service;

[0035] An addition module, configured to add a management program for determining the execution information of the function to the first cached data operation function to obtain a second cached data operation function;

[0036] An execution module, configured to execute the second cached data operation function to obtain the execution information of the second cached data operation function;

[0037] A sending module, configured to send the execution information of the second cached data operation function to the management device.

[0038] Optionally, the determination module is configured to:

[0039] Based on the service type identifier included in the service execution program, determine the service type to which the target service belongs;

[0040] In the preset correspondence between the service type and the cached data operation function, determine the first cached data operation function corresponding to the target service.

[0041] Optionally, the execution information includes at least one of the number of function executions, the function execution result, the function execution duration, and the function name of other functions that call the cache data operation function.

[0042] Optionally, the first cache data operation function includes at least one of a cache data writing function, a cache data reading function, and a cache data deleting function;

[0043] The adding module is configured to:

[0044] Determine a target adding position of the hypervisor in the first cache data operation function based on the correspondence between the hypervisor and the program adding position;

[0045] Add the hypervisor at the target adding position of the first cache data operation function.

[0046] Optionally, the first cache data operation function is a cache data reading function, and the execution module is configured to:

[0047] Determine a target service object to which the cache data read by the second cache data operation function belongs;

[0048] Determine the number of times the cache data corresponding to the target service object is read;

[0049] The determining module is further configured to:

[0050] Determine service object identifiers of a preset number of service objects with the highest corresponding read times among the number of times the cache data corresponding to each service object is read;

[0051] Send the service object identifiers of the preset number of service objects to the management terminal.

[0052] Optionally, the determining module is further configured to:

[0053] Determine attribute information of the cache data of the target service based on the service execution program, where the attribute information includes at least one of data source information, data name, and data structure of the cache data of the target service;

[0054] Send the attribute information of the cache data of the target service to the management device, and the management device is configured to display the function name of the first cache data operation function and the attribute information of the cache data received.

[0055] Optionally, the execution module is further configured to:

[0056] Receive the operation instruction of the cache data operation function sent by the management device, where the operation instruction carries the data identifier corresponding to the cache data of the target service;

[0057] Execute the target cache data operation function based on the data identifier.

[0058] In a third aspect, a computer device is provided. The computer device includes a processor and a memory. At least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor to implement the operations performed by the method for managing cache data as described in the first aspect.

[0059] In a fourth aspect, a computer-readable storage medium is provided. The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the operations performed by the method for managing cache data as described in the first aspect.

[0060] In a fifth aspect, a computer program product is provided. The computer program product includes at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the operations performed by the method for managing cache data as described in the first aspect.

[0061] The beneficial effects brought by the technical solutions provided in the embodiments of this application are:

[0062] In the embodiments of this application, in the service execution program corresponding to the target service, the first cache data operation function for operating on the cache data of the target service is determined, and then a management program for determining the execution information of the function is added to the first cache data operation function to obtain the second cache data operation function. After the second cache data operation function is executed, the management program in the second cache data operation function can obtain the execution information of the function and then send the corresponding execution information to the management device. It can be seen that by adopting this application, it is not necessary for technicians to write corresponding management functions for the service data stored in the cache for each service, and the execution information corresponding to the cache data operation function can be obtained, which can reduce the workload of technicians and improve the development efficiency. Description of the Drawings

[0063] To more clearly illustrate the technical solutions in the embodiments of this application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of this application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0064] Figure 1 It is a flowchart of a method for managing cache data provided by an embodiment of this application;

[0065] Figure 2 It is a schematic diagram of a method for managing cache data provided by an embodiment of the present application;

[0066] Figure 3 It is a schematic diagram of a method for managing cache data provided by an embodiment of the present application;

[0067] Figure 4 It is a schematic diagram of the structure of a device for managing cache data provided by an embodiment of the present application;

[0068] Figure 5 It is a schematic diagram of the structure of a computer device provided by an embodiment of the present application. Detailed implementation manners

[0069] To make the objectives, technical solutions, and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.

[0070] The method for managing cache data provided by the present application can be implemented by a server. The server can be a background server corresponding to various application programs, websites, etc., and can be used to process the services provided by the corresponding application programs and websites, such as order services, advertisement push services, video playback services, and so on. The server can have a processor and a memory. The memory can store an execution program corresponding to the method for managing cache data provided by the present application, and the processor can execute the execution program stored in the memory, thereby implementing the method for managing cache data provided by the present application. In addition, the server can be a single server or a server group. If it is a single server, the server can be responsible for all the processing in the following solutions. If it is a server group, different servers in the server group can be responsible for different processing in the following solutions respectively. The specific processing allocation can be set arbitrarily by technicians according to actual needs and will not be elaborated here.

[0071] With the development of Internet and big data technologies, more and more services and data need to be processed in the server. For example, in the background server corresponding to an online shopping application program, a large number of online shopping orders need to be processed every day. When processing each online shopping order, data related to the order, such as user data and merchant data, etc., need to be obtained.

[0072] In order to improve the efficiency of the server in processing various services, after the service execution program corresponding to each service runs, a cache (server cache) can be set in the operating memory corresponding to the service execution program. Then, the service data required for processing the corresponding service can be obtained from the data storage server. When the corresponding service needs to be processed, the corresponding service data can be directly read from the cache. Since the cache is set in the memory, the speed of reading data from the memory is much higher than that of reading data from the hard disk and other servers. Therefore, reading the corresponding service data from the cache can improve the speed of obtaining service data, thereby improving the efficiency of the server in processing the corresponding service.

[0073] For each service, such as the order service, the advertisement push service, the video playback service, etc., a cache is set in the operating memory of the corresponding service execution program. When the technician sets the corresponding cache, a program for managing the data in the cache also needs to be set, for example, determining the number of times of reading different service data in the cache, the number of reading failures, etc., for subsequent optimization of the cache data operation function. In this way, the technician needs to write a corresponding management function for each service data existing in the cache. Thus, the workload of the technician is also increased, resulting in a lower development efficiency.

[0074] Figure 1 It is a flowchart of a method for managing cache data provided by an embodiment of the present application. Refer to Figure 2 This embodiment includes:

[0075] Step 101, obtain the service execution program corresponding to the target service.

[0076] Among them, the target service can be any service with a cache set. The service execution program is the program code written by the technician to process the corresponding service.

[0077] Before executing step 101, the service execution program corresponding to the target service can be connected to the SDK (Software Development Kit). The SDK can be understood as a processing program for implementing the processing of steps 101-104 in the process of this embodiment. The SDK can be developed by the technician and pre-connected to the service execution program of the target service. When the server is triggered to run the service execution program, the SDK can be triggered first to obtain the program code corresponding to the service execution program.

[0078] Step 102, determine the first cache data operation function in the service execution program that operates on the cache data of the target service.

[0079] For a service that sets up a cache to store cached data, the corresponding service operation program can be provided with cache data operation functions for reading, writing, modifying, and deleting the cached data in the cache. For cache data operation functions with the same operation function in different service execution programs, the same function name can be set.

[0080] After the SDK obtains the program code corresponding to the service execution program, it can determine each cache data operation function (the first cache data operation function) included in the service execution program corresponding to the target service based on the function name of each cache data operation function.

[0081] Specifically, in the SDK, through Spring Boot Auto Configuration (technology for dynamically reading configurations), for different cache implementation methods, relevant Instrumentation packages can be introduced to automatically scan the cache implementation in the service execution program corresponding to the target service, that is, through the corresponding Instrumentation, the obtained program code is scanned to obtain the first cache data operation functions for processing the service data in the cache, such as reading, writing, modifying, and deleting. Here, the cache implementation method refers to setting up a cache method in the running memory corresponding to the service execution program. For example, guavaCache, springCache, etc. can be used to set up a cache in the running memory.

[0082] Optionally, the processing for determining the first cache data operation function can also be as follows:

[0083] Based on the service type identifier included in the service execution program, determine the service type to which the target service belongs; in the preset correspondence between the service type and the cache data operation function, determine the first cache data operation function corresponding to the target service.

[0084] In implementation, the cache data operation functions set for different services of different service types of the server may be different. Technical personnel can preset the correspondence between different service types and the function names of the cache data operation functions. The SDK can scan the code of the obtained service program to determine the service type of the current target service, such as an order service, an advertisement push service, a video playback service, etc., and then determine the function name of the cache data operation function corresponding to the service type of the target service, that is, the first cache data operation function, according to the preset correspondence.

[0085] In a possible implementation manner, based on the service execution program, determine the attribute information of the cached data of the target service, where the attribute information includes at least one of the data source information, data name, and data structure of the cached data of the target service.

[0086] In implementation, after the SDK scans the code of the service execution program, the obtained scan results may further include data source information, data names, data structures of the cached data of the target service, and the server address storing the cached data of the target service, etc. Among them, the data source information of the cached data may be the database storing the cached data of the target service, and the data structure of the cached data may be each field constituting the cached data.

[0087] Step 103: Add a management program for determining the execution information of the function in the first cached data operation function to obtain a second cached data operation function.

[0088] Among them, the first cached data operation function may include at least one of a cached data writing function, a cached data reading function, and a cached data deleting function. The execution information of the function may include at least one of the number of function executions, the function execution result, the function execution duration, and the function names of other functions calling the cached data operation function. The function names of other functions calling the cached data operation function may be the interfaces calling the corresponding cached data operation functions.

[0089] The SDK may pre-store program codes (i.e., management programs) for determining the number of function executions, the function execution result, the function execution duration, and the function names of other functions calling the cached data operation function. After determining the first cached data operation function, the SDK may add the stored management program to the first cached data operation function to obtain the cached data operation function after the addition process, that is, obtain the second cached data operation function.

[0090] Optionally, the process of adding the management program to the first cached data operation function may be as follows:

[0091] Based on the correspondence between the management program and the program addition position, determine the target addition position for adding the management program in the first cached data operation function; add the management program at the target addition position of the first cached data operation function.

[0092] In implementation, technicians may set the addition positions of the corresponding management programs in the cached data operation functions according to the functions implemented by each management program. Among them, for different codes in the same management program, different addition positions may be corresponding. The following gives examples of different management programs and the corresponding addition positions:

[0093] For a management program that determines the number of times a function is executed, it can be a piece of code that implements an accumulation function. Each time this code is executed, the variable set in the code can be incremented by one. The corresponding addition position in the cache data operation function can be the first line of the cache data operation function. After inserting the management program into the first line like this, each time the cache data operation function starts to execute, the management program can increment the execution count of the function by one.

[0094] For a management program that determines the execution duration of a function, it can be a piece of code that implements a timing function. The timing can be started when the cache function starts to execute and stopped when the cache function finishes execution, thereby obtaining the function execution duration. The corresponding addition positions can be the first line and the last line of the cache operation function respectively.

[0095] For a management program that determines the execution result of a function, it can be a piece of code that implements the judgment and recording of the execution result. When the cache data operation function is a cache data reading function, the corresponding execution result can be that cache data is read from the cache, or cache data is not read from the cache. Specifically, the management program can determine whether the cache data reading function reads cache data from the cache according to the execution result returned after the cache data reading function is executed. The corresponding addition position can be the last line of the cache operation function respectively.

[0096] For a management program that determines the function name of other functions that call the cache data operation function, it can be a piece of code that implements a write operation. Among them, other functions that call the cache data operation function are the interfaces for calling the cache data operation function. Each interface can pass relevant call information to the cache data operation function when calling the cache data operation function, which can include the interface name of the interface. Technicians can set this management program to be the same piece of code as the management program that determines the number of times a function is executed, and it can be added to the first line of the cache data operation function. After inserting the management program into the first line like this, each time the cache data operation function starts to execute, the management program can increment the execution count of the function by one and record the interface name of the interface that calls the cache data operation function. In addition, the call information can also include the business object identifier of the business object to which the target business data to be read by the corresponding interface belongs. For example, it can be the ID (Identity document) of a user, the ID of a merchant, etc. Therefore, this management program can also record the business object identifier of the business object to which the business data read each time by the interface belongs, and can count the number of times each business object identified by the business object identifier is read.

[0097] Step 104: Execute the first cache data operation function after the addition process to obtain the execution information of the cache data operation function after the addition process.

[0098] Among them, the SDK can insert the above program code into a determined first cache data operation function to obtain a second cache data operation function. After the second cache data operation function is executed, the management program included in the second cache data operation function can determine the function execution times, function execution results, function execution durations, and the function names of other functions that call the cache data operation function. In actual processing, the second cache data operation function is equivalent to the first cache data operation function, except that it has the program code corresponding to the added management program, and the corresponding function names and program codes other than the management program can be the same. That is, when the first storage data operation function is triggered in the service execution program, it is actually the second storage operation function that is triggered.

[0099] After the second cache operation function is triggered, the operation functions inserted in the second cache operation function will also be executed, thereby determining the execution information corresponding to the second cache data operation function. For example, determining the execution times of the second cache data operation function, function execution results, function execution durations, and the function names of other functions that call the cache data operation function, etc.

[0100] According to the determined cache data operation function execution times, function execution results, function execution durations, etc., the cache hit rate, cache miss count, etc. can also be calculated. Among them, the cache hit rate can be the ratio of the number of successful function execution results to the function execution times, and the cache miss count can be the number of failed function execution results.

[0101] In an implementable manner, the management program can also be used to determine the target business object to which the read cache data belongs; determine the read times of the cache data corresponding to the target business object.

[0102] In implementation, when the first cache data operation function is a cache data reading function, other functions can read the service data stored in the cache by calling the cache data reading function. The service data stored in the cache can belong to different business objects. For example, when the service is an order service, the corresponding business objects can be users or merchants, and the stored service data can be the relevant data of users or the relevant data of merchants. When the cache data reading function reads the service data in the cache, the management program can determine and record the business object to which the currently read service data belongs. For example, the business object identifier carried in the instruction can be obtained from the instruction that calls the cache data reading function, such as a user ID, a merchant ID, etc. After storing the corresponding business object, the read times of the service data of the business object can be determined.

[0103] In this way, after the number of times the service data corresponding to the service object is read is sent to the management device, the service object with a relatively large number of reads can be determined, and then the cache data writing function can be improved. For example, after the corresponding service execution program starts to execute each time, the cache data writing function can be controlled to write the service data of the service object with a relatively large number of reads determined into the cache first.

[0104] Step 105: Send the execution information of the second cache data operation function to the management device.

[0105] Among them, the management device can be a server or a terminal. When the management device is a server, the server can be called a management server. The management server can periodically execute the acquisition notification corresponding to the execution information of the cache data operation function sent by the service server in the above steps 101-105. After receiving the corresponding acquisition notification, the service server can send the currently obtained execution information of the cache operation function to the management server. Among them, the execution information can include the number of times the cache data operation function corresponding to the target service is executed, the function execution result, the function execution duration, and the interface for calling the cache data operation function, etc. Or, it can also include the cache hit rate, cache failure count, etc. calculated based on the function execution times and function execution results.

[0106] The management server can send the received execution information to the management terminal so that the management terminal can visually display the execution information.

[0107] In addition, the service server can also send the attribute information of the cache data corresponding to the target service to the management server. The management server can forward the attribute information of the cache data corresponding to the target service to the management terminal, or the service server can directly send the cache data corresponding to the target service to the management terminal so that the management terminal can visually display the attribute information of the cache data of the received target service and the execution information.

[0108] As Figure 2 shown, Figure 2 is the visual display interface provided by the management terminal. In this visual display interface, it can include the service names corresponding to different services. The user can click on the corresponding service name to view the execution information of the cache data operation function of the corresponding service and the attribute information of the cache data of the target service, etc.

[0109] In addition, after receiving the execution information of the second cache data operation function sent by the server, the management device may, according to the execution information of the second cache data operation function, send an operation instruction for the cache data operation function to the server, and the operation instruction carries a data identifier corresponding to the cache data of the target service. The server may receive the operation instruction for the cache data operation function sent by the management device and execute the target cache data operation function based on the data identifier.

[0110] A method for querying cache data is also provided in the management terminal. As Figure 3 shown, the user may query relevant information of the cache data according to the interface for calling the cache operation function, the data source, the data name of the cache data, and the implementation type of the corresponding cache. Further, after the data structure of the queried cache data, the user may also perform operations such as querying and deleting the cache data according to the cache data operation function corresponding to the cache data. As in Figure 3 , the user may query the cache data according to at least one of the interface for calling the cache operation function, the data source, the data name of the cache data, and the implementation type of the corresponding cache. After querying the corresponding cache data, the user may input the data identifier corresponding to the cache data in the corresponding cache data operation box. Among them, when the cache data is a Key-Value (KV) pair, the corresponding data identifier may be the K value of the data, and the K value may be the object identifier of the business object to which the cache data belongs, such as a user ID, a merchant ID, etc. After inputting the data identifier corresponding to the cache data in the cache data operation box, the user may click the corresponding operation option, such as a query option, a delete option, etc., to trigger an operation instruction for the cache data operation function sent to the server, and the operation instruction carries a data identifier corresponding to the cache data of the target service. The server may receive the operation instruction for the cache data operation function sent by the management device and execute the target cache data operation function based on the data identifier (such as the K value corresponding to the cache data). The target cache data operation function may be the data storage operation function corresponding to the operation option. For example, the query option corresponds to the cache data reading function, and the delete option corresponds to the cache data deletion function, etc.

[0111] In an embodiment of the present application, by determining a first cache data operation function that operates on cache data in a service execution program corresponding to a target service, and then adding a management program for determining the execution information of the function to the first cache data operation function, the first cache data operation function after the addition process (i.e., the second cache data operation function) is obtained. In this way, when the first cache data operation function after the addition process is triggered to execute, the execution information of the first cache data operation function can be determined through the added management program and sent to the management terminal. It can be seen that with the present application, it is not necessary for technicians to write corresponding programs for managing cache data for each service. By inserting code into the cache data operation function, the management of cache data can be achieved.

[0112] Any combination of the above optional technical solutions can form an optional embodiment of the present disclosure, which will not be elaborated here one by one.

[0113] Figure 4 This is a device for managing cache data provided by an embodiment of the present application. The device may be the server in the above embodiment. Refer to Figure 4 and the device includes:

[0114] An acquisition module 410, configured to acquire a service execution program corresponding to a target service;

[0115] A determination module 420, configured to determine a first cache data operation function that operates on the cache data of the target service in the service execution program;

[0116] An addition module 430, configured to add a management program for determining the execution information of the function to the first cache data operation function to obtain the second cache data operation function after the addition process;

[0117] An execution module 440, configured to execute the second cache data operation function to obtain the execution information of the second cache data operation function;

[0118] A sending module 450, configured to send the execution information of the second cache data operation function to a management device.

[0119] Optionally, the determination module is configured to:

[0120] Based on the service type identifier included in the service execution program, determine the service type to which the target service belongs;

[0121] In a preset correspondence between service types and cache data operation functions, determine the first cache data operation function corresponding to the target service.

[0122] Optionally, the execution information includes at least one of the number of function executions, the function execution result, the function execution duration, and the function names of other functions that call the cache operation function.

[0123] Optionally, the first cache data operation function includes at least one of a cache data writing function, a cache data reading function, and a cache data deleting function;

[0124] The adding module is used for:

[0125] Based on the correspondence between the cache data operation function and the program adding position, determine the target adding position for adding the management program in the first cache data operation function;

[0126] Add the management program at the target adding position of the first cache data operation function.

[0127] Optionally, the first cache data operation function is a cache data reading function, and the execution module is used for:

[0128] Determine the target business object to which the read cache data belongs;

[0129] Determine the number of times the cache data corresponding to the target business object is read;

[0130] The determining module is further used for:

[0131] Among the number of times the cache data corresponding to each business object is read, determine the business object identifiers of the preset number of business objects with the highest corresponding read times;

[0132] Send the business object identifiers of the preset number of business objects to the management terminal.

[0133] Optionally, the determining module is further used for:

[0134] Based on the service execution program, determine the attribute information of the cache data of the target service, where the attribute information includes at least one of the data source information, data name, and data structure of the cache data of the target service;

[0135] Send the attribute information of the cache data of the target service to the management device, and the management device is used to display the function name of the first cache data operation function received and the attribute information of the cache data.

[0136] Optionally, the execution module is further used for:

[0137] Receive the operation instruction of the cache data operation function sent by the management device, where the operation instruction carries the data identifier corresponding to the cache data of the target service;

[0138] Execute the target cache data operation function based on the data identifier.

[0139] It should be noted that when the device for managing cache data provided in the above embodiment manages cache data, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device for managing cache data provided in the above embodiment and the method embodiment for managing cache data belong to the same concept. For the specific implementation process, please refer to the method embodiment and will not be elaborated here.

[0140] Figure 5 It is a schematic structural diagram of a server provided by an embodiment of the present application. The server 500 may vary greatly due to configuration or performance differences, and may include one or more processors (central processing units, CPUs) 501 and one or more memories 502. Among them, at least one instruction is stored in the memory 502, and the at least one instruction is loaded and executed by the processor 501 to implement the methods provided in the above method embodiments. Of course, the server may also have components such as wired or wireless network interfaces, keyboards, and input / output interfaces for input / output. The server may also include other components for implementing device functions, which will not be elaborated here.

[0141] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including instructions. The above instructions can be executed by a processor in a terminal to complete the method for managing cache data in the above embodiment. The computer-readable storage medium may be non-transitory. For example, the computer-readable storage medium may be a ROM (read-only memory), a RAM (random access memory), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0142] Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiment can be completed by hardware, or can be completed by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and the above-mentioned storage medium can be a read-only memory, a magnetic disk, or an optical disc, etc.

[0143] The above is only a preferred embodiment of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for managing cached data, characterized in that, the method includes: obtaining a service execution program corresponding to a target service; determining, in the service execution program, a first cached data operation function for operating on the cached data of the target service, where the first cached data operation function includes at least one of a cached data writing function, a cached data reading function, and a cached data deleting function; based on the correspondence between the management program for determining the execution information of the function and the program addition position, determining the target addition position of the management program in the first cached data operation function; adding the management program at the target addition position in the first cached data operation function to obtain a second cached data operation function; executing the second cached data operation function to obtain the execution information of the second cached data operation function; sending the execution information of the second cached data operation function to a management device.

2. The method according to claim 1, characterized in that, the determining, in the service execution program, a first cached data operation function for operating on the cached data of the target service includes: determining the service type to which the target service belongs based on the service type identifier included in the service execution program; determining the first cached data operation function corresponding to the target service in the preset correspondence between the service type and the cached data operation function.

3. The method according to claim 1, characterized in that, the execution information includes at least one of the number of function executions, the function execution result, the function execution duration, and the function name of other functions that call the cached data operation function.

4. The method according to claim 1, characterized in that, when the first cached data operation function is a cached data reading function, the executing the second cached data operation function to obtain the execution information of the second cached data operation function includes: determining the target service object to which the cached data read by the second cached data operation function belongs; determining the number of times the cached data corresponding to the target service object is read; the method further includes: determining, among the number of times the cached data corresponding to each service object is read, the service object identifiers of the preset number of service objects with the highest corresponding number of reads; sending the service object identifiers of the preset number of service objects to a management terminal.

5. The method according to claim 1, characterized in that, after obtaining the service execution program corresponding to the target service, the method further includes: determining the attribute information of the cached data of the target service based on the service execution program, where the attribute information includes at least one of the data source information, the data name, and the data structure of the cached data of the target service; sending the attribute information of the cached data of the target service to a management device, and the management device is used to display the function name of the received first cached data operation function and the attribute information of the cached data.

6. The method according to claim 1, characterized in that, the method further includes: Receive the operation instruction of the cache data operation function sent by the management device, where the operation instruction carries the data identifier corresponding to the cache data of the target service; Execute the target cache data operation function based on the data identifier.

7. A computer device, characterized in that, the computer device includes a processor and a memory, and at least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor to implement the operations performed by the method for managing cache data according to any one of claims 1 to 6.

8. A computer-readable storage medium, characterized in that, at least one instruction is stored in the storage medium, and the at least one instruction is loaded and executed by a processor to implement the operations performed by the method for managing cache data according to any one of claims 1 to 6.

9. A computer program product, characterized in that, the computer program product includes at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the operations performed by the method for managing cache data according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and system for caching function execution result based on aspect-oriented programming (AOP) technology

    CN102999319A