A cache function control method and device, computer device and storage medium
By adjusting the bytecode of the target service process in the Java Virtual Machine and loading the JavaAgent cache control function, the problem of increased development time and error rate caused by cache function control methods is solved, achieving efficient cache function control and improving the development efficiency and cache quality of business systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN BANK CO LTD
- Filing Date
- 2022-06-17
- Publication Date
- 2026-06-02
AI Technical Summary
In existing technologies, the control methods for caching functions increase system development time and error rates, affecting the development efficiency of network service systems.
By creating a target virtual machine object in the Java Virtual Machine, adjusting the bytecode of the target service process, and dynamically loading the JAR package for JavaAgent cache control, data caching can be written, read, modified, or deleted, avoiding the need for redevelopment of the target Java process.
It improves the development efficiency of business systems, saves development time, and the caching function is independent and shareable, supports multiple iterations, and ensures the caching quality of service processes.
Smart Images

Figure CN115203252B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and specifically to a method, apparatus, computer device, and storage medium for controlling a caching function. Background Technology
[0002] With the development of information network technology, various network services have been developed based on Java. To improve the efficiency of query interfaces, caching control functions are often provided. A caching control layer is added to the server to pre-fetch data and save it in storage. If the data queried by the user is in the cache, it is directly retrieved from the cache and returned to the user, thereby improving data query efficiency.
[0003] In related technologies, the main way to control caching functionality is by connecting to the caching system, storing data, querying data, managing cache expiration and invalidation, and deleting cached data in the implementation code of the network service. This increases the system's development time and error rate, thereby affecting the development efficiency of the network service system. Summary of the Invention
[0004] This application provides a method, apparatus, computer device, and storage medium for controlling caching functions, which can improve the development efficiency of business systems.
[0005] This application provides a method for controlling caching functionality, including:
[0006] Once the process control character of the target service process is obtained, a target virtual machine object is created for the target service process based on the virtual machine, wherein the target virtual machine object includes a first method for providing data caching functionality;
[0007] A second method for identifying the data caching functionality required in the target service process;
[0008] Based on the first method, the bytecode of the second method in the target service process is adjusted so that the adjusted target service process has a data caching function;
[0009] In response to data caching, the data caching function is implemented through the adjusted target service process to enable data caching for writing, reading, modification, or deletion.
[0010] Accordingly, embodiments of this application also provide a control device for a caching function, including:
[0011] A creation unit is used to obtain the process control character of the target service process, and then create a target virtual machine object for the target service process based on the virtual machine, wherein the target virtual machine object includes a first method for providing data caching function;
[0012] A determining unit is used to determine a second method for the target service process that requires data caching functionality.
[0013] An adjustment unit is configured to adjust the bytecode of the second method in the target service process based on the first method, so that the adjusted target service process has a data caching function;
[0014] The access unit is used to respond to the data cache by implementing the data caching function through the adjusted target service process, so as to realize the writing, reading, modification or deletion of the data cache.
[0015] In some embodiments, the creation unit includes:
[0016] Create a subunit for creating an initial virtual machine object for the target service process based on the virtual machine;
[0017] A subunit is added for calling the first method through the initial virtual machine object and configuring the target file package as a parameter of the first method to obtain the target virtual machine object, wherein the target file package is used to modify bytecode.
[0018] In some embodiments, the adjustment unit includes:
[0019] The adjustment subunit is used to call the first method and modify the bytecode of the second method using the target file package in the first method.
[0020] In some embodiments, the adjustment subunit is specifically used for:
[0021] A modification object is obtained through the target file package;
[0022] The target bytecode is added to the bytecode in the second method based on the modified object, so that the second method can implement the data caching function.
[0023] In some embodiments, the determining unit includes:
[0024] The first acquisition subunit is used to acquire the interface configuration information of the target service process;
[0025] The first determining unit is used to determine, based on the interface configuration information, at least one target interface that requires data caching functionality from multiple interfaces of the target service process.
[0026] The second determining subunit is used to determine the second method based on the method of the target interface.
[0027] In some embodiments, the device further includes:
[0028] The first acquisition unit is used to acquire the process identifier of the target service process;
[0029] The association unit is used to associate the virtual machine with the target service process based on the process identifier.
[0030] In some embodiments, the device further includes:
[0031] The second acquisition unit is used to acquire the access information of the current target service process to the target data in the cached data;
[0032] An update unit is used to update the cached data based on the access information.
[0033] Accordingly, this application also provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes a control method for any of the caching functions provided in this application.
[0034] Accordingly, this application also provides a storage medium that stores multiple instructions, which are adapted for loading by a processor to execute the above-described control method for cache functionality.
[0035] This application obtains the identifier of the target Java process when the target Java process needs data caching. Using the identifier, it connects to the target process using Java's built-in Virtual Machine. After connection, a Virtual Machine object is obtained. The loadAgent of the Virtual Machine object is called to dynamically load the JAR package of JavaAgent caching control function into the target Java process. The JAVAInstrument object is then obtained, and the bytecode of the target JAVAagent is modified using the JAVAInstrument object. This enables the target Java process to use caching-related functions without having to redevelop the target Java process, saving development time and improving development efficiency. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 This is a flowchart illustrating a caching function control method provided in an embodiment of this application.
[0038] Figure 2 A flowchart illustrating another method for controlling caching functionality provided in an embodiment of this application.
[0039] Figure 3 This is a structural block diagram of a caching function control device provided in an embodiment of this application.
[0040] Figure 4 A schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0041] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0042] This application provides a method, apparatus, storage medium, and computer device for controlling caching functionality. Specifically, the caching functionality control method of this application can be executed by a computer device, which can be a server or similar device. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0043] For example, the computer device can be a server that can obtain the process control terminator of the target service process. Then, based on the virtual machine, a target virtual machine object is created for the target service process. This target virtual machine object includes a first method for providing data caching functionality; a second method for determining if the target service process requires data caching functionality; based on the first method, adjusting the bytecode of the second method in the target service process so that the adjusted target service process has data caching functionality; and in response to data caching, implementing the data caching functionality through the adjusted target service process to achieve data caching writing, reading, modification, or deletion.
[0044] To address the aforementioned issues, this application provides a method, apparatus, computer device, and storage medium for controlling caching functionality, which can improve the development efficiency of business systems.
[0045] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.
[0046] This application provides a method for controlling a caching function. This method can be executed by a terminal or a server. This application uses the example of a caching function control method being executed by a server to illustrate the method.
[0047] Please see Figure 1 , Figure 1 This is a flowchart illustrating a caching function control method provided in an embodiment of this application. The specific flow of the caching function control method can be as follows:
[0048] 101. Once the process control identifier of the target service process is obtained, a target virtual machine object is created for the target service process based on the virtual machine.
[0049] Here, the target service process refers to an execution process of the target service, or a running activity on a certain data set. The process control character can refer to the running identifier of the target service process, which indicates that the target service needs to implement data caching functionality.
[0050] In this application embodiment, the target service can be a network service developed using Java (an object-oriented computer programming language). A network service refers to a service-oriented, distributed program-based software module that runs on a network. The network service adopts common Internet standards such as HTTP (Hypertext Transfer Protocol) and XML (Extensible Markup Language), allowing users to access data on the network from different locations through different terminal devices, such as online shopping.
[0051] Among them, cached data refers to data in the cache system, which can be used to provide the data required for the target service to run. For example, if the target service process needs to query certain data, it can obtain the data from the cache without querying from the network, which can improve data access efficiency.
[0052] Specifically, the target service process needs to implement data caching functionality, which means that the target service process needs to support caching functionality, and when the target service process has caching functionality, it can access the data in the cache.
[0053] In this embodiment, the virtual machine can be the Virtual Machine that comes with Java, also known as the Java Virtual Machine. A virtual machine is an abstract computer that simulates various computer functions on a real computer. The Java Virtual Machine has a complete hardware architecture, such as a processor, stack, and registers, and also has a corresponding instruction set. The Java Virtual Machine shields information related to specific operating system platforms, allowing Java programs to run on multiple platforms without modification simply by generating target code (bytecode) that runs on the Java Virtual Machine.
[0054] In some embodiments, in order to dynamically add cache to the target service process, the step "create a target virtual machine object for the target service process based on the virtual machine" may include the following operations:
[0055] An initial virtual machine object is created for the target service process based on the virtual machine;
[0056] Add a first method to the initial virtual machine object and configure the target file package as a parameter of the first method to obtain the target virtual machine.
[0057] Specifically, a virtual machine object is created for the target service process through the virtual machine to obtain the initial virtual machine object. Then, a first method is added to the initial virtual machine object. For example, the first method can be the loadAgent method, which can be used to provide data caching functionality.
[0058] The target file package refers to the JAR file used to implement JavaAgent caching control functionality. JAR (Java Archive) is a platform-independent file format that combines multiple files into a single file. Users can bind multiple Java applets (small applications written in Java) and their necessary components (.class files, images, and sounds) into a JAR file, and then download it to the browser as a single, simple HTTP transaction, which can improve download speed. A JAR file is a Java Archive File, a document format for Java. JAR files are very similar to compressed files and can be called file packages.
[0059] Specifically, the target file package is configured as a parameter of the first method in the target virtual object so that the first method can provide data caching functionality.
[0060] In some embodiments, in order to enable the target service process to connect with the virtual machine, the following steps may be included before the step "creating a target virtual machine object for the target service process based on the virtual machine":
[0061] Obtain the process identifier of the target service process;
[0062] Associating virtual machines with target service processes based on process identifiers.
[0063] The process identifier, also known as the PID (Process Identity Document), refers to the identifier of the target service process in the operating system. The target service process can be located using its process identifier.
[0064] Furthermore, the process identifier is associated with the virtual machine, thereby enabling connection to the target service process.
[0065] 102. A second method to determine the data caching function required in the target service process.
[0066] The second method refers to the method by which the target service process interacts with the caching system. There can be one or more second methods.
[0067] In some embodiments, to quickly determine the second method, the step "determine the second method that requires data caching functionality in the target service process" may include the following operations:
[0068] Obtain the interface configuration information of the target service process;
[0069] Based on the interface configuration information, determine at least one target interface that requires data caching functionality from multiple interfaces of the target service process;
[0070] Based on the target interface method, determine the second method.
[0071] The interface configuration information refers to the external configuration file corresponding to the target virtual process. This external configuration file includes multiple interfaces and the interface information of each interface. The interfaces that need to be cached can be specified in advance in the external configuration file. For example, interfaces A and B can be specified as interfaces that need data caching function.
[0072] Specifically, obtain all interfaces of the target service process, match these interfaces with the interfaces that need to be cached as specified in the interface configuration information, take the interfaces that successfully match the interface configuration information as the target interfaces, and then obtain the methods corresponding to the target interfaces in the target service process to obtain the target methods.
[0073] For example, in the interface configuration information, the interfaces that need to be cached can be: interface A and interface B; to obtain all interfaces in the target service process, which can include: interface A, interface B, interface C, etc., by comparing all interfaces in the target service process with the interfaces in the interface configuration information, the target interfaces in the target service process can be determined as: interface A and interface B. Then, the methods corresponding to interface A and interface B are obtained respectively to obtain the second method.
[0074] 103. Based on the first method, adjust the bytecode of the second method in the target service process so that the adjusted target service process has data caching function.
[0075] Bytecode is a binary file containing an executable program, consisting of a sequence of op code / data pairs; it is a type of intermediate code. A byte is a unit of data volume in a computer.
[0076] Specifically, the bytecode of the second method in the target service process can be adjusted through the target file package in the first method, so that the adjusted second method supports data caching function, thereby enabling the target service process to have data caching function.
[0077] In some embodiments, in order to enable the target service process to have data caching functionality, the step "adjusting the bytecode of the second method in the target service process based on the first method" may include the following operations:
[0078] The first method is invoked, and the bytecode of the second method is modified using the target file package in the first method.
[0079] Specifically, the first method of the target virtual object is called by the virtual machine, and the target file package in the first method is dynamically loaded into the second method of the target service process. Then, the bytecode in the second method is modified by the target file package to adjust the second method and obtain a second method that supports data caching function.
[0080] In some embodiments, to improve the efficiency of bytecode modification, the step "modifying the bytecode of the second method using the target file package in the first method" may include the following operations:
[0081] Obtain a modified object from the target file package;
[0082] The target bytecode is added to the bytecode in the second method based on the modified object, so that the second method can implement the data caching function.
[0083] Specifically, the modified object can be used to modify the bytecode of the target service process. This modified object can be a Java Instrumentation object. A Java Instrumentation refers to an agent program, independent of the application, used to monitor and assist applications running on the Java Virtual Machine. This monitoring and assistance includes, but is not limited to, obtaining the runtime state of the Java Virtual Machine and replacing and modifying class definitions.
[0084] The target bytecode refers to the bytecode that implements the caching function, such as functions for reading, writing, and modifying the cache.
[0085] Specifically, by using the target file package to modify the object and add target bytecode to the bytecode of the second method, the second method can support cache control functionality.
[0086] 104. In response to data caching, the target service process data caching function is adjusted to enable data caching writing, reading, modification, or deletion.
[0087] Data caching refers to accessing data in a cache, which can be triggered by the target service process based on user actions.
[0088] After adjusting the target service process as described above, the adjusted target service process has data caching functionality. Then, the data in the cache can be accessed through the adjusted target service process according to the access operation, thereby obtaining the target data required by the data cache, so as to realize data cache writing, reading, modification or deletion.
[0089] In some embodiments, to improve the efficiency of the target service process in accessing cached data, after the step "obtain the required target data by adjusting the target service process data cache function data", the following operations may also be included:
[0090] Obtain access information of the target service process to the target data in the cache;
[0091] Update cached data based on access information.
[0092] The access information may include whether the target data was retrieved from the cache.
[0093] If the access information indicates that the target data was retrieved from the cache, the information about the current access to the target data, including the access time, can be recorded in the cache so that the number of accesses and the access time for updating the target data can be cached, making it convenient to perform access statistics on the target data.
[0094] If the access information indicates that the target data was not found in the cache, the target data can be retrieved and stored in the cache to facilitate access to the target data by other service processes in the future.
[0095] This application discloses a method for controlling caching functionality. The method includes: obtaining the process control character of a target service process; creating a target virtual machine object for the target service process based on a virtual machine, wherein the target virtual machine object includes a first method for providing data caching functionality; determining a second method in the target service process that requires data caching functionality; adjusting the bytecode of the second method in the target service process based on the first method, so that the adjusted target service process has data caching functionality; and implementing the data caching functionality through the adjusted target service process in response to data caching, thereby enabling data caching write, read, modification, or deletion. This improves the efficiency of controlling caching functionality in service processes.
[0096] Based on the above description, the following examples will further illustrate the control method of the caching function in this application. Please refer to... Figure 2 , Figure 2 The flowchart illustrates another caching function control method provided in this application embodiment. Taking the application of this caching function control method to a server as an example, the specific process can be as follows:
[0097] 201. The server receives a cache access request based on the target service process and obtains the process identifier of the target service process.
[0098] Among them, a cache access request based on the target service process refers to an access request to cached data through the target service process. A cache access request indicates that the target service process needs to implement caching functionality. Therefore, upon receiving a cache access request, an instruction to add caching functionality to the target service process can be triggered. Then, the process identifier (PID) of the target service process can be obtained, which is the identifier of the target service process in the operating system.
[0099] 202. The server associates the virtual machine with the target service process based on the process identifier, and determines the target virtual machine object corresponding to the target service process.
[0100] First, the target service process is located using its process identifier. Then, using Java's built-in Virtual Machine, a connection is made to the target service process. After connecting, a Virtual Machine object is obtained.
[0101] Virtual Machine is a Java Virtual Machine management class used to manage Java processes. Connecting to a target service process refers to creating a Virtual Machine object for the target service process.
[0102] 203. The server calls the target method in the target virtual machine object, and adjusts the bytecode in the method of the target service process through the parameters of the target method to obtain the updated target service process.
[0103] The target method can be the loadAgent method.
[0104] Specifically, the loadAgent method of the Virtual Machine object is called. The parameter of the loadAgent method can be a standalone JAR file that can implement the "JavaAgent cache control" function. By loading the JAR file into the target service process, the "JavaAgent cache control" function can be dynamically added to the target service process.
[0105] The `loadAgent` method can accept a JAR file as a parameter, and the main class of this JAR file can modify the bytecode of the target service process. In this embodiment, the modification of the bytecode can add caching support to methods that require caching.
[0106] Specifically, by loading the JAR package into the target service process, it is possible to specify that a certain interface of the target service process needs to be cached through external configuration files, interfaces, etc. The functionality of the JAR package is to add bytecode that supports caching to the implementation method corresponding to the interface of the target service process.
[0107] Additionally, the JAR package can obtain a Java Instrumentation object, which can be used to modify the bytecode of the target service process.
[0108] When executing the JAR package command, the address of the "caching system" can be specified, as well as which methods in the target service process need to implement caching—that is, which methods need to write to and modify cached values, and which methods need to read cached values. The mapping between method parameters and cached data, etc., can also be specified. With this information, "JavaAgent Cache Control" can use Java Instrumentation objects to modify the bytecode of the methods that need to implement caching. In this embodiment, the main purpose of modifying the bytecode is to add cache read, write, and modify functions to the methods.
[0109] 204. The server accesses cached data through the updated target service process.
[0110] After loading the JAR package from the target method into the target service process, the target service process, which originally could not use the caching function, can now support the use of the caching function and access the cached data through the updated target service process.
[0111] In addition, the JavaAgent caching control function can expose some interfaces for external use. For example, changing the caching system address, enabling or disabling the caching function, and providing API call information statistics.
[0112] Enabling JavaAgent caching control can be done either directly during the `loadAgent` method call, or by using a loaded JAR file to create a server within the target service process, listening on a port to accept requests to access the cache. This request can be used to configure, enable, or disable the caching function.
[0113] The feature of recording cached call information allows for the addition of logging functionality while modifying bytecode and supporting caching. The address for storing these records can be set in the configuration file mentioned above or through server interface settings. The recorded information can include the number of times the cache was called, whether the target data exists in the cache, and the time taken, facilitating the recording of access information for cached data.
[0114] In this embodiment, the caching module within the service process is separated, saving business development time. The caching functionality, added based on JavaAgent technology, does not need to intrude into the business code, thus streamlining the business code and facilitating subsequent maintenance. Furthermore, since the caching functionality in this solution is independent and supports sharing, a high-quality version can be obtained through multiple iterations. After being applied to the target service process, the caching quality of each service process can be guaranteed.
[0115] This application discloses a method for controlling caching functionality. The method includes: a server receiving a cache access request based on a target service process; obtaining the process identifier of the target service process; associating a virtual machine with the target service process based on the process identifier; determining the target virtual machine object corresponding to the target service process; calling a first method in the target virtual machine object; adjusting the bytecode in the method of the target service process using the parameters of the first method to obtain an updated target service process; and accessing cached data through the updated target service process. By dynamically adding caching functionality to service processes, service processes that originally did not support caching can implement caching functionality without redevelopment, re-verification, or redeployment, thereby improving service operation and maintenance efficiency.
[0116] To facilitate better implementation of the caching function control method provided in the embodiments of this application, the embodiments of this application also provide a caching function control device based on the above-described caching function control method. The meanings of the terms used are the same as in the above-described caching function control method, and specific implementation details can be found in the descriptions in the method embodiments.
[0117] Please see Figure 3 , Figure 3 This application provides a structural block diagram of a caching function control device, which includes:
[0118] Creation unit 301 is used to obtain the process control character of the target service process, and then create a target virtual machine object for the target service process based on the virtual machine, wherein the target virtual machine object includes a first method for providing data caching function;
[0119] Determining unit 302 is used to determine a second method for the target service process that requires data caching functionality.
[0120] The adjustment unit 303 is used to adjust the bytecode of the second method in the target service process based on the first method, so that the adjusted target service process has a data caching function;
[0121] Access unit 304 is used to respond to data caching by implementing data caching functionality through the adjusted target service process, so as to realize data caching writing, reading, modification or deletion.
[0122] In some embodiments, the creation unit 301 may include:
[0123] Create a subunit for creating an initial virtual machine object for the target service process based on the virtual machine;
[0124] A subunit is added for calling the first method through the initial virtual machine object and configuring the target file package as a parameter of the first method to obtain the target virtual machine object, wherein the target file package is used to modify bytecode.
[0125] In some embodiments, the adjustment unit 303 may include:
[0126] The adjustment subunit is used to call the first method and modify the bytecode of the second method using the target file package in the first method.
[0127] In some embodiments, the adjustment subunit can be specifically used for:
[0128] A modification object is obtained through the target file package;
[0129] The target bytecode is added to the bytecode in the second method based on the modified object, so that the second method can implement the data caching function.
[0130] In some embodiments, the determining unit 302 may include:
[0131] The first acquisition subunit is used to acquire the interface configuration information of the target service process;
[0132] The first determining unit is used to determine, based on the interface configuration information, at least one target interface that requires data caching functionality from multiple interfaces of the target service process.
[0133] The second determining subunit is used to determine the second method based on the method of the target interface.
[0134] In some embodiments, the device may further include:
[0135] The first acquisition unit is used to acquire the process identifier of the target service process;
[0136] The association unit is used to associate the virtual machine with the target service process based on the process identifier.
[0137] In some embodiments, the device may further include:
[0138] The second acquisition unit is used to acquire the access information of the current target service process to the target data in the cached data;
[0139] An update unit is used to update the cached data based on the access information.
[0140] This application discloses a caching function control device. A creation unit 301 obtains the process control character of a target service process and creates a target virtual machine object for the target service process based on a virtual machine. The target virtual machine object includes a first method for providing data caching functionality. A determination unit 302 determines a second method in the target service process that requires data caching functionality. An adjustment unit 303, based on the first method, adjusts the bytecode of the second method in the target service process, enabling the adjusted target service process to have data caching functionality. An access unit 304, in response to the data cache, implements the data caching function through the adjusted target service process, thereby enabling data cache writing, reading, modification, or deletion. This can improve the development efficiency of business systems.
[0141] Accordingly, embodiments of this application also provide a computer device, which can be a server. For example... Figure 4 As shown, Figure 4This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device 400 includes a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, and a computer program stored on the memory 402 and executable on the processor. The processor 401 and the memory 402 are electrically connected. Those skilled in the art will understand that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0142] The processor 401 is the control center of the computer device 400. It connects various parts of the computer device 400 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, it performs various functions of the computer device 400 and processes data, thereby monitoring the computer device 400 as a whole.
[0143] In this embodiment, the processor 401 in the computer device 400 loads the instructions corresponding to the processes of one or more applications into the memory 402 according to the following steps, and the processor 401 runs the applications stored in the memory 402 to achieve various functions:
[0144] Once the process control terminator of the target service process is obtained, a target virtual machine object is created for the target service process based on the virtual machine. The target virtual machine object includes a first method that provides data caching functionality.
[0145] A second method for identifying the data caching functionality required in the target service process;
[0146] Based on the first method, the bytecode of the second method in the target service process is adjusted so that the adjusted target service process has data caching function;
[0147] In response to data caching, the data caching function is implemented through the adjusted target service process to enable data caching for writing, reading, modification, or deletion.
[0148] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0149] Optional, such as Figure 4 As shown, the computer device 400 also includes: a touch screen display 403, a radio frequency circuit 404, an audio circuit 405, an input unit 406, and a power supply 407. The processor 401 is electrically connected to the touch screen display 403, the radio frequency circuit 404, the audio circuit 405, the input unit 406, and the power supply 407. Those skilled in the art will understand that... Figure 4 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0150] The touch display screen 403 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 403 may include a display panel and a touch panel. The display panel can be used to display messages input by the user or messages provided to the user, as well as various graphical user interfaces of the computer device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives the touch message from the touch detection device, converts it into touch point coordinates, and sends it to the processor 401. It can also receive and execute commands from the processor 401. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 401 to determine the type of touch event. Subsequently, the processor 401 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 403 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 403 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 403 can also be used as part of the input unit 406 to achieve input functions.
[0151] In this embodiment, a game application is executed by processor 401 to generate a graphical user interface (GUI) on touch display screen 403. The virtual scene on the GUI includes at least one skill control area, and the skill control area includes at least one skill control. The touch display screen 403 is used to present the GUI and receive operation commands generated by the user interacting with the GUI.
[0152] The radio frequency circuit 404 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other computer devices, and to transmit and receive signals with network devices or other computer devices.
[0153] Audio circuitry 405 can be used to provide an audio interface between a user and a computer device via a speaker and a microphone. Audio circuitry 405 can convert received audio data into electrical signals and transmit them to the speaker, where the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 405, converted back into audio data, and then processed by processor 401 before being transmitted via radio frequency circuitry 404 to, for example, another computer device, or output to memory 402 for further processing. Audio circuitry 405 may also include an earphone jack to facilitate communication between peripheral headphones and the computer device.
[0154] The input unit 406 can be used to receive input numbers, character messages or user characteristic messages (such as fingerprints, iris, facial messages, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0155] Power supply 407 is used to supply power to various components of computer device 400. Optionally, power supply 407 can be logically connected to processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 407 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0156] although Figure 4 As not shown in the diagram, computer equipment 400 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0157] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0158] As can be seen from the above, the computer device provided in this embodiment, by obtaining the process control character of the target service process, creates a target virtual machine object for the target service process based on the virtual machine. The target virtual machine object includes a first method for providing data caching functionality; a second method for determining that the target service process needs data caching functionality; based on the first method, adjusting the bytecode of the second method in the target service process so that the adjusted target service process has data caching functionality; and in response to data caching, implementing data caching functionality through the adjusted target service process to realize data caching writing, reading, modification, or deletion.
[0159] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0160] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of computer programs that can be loaded by a processor to execute steps in any of the caching function control methods provided in embodiments of this application. For example, the computer program can execute the following steps:
[0161] Once the process control terminator of the target service process is obtained, a target virtual machine object is created for the target service process based on the virtual machine. The target virtual machine object includes a first method that provides data caching functionality.
[0162] A second method for identifying the data caching functionality required in the target service process;
[0163] Based on the first method, the bytecode of the second method in the target service process is adjusted so that the adjusted target service process has data caching function;
[0164] In response to data caching, the data caching function is implemented through the adjusted target service process to enable data caching for writing, reading, modification, or deletion.
[0165] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0166] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0167] Since the computer program stored in the storage medium can execute the steps in any of the caching function control methods provided in the embodiments of this application, the beneficial effects that any of the caching function control methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0168] The foregoing has provided a detailed description of a caching function control method, apparatus, storage medium, and computer device provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for controlling caching functionality, characterized in that, The method includes: Once the process control terminator of the target service process is obtained, a target virtual machine object is created for the target service process based on the virtual machine. The target virtual machine object includes a first method that provides data caching functionality. The creation method of the target virtual machine object includes: creating an initial virtual machine object for the target service process based on the virtual machine; calling the first method through the initial virtual machine object and configuring the target file package as a parameter of the first method to obtain the target virtual machine object, wherein the target file package is used to modify bytecode. A second method for identifying the data caching functionality required in the target service process; The first method is invoked, and the bytecode of the second method is modified through the target file package in the first method. The modification includes obtaining a modification object through the target file package, and adding the target bytecode to the bytecode in the second method based on the modification object, so as to adjust the bytecode of the second method in the target service process, so that the adjusted target service process has a data caching function. In response to data caching, the data caching function is implemented through the adjusted target service process to enable data caching for writing, reading, modification, or deletion.
2. The method according to claim 1, characterized in that, The second method for determining the data caching function required in the target service process includes: Obtain the interface configuration information of the target service process; Based on the interface configuration information, at least one target interface requiring data caching functionality is determined from multiple interfaces of the target service process; Based on the method of the target interface, the second method is determined.
3. The method according to claim 1, characterized in that, Before creating the target virtual machine object for the target service process based on the virtual machine, the method further includes: Obtain the process identifier of the target service process; The virtual machine is associated with the target service process based on the process identifier.
4. The method according to claim 1, characterized in that, After implementing the data caching function through the adjusted target service process, the following is also included: Obtain access information of the target service process to the target data in the cache; The cached data is updated based on the access information.
5. A control device for a caching function, characterized in that, The device includes: A creation unit is used to obtain the process control character of the target service process, and then create a target virtual machine object for the target service process based on the virtual machine. The target virtual machine object includes a first method for providing data caching functionality. The creation method of the target virtual machine object includes: creating an initial virtual machine object for the target service process based on the virtual machine; calling the first method through the initial virtual machine object and configuring the target file package as a parameter of the first method to obtain the target virtual machine object, wherein the target file package is used to modify bytecode. A determining unit is used to determine a second method for the target service process that requires data caching functionality. An adjustment unit is used to call the first method and modify the bytecode of the second method through the target file package in the first method. The modification includes obtaining a modification object through the target file package and adding the target bytecode to the bytecode in the second method based on the modification object, so as to adjust the bytecode of the second method in the target service process and enable the adjusted target service process to have data caching function. The access unit is used to respond to the data cache by implementing the data caching function through the adjusted target service process, so as to realize the writing, reading, modification or deletion of the data cache.
6. A computer device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein, The control method for implementing the caching function as described in any one of claims 1 to 4 when the processor executes the program.
7. A storage medium, characterized in that, The storage medium stores multiple instructions adapted for loading by a processor to execute the control method for the cache function as described in any one of claims 1 to 4.