Cache method, device and equipment in distributed environment and medium
By using a caching method encapsulated in a JAR file in a distributed environment to modify cached data using Java Virtual Machine memory, the problems of bloated code and wasted resources are solved, achieving stability and cost savings.
Patent Information
- Application Number
- CN202210925606.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-03
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2042-08-03
AI Technical Summary
In a distributed environment, existing caching methods have bloated code and require separate deployment and maintenance of caching plugins, resulting in a waste of resources and human resources.
A caching method based on JAR files is adopted. The target cluster server is determined through a proxy server, and the cached data is modified using Java Virtual Machine memory and encapsulated in a JAR file, thus avoiding the need to deploy a separate caching plugin.
It achieves stability and low resource consumption for cached data, saving machine resources and manpower costs, while also having a small amount of code that is lightweight and concise.
Smart Images

Figure CN115237544B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the computer technical field, and particularly to a cache method and device in a distributed environment, equipment and medium. BACKGROUND
[0002] In software system engineering, cache is an important function. In a single-machine single-process environment, stable JVM memory can be directly used as the memory of the machine to store cache. However, in a distributed environment composed of multiple servers, multiple processes constitute a cluster. At this time, if the traditional JVM memory is still used to store cache, each machine is an independent process, and each process has independent JVM memory. Therefore, when the JVM memory in a machine is configured, other machines cannot know the configuration, as shown in the accompanying drawings, so that the new configuration cannot be shared in the entire cluster. Figure 1
[0003] To solve the problem, the existing distributed cache operation for the cluster and the distributed environment uses either heavy memcached cache or redis cache. These plugins contain many other unnecessary functions besides cache, resulting in too bulky code. In addition, these plugins need to be separately deployed and maintained, which consumes certain machine resources and human resources. SUMMARY
[0004] Therefore, the present application provides a cache method and device in a distributed environment, equipment and medium to solve the problem of bulky code and separate deployment of the existing cache method in a distributed environment.
[0005] In a first aspect, the present application provides a cache method in a distributed environment, which is based on a jar file and includes the following steps.
[0006] The proxy server determines a target cluster server according to the configuration parameter and sends the configuration parameter to the target cluster server.
[0007] The target cluster server modifies cache data in the JVM memory on the target cluster server according to the configuration parameter.
[0008] In a second aspect, the present application provides a cache device in a distributed environment, which is based on a jar file and includes the following modules.
[0009] The proxy module is configured to determine a target cluster server according to a configuration parameter and send the configuration parameter to the target cluster server.
[0010] a modification module, configured to modify the cached data in the java virtual machine memory on the target cluster server according to the configuration parameter.
[0011] In a third aspect of the present application, a computer device is provided, comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, and the processor implements the cache method in a distributed environment when executing the computer program.
[0012] In a fourth aspect of the present application, a storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the cache method in a distributed environment.
[0013] The cache method, device, equipment and medium based on a distributed environment as described above consider the characteristics of low cache data call frequency, utilize the stability of the java virtual machine memory, store the cache data of each cluster server in the java virtual machine memory, so that the consumption of cache data read-write operation is lower and the storage is more stable, and no additional machine is needed to build cache space and maintain cache pool, saving human resources and use cost. After the proxy server receives the configuration parameter, the cluster server to be modified according to the configuration parameter is determined as the target cluster server, and the configuration parameter is sent to the target cluster server, and then the target cluster server modifies the cache data stored in the java virtual machine memory according to the configuration parameter. The method is implemented based on the jar file, and no plug-in needs to be installed separately, so that no separate deployment and maintenance are needed. Further, since the method is encapsulated in the jar file, the jar file can not contain codes for realizing other functions, the code amount is less, and it is light and simple.
[0014] The above description is only a summary of the technical solutions of the present application, in order to more clearly understand the technical means of the present application, which can be implemented according to the content of the specification, and in order to make the above and other purposes, characteristics and advantages of the present application more obvious and easy to understand, the following will describe the specific embodiments of the present application. BRIEF DESCRIPTION OF DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application. Obviously, the drawings in the following description only some embodiments of the present application, and for those skilled in the art, without creative labor, other drawings can also be obtained from these drawings.
[0016] Figure 1 A schematic diagram of an existing cache method in a distributed environment is shown;
[0017] Figure 2A flow diagram of a cache method in a distributed environment is shown according to an embodiment of the present application;
[0018] Figure 3 A flow diagram of another cache method in a distributed environment is shown according to an embodiment of the present application;
[0019] Figure 4 A flow diagram of another cache method in a distributed environment is shown according to an embodiment of the present application;
[0020] Figure 5 A flow diagram of another cache method in a distributed environment is shown according to an embodiment of the present application;
[0021] Figure 6 A data flow diagram of another cache method in a distributed environment is shown according to an embodiment of the present application;
[0022] Figure 7 A terminal input diagram of another cache method in a distributed environment is shown according to an embodiment of the present application;
[0023] Figure 8 A flow diagram of another cache method in a distributed environment is shown according to an embodiment of the present application;
[0024] Figure 9 A flow diagram of another cache method in a distributed environment is shown according to an embodiment of the present application;
[0025] Figure 10 A flow diagram of another cache method in a distributed environment is shown according to an embodiment of the present application;
[0026] Figure 11 A structure block diagram of a cache device in a distributed environment is shown according to an embodiment of the present application;
[0027] Figure 12 A structure block diagram of a computer device is shown according to an embodiment of the present application. DETAILED DESCRIPTION
[0028] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.
[0029] The cache method of the distributed environment provided by the embodiments of the present application can be applied to electronic devices with instruction or program running capability, wherein the electronic devices can be, but are not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and can also be implemented by independent servers or server clusters composed of multiple servers. Running on different computing devices is only a difference in the execution subject of the scheme, and persons skilled in the art can predict that running in different computing devices can produce the same technical effects. The present application will be described in detail below through specific embodiments.
[0030] Referring to Figure 2 as shown, Figure 2 A flowchart of the cache method of the distributed environment provided by the embodiments of the present application is shown, comprising the following steps:
[0031] S10: The proxy server determines the target cluster server according to the configuration parameters and sends the configuration parameters to the target cluster server;
[0032] The method provided by the present application is used to implement cache operation in a distributed environment. It can be understood that the distributed environment is composed of multiple cluster servers, and each cluster server can communicate and cooperate with each other.
[0033] The method is based on a jar file, and the instruction set for implementing the method is integrated into the jar file. Due to the characteristics of the jar file, the method does not need to separately install and deploy a cache plug-in.
[0034] Specifically, the proxy server determines the target cluster server in the multiple cluster servers in the distributed environment according to the configuration parameters. The configuration parameters are sent to the target cluster server, so that the target cluster server can modify the cache data stored in the java virtual machine memory according to the configuration parameters.
[0035] After the proxy server determines the target cluster server, the configuration parameters can be sent to the target cluster server by using a curl command, and other commands or methods can also be used, which are not limited herein. The target cluster server can be one or multiple. If it is multiple, each target cluster server can modify the cache data in the java virtual machine memory after receiving the configuration parameters, thereby realizing batch modification of the cache data.
[0036] The configuration parameters comprise a network address parameter.
[0037] Specifically, the configuration parameters comprise a network address parameter, and the network address parameter can be one or multiple, each network address parameter corresponding to an address of one target cluster server.
[0038] The network address parameter can be an IP address, for example, 192.168.10.58, or a domain name address, for example, example.domain.com.
[0039] As shown in FIG. 10, in step S10, the target cluster server is determined according to the configuration parameter, and specifically includes the following steps: Figure 3
[0040] S11: The proxy server determines the target cluster server from the at least one cluster server according to the network address parameter, wherein the at least one cluster server belongs to the same cluster.
[0041] For step S11, the distributed environment is composed of multiple cluster servers, and the multiple cluster servers belong to the same cluster. A business system is deployed on the cluster, and the functions of the business system are realized through communication and cooperation among the multiple cluster servers.
[0042] The proxy server determines the target cluster server from the multiple cluster servers in the distributed environment according to the network address parameter, wherein the target cluster server can be one or more, and the target cluster server is the cluster server to be modified.
[0043] The cluster server corresponding to the network address parameter can be determined as the target cluster server. If there is no cluster server corresponding to the network address parameter in the distributed environment, an error message is generated to prompt the operator that the network address parameter can be incorrect.
[0044] The embodiment uses the uniqueness of the network address parameter to find and determine the target cluster server to be modified according to the network address parameter in the configuration parameter, and the method is simple and efficient.
[0045] As shown in FIG. 10, in step S10, the configuration parameter is sent to the target cluster server, and specifically includes the following steps: Figure 4
[0046] S12: Determine the communication protocol corresponding to the development project deployed on the target cluster server, and set the interface corresponding to the communication protocol.
[0047] S13: The proxy server sends the configuration parameter to the target cluster server through the interface.
[0048] For steps S12-S13, different development projects can be deployed on the target cluster server, that is, business systems, and since the protocols for transmitting data by different development projects can be different, the embodiment first sets an interface corresponding to the communication protocol of the development project deployed on the target cluster server, and then uses the interface to achieve data transmission with the development project, that is, uses the interface to send the configuration parameters to the target cluster server.
[0049] For example, if system A is deployed on the target cluster server, and the system can receive data through the MQ protocol, then an interface for receiving data through the MQ protocol can be set in the jar file; if the system can receive data through the dubbo protocol, then an interface for receiving data through the dubbo protocol can be set in the jar file.
[0050] The embodiment sets a corresponding data transmission interface according to the development project deployed on the target cluster server, thereby adapting to specific business requirements and improving flexibility and scalability.
[0051] As shown in FIG. 1, the method further includes the following steps before step S10: Figure 5
[0052] S01: The proxy server receives the configuration parameters sent by the terminal.
[0053] For step S01, the proxy server obtains the configuration parameters through the terminal, and then performs the subsequent steps. The terminal can display an input page, and the operator inputs the configuration parameters through the input page; in addition, the terminal can receive the configuration parameters input by the operator through language input and the like; and can also be integrated with other systems to receive the configuration parameters sent by other systems.
[0054] Although the above method of obtaining the configuration parameters by the terminal is described as an example in the specification, other forms can also be adopted, which are also embodiments of the present application, and are not limited herein.
[0055] In addition, the configuration parameters can include some low-frequency changed configuration attribute values. For example, application information of the development project deployed on the target cluster server, domain name of calling a certain supplier, switching of a certain function variable switch, and the like.
[0056] S20: The target cluster server modifies the cache data in the java virtual machine memory on the target cluster server according to the configuration parameters.
[0057] In this step, the target cluster server updates the cache configuration according to the configuration parameters. Since the cache of the target server is stored in the java virtual machine memory, the cache data in the java virtual machine memory can be modified according to the configuration parameters to achieve the purpose of cache configuration update.
[0058] The embodiment of the present application considers the low frequency of cache data calling, stores the cache data of each cluster server in the memory of the Java virtual machine by using the stability of the memory of the Java virtual machine, so that the consumption of the cache data read-write operation is lower and the storage is more stable, and the manpower resources and use cost are saved without additional machines to build cache space and maintain cache pool. After the proxy server receives the configuration parameters, the cluster server to be modified according to the configuration parameters is determined as the target cluster server, and the configuration parameters are sent to the target cluster server, and then the target cluster server modifies the cache data stored in the memory of the Java virtual machine according to the configuration parameters. The embodiment realizes the method based on the jar file, and does not need to install the plug-in separately, so that the plug-in does not need to be deployed and maintained separately. Further, since the embodiment of the present application encapsulates the method in the jar file, the jar file can not contain the code for realizing other functions, the code amount is less, and the jar file is light and simple.
[0059] Figure 6 The data flow diagram of the cache method of the distributed environment of another embodiment of the present application is shown. As shown in the figure, the terminal receives the configuration information through the intranet computer Web page, and then sends the request containing the configuration information to the proxy server (that is, the admin server). After the admin server receives the request containing the configuration information, the corresponding target cluster server is determined, and the configuration information is sent to the target cluster server. Among them, the jar file (cluster-jcache.jar) is introduced in the target cluster server, and the jar file modifies the cache data in the memory of the Java virtual machine according to the configuration information. Figure 6
[0060] Among them, the configuration parameters include parameter keywords and parameter values corresponding to the parameter keywords.
[0061] Specifically, the configuration parameters are composed of key-value pairs, including the parameter keyword key and the corresponding parameter value value. For example, the parameter keyword is name, and the corresponding parameter value is the cache name; the parameter keyword is eternal, and the corresponding parameter is true or false, which is used to limit whether the elements of the cache are ever expired.
[0062] Although the above configuration parameters are taken as examples in the description, other forms can also be taken, for example, the parameter keyword is diskPersistent, and the corresponding parameter is true or false, which is used to limit whether to persist on the disk, that is, whether the cache data is still valid after restarting the Java virtual machine. This is also an embodiment of the present application, which is not limited here.
[0063] Figure 7 The terminal input diagram of the cache method of the distributed environment of another embodiment of the application is shown. As shown, an operator can fill in the configuration parameters in the form of key-value pairs on a page, wherein the parameter keys are filled into the text boxes corresponding to Key (key 1, key 2, key 3), the corresponding parameter values are input into the text boxes corresponding to Value (value 1, value 2, value 3), and the IP addresses of the target cluster servers are input, wherein the IP addresses can be multiple, and each IP address corresponds to a target cluster server. A comma is used as a separator between multiple IP addresses, and of course other symbols other than a dot can also be used as a separator.
[0064] As shown in the figure, in step S20, the target cluster service modifies the cache data in the java virtual machine memory on the target cluster server according to the configuration parameters, and specifically includes the following steps: Figure 8
[0065] S21: If the first target field corresponding to the parameter key is not found in the cache data, the first target field is established in the cache data, and the parameter value is added to the target field;
[0066] S22: If the first target field is found in the cache data, and the parameter value corresponding to the parameter key is empty, the first target field is deleted in the cache data;
[0067] S23: If the first target field is found in the cache data, and the parameter value corresponding to the parameter key is not empty, the first target field is updated according to the parameter value.
[0068] For steps S21-S23, the target cluster server modifies the cache data in the java virtual machine memory, and according to different configuration parameters, the modification method can be one of adding, updating, and deleting.
[0069] Specifically, a java file is defined in the jar file, which includes three methods for adding, updating, and deleting cache values, respectively. Each method receives only the parameter key and the corresponding parameter value as input parameters.
[0070] If the first target field corresponding to the parameter key is not found in the cache data, it can be considered that the cache data in the current java virtual machine memory does not include the first target field, and therefore, the adding method can be called to add new data in the cache data, i.e., the parameter value received by the input parameter.
[0071] If the first target field corresponding to the parameter key is found in the cache data, it can be considered that the cache data in the current java virtual machine memory includes the first target field, and at this time, the updating operation can be performed on the first target field, or the deleting operation can be performed on it.
[0072] At this time, it can be judged according to the parameter value corresponding to the parameter key whether to execute the update operation or the delete operation. Specifically, if the parameter value is not empty, the update method can be called to update the first target field in the cache data by using the parameter value; if the parameter value is empty, that is, the target cluster server only receives the parameter key without receiving the parameter value corresponding to the parameter key, at this time, the delete method can be called to directly delete the first target field.
[0073] The embodiment designs three different methods of adding, updating and deleting, and different methods are called for different configuration parameters to achieve the corresponding effect.
[0074] As shown in Figure 9 Before step S20, the method further includes the following steps:
[0075] Step S14: Introduce the jar file into the development project.
[0076] For step S14, the method of the present application is based on the jar file. Specifically, the target cluster server deploys the development project, and the jar file can be introduced into the development project, and the jar file is used to execute the step of modifying the cache data in the memory of the java virtual machine on the target cluster server according to the configuration parameter.
[0077] Unlike the plug-in that needs to be separately deployed in the existing method, the jar file of the embodiment is hosted in the engineering code of the development project. As long as the code engineering is stable, the jar file is stable. Therefore, the embodiment ensures the stability of the jar file, without manual operation and maintenance.
[0078] As shown in Figure 10 The method further includes the following steps:
[0079] S30: In response to the query request, parse the query request to obtain the query key;
[0080] S40: Find the second target field corresponding to the query key in the cache data, and return the parameter value corresponding to the second target field.
[0081] For steps S30-S40, the target cluster server can query the second target field in the cache data based on the query request. Specifically, the proxy server can receive the query request and parse the network address parameter contained in the query request, and then send the query request to the target cluster server corresponding to the network address parameter. The target cluster server first parses the query request to obtain the query key, and then finds the second target field corresponding to the query key in the cache data.
[0082] In the jar file, a java file is defined, and the java file includes a method for querying the cached value corresponding to the second target field. The input parameter of each method is a parameter key, and the return value is the parameter value corresponding to the parameter key.
[0083] In addition, the queried parameter value can be sent to the development project, so that the development project runs according to the parameter value.
[0084] It can be seen that, compared with the existing distributed environment cache method, the above scheme is based on a jar file, a java file is established in the jar file, and the functions of adding, updating, deleting, and querying are implemented. After receiving the configuration parameter, the proxy server finds the target cluster server according to the network address parameter, and sends the configuration parameter to the target cluster server. The target cluster server uses the jar file to add, update, delete, or query the cached data according to the configuration parameter. Thus, when the development project takes the configuration, the cached value in the cached data can be directly read. When modification is needed for the cache, the terminal can be used to perform the modification operation. The scheme uses the jar file to implement the above operation, without the need to deploy and maintain a separate cache plug-in, saving manpower and resources, and ensuring the stability of the cache operation. In addition, the scheme uses the java virtual machine memory to store the cached data, without the need for an additional machine to set up a cache pool, reducing the equipment cost.
[0085] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0086] In an embodiment, a distributed environment cache device is provided, which corresponds to the distributed environment cache method in the above embodiments. As shown in the figure, the distributed environment cache device includes a proxy module and a modification module. The functions of each module are described in detail as follows: Figure 11 The proxy module is configured to determine a target cluster server according to a configuration parameter, and send the configuration parameter to the target cluster server.
[0087] The modification module is configured to modify the cached data in the java virtual machine memory on the target cluster server according to the configuration parameter.
[0088] In an embodiment, the configuration parameter includes a parameter key and a parameter value corresponding to the parameter key.
[0089] The modification module is specifically configured to:
[0090]
[0091] If the first target field corresponding to the parameter keyword is not found in the cache data, the first target field is established in the cache data, and the parameter value is added to the target field;
[0092] If the first target field is found in the cache data, and the parameter value corresponding to the parameter keyword is empty, the first target field is deleted in the cache data;
[0093] If the first target field is found in the cache data, and the parameter value corresponding to the parameter keyword is not empty, the first target field is updated according to the parameter value.
[0094] In one embodiment, the apparatus further comprises a query module, specifically configured to:
[0095] In response to the query request, the query request is parsed to obtain a query keyword;
[0096] A second target field corresponding to the query keyword is found in the cache data, and a parameter value corresponding to the second target field is returned.
[0097] In one embodiment, the configuration parameter further comprises a network address parameter;
[0098] The proxy module is specifically configured to:
[0099] The proxy server determines a target cluster server from at least one cluster server according to the network address parameter, wherein the at least one cluster server belongs to the same cluster.
[0100] In one embodiment, the proxy module is specifically configured to:
[0101] Determine a communication protocol corresponding to a development project deployed on the target cluster server, and set an interface corresponding to the communication protocol;
[0102] The proxy server sends the configuration parameter to the target cluster server through the interface.
[0103] In one embodiment, the apparatus further comprises an initialization module, specifically configured to:
[0104] Introduce the jar file into the development project.
[0105] In one embodiment, the apparatus further comprises a receiving module, specifically configured to:
[0106] The proxy server receives the configuration parameter sent by the terminal.
[0107] In one embodiment, a computer device is provided, and an internal structure diagram of the computer device can be as follows Figure 12The computer device includes a processor, a memory and a database connected by a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium. The computer program is executed by the processor to implement the functions or steps of the cache method in the distributed environment.
[0108] In addition, the computer device can further include a network interface, a display screen and an input device.
[0109] In one embodiment, a computer device is provided, including a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program:
[0110] The proxy server determines the target cluster server according to the configuration parameters and sends the configuration parameters to the target cluster server;
[0111] The target cluster server modifies the cache data in the java virtual machine memory on the target cluster server according to the configuration parameters.
[0112] In one embodiment, a storage medium is provided, which stores a computer program executable by a processor to implement the following steps:
[0113] The proxy server determines the target cluster server according to the configuration parameters and sends the configuration parameters to the target cluster server;
[0114] The target cluster server modifies the cache data in the java virtual machine memory on the target cluster server according to the configuration parameters.
[0115] It should be noted that the functions or steps that the storage medium or the computer device can implement are described above with reference to the related description of the method embodiments, and to avoid repetition, they will not be described here.
[0116] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing relevant hardware, and the computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, the processes of the above-mentioned embodiments of each method can be included. Any reference to memory, storage, database or other medium used in each embodiment provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0117] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of functional units and modules is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.
[0118] Those skilled in the art can understand that the units or processes in the drawings are not necessarily required for the implementation of the present application. Those skilled in the art can understand that the units in the system in the implementation scenario can be distributed in the system in the implementation scenario according to the description of the implementation scenario, or can be changed to be located in one or more systems different from the implementation scenario. The units of the above-mentioned implementation scenario can be combined into one unit, or can be further split into multiple sub-units.
[0119] The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A caching method for a distributed environment, characterized in that, The method is based on a JAR file, and the method includes: The proxy server determines the target cluster server based on configuration parameters and sends the configuration parameters to the target cluster server; the configuration parameters include configuration attribute values that change infrequently, which are used to determine the target cluster server; the configuration parameters also include parameter keywords and parameter values corresponding to the parameter keywords; The target cluster server modifies the cached data in the Java Virtual Machine memory of the target cluster server according to the parameter keywords in the configuration parameters and the parameter values corresponding to the parameter keywords.
2. The method according to claim 1, characterized in that, The target cluster service modifies cached data in the Java Virtual Machine memory of the target cluster server according to the configuration parameters, specifically including: If no first target field corresponding to the parameter keyword is found in the cached data, then the first target field is created in the cached data, and the parameter value is added to the target field; If the first target field is found in the cached data and the parameter value corresponding to the parameter keyword is empty, then the first target field is deleted from the cached data. If the first target field is found in the cached data and the parameter value corresponding to the parameter keyword is not empty, then the first target field is updated according to the parameter value.
3. The method according to claim 1, characterized in that, The method further includes: In response to a query request, the query request is parsed to obtain the query keywords; The system searches for the second target field corresponding to the query keyword in the cached data and returns the parameter value corresponding to the second target field.
4. The method according to claim 1, characterized in that, The configuration parameters include network address parameters; The step of determining the target cluster server based on the configuration parameters specifically includes: The proxy server determines the target cluster server from at least one cluster server based on the network address parameters, wherein the at least one cluster server belongs to the same cluster.
5. The method according to claim 4, characterized in that, Sending the configuration parameters to the target cluster server specifically includes: Determine the communication protocol corresponding to the development project deployed on the target cluster server, and set the interface corresponding to the communication protocol; The proxy server sends the configuration parameters to the target cluster server through the interface.
6. The method according to claim 5, characterized in that, Before modifying the cached data in the Java Virtual Machine memory on the target cluster server according to the configuration parameters, the method further includes: Import the jar file into the development project.
7. The method according to claim 1, characterized in that, Before the proxy server determines the target cluster server based on configuration parameters, the method further includes: The proxy server receives the configuration parameters sent by the terminal.
8. A caching device for a distributed environment, characterized in that, The device is based on a JAR file, and the device includes: The proxy module is used to determine the target cluster server based on configuration parameters and send the configuration parameters to the target cluster server; the configuration parameters include configuration attribute values that change infrequently, and the configuration attribute values are used to determine the target cluster server; the configuration parameters also include parameter keywords and parameter values corresponding to the parameter keywords; The modification module is used to modify cached data in the Java Virtual Machine memory of the target cluster server according to the parameter keywords in the configuration parameters and the parameter values corresponding to the parameter keywords.
9. A storage medium having a program or instructions stored thereon, characterized in that, When the program or instructions are executed by the processor, they implement the steps of the method as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, The invention includes a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that the processor, when executing the program, implements the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Distributed cache high-availability processing method and system based on multithreading asynchronous double writing
CN103500120A
Data processing optimization device and method based on distributed system
CN108182213A