Plug-in registration method and apparatus, electronic device, and storage medium

CN115718630BActive Publication Date: 2026-09-25ZHEJIANG DAHUA TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211383051.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-07
Publication Date
2026-09-25
Estimated Expiration
2042-11-07

AI Technical Summary

Technical Problem

[0005]在本实施例中提供了一种插件注册方法、装置、系统、电子装置和存储介质,以解决相关技术中在对开发组件进行整体升级时会导致应用服务停机的问题

Benefits of technology

[0035]与相关技术相比,本申请提供了一种插件注册方法、装置、电子装置和存储介质,所述方法包括:获取目标函数逻辑,所述目标函数逻辑基于预设接口函数格式创建;基于所述目标函数逻辑生成目标函数插件;将所述目标函数插件进行注册。通过特定业务逻辑对应的接口函数格式,建立目标函数逻辑,将该目标函数逻辑对应的代码进行封装以生成目标函数插件,最后对目标函数插件分配标识符以完成插件注册,实现了接口函数与业务逻辑函数的单独封装。在程序运行过程中可直接基于标识符调用对应的目标函数插件,进而基于目标函数插件中的代码调用对应的业务逻辑函数,并且在对目标函数插件进行更新时,只需将新的函数代码加载到插件中即可,无需中断业务逻辑代码的程序进程,避免了将接口函数与业务逻辑函数一起封装时只能整体更新导致的程序进程中断,解决了相关技术中在对开发组件进行整体升级时会导致应用服务停机的技术问题,通过热更新插件的方式实现了用户自定义接口函数的动态更新迭代,无需对应用服务进行停机重启,进而提高了接口函数的更新效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115718630B_ABST
    Figure CN115718630B_ABST
Patent Text Reader

Abstract

The application relates to a plug-in registration method and device, an electronic device and a storage medium, wherein the plug-in registration method comprises the following steps: obtaining target function logic, the target function logic is created based on a preset interface function format; generating a target function plug-in based on the target function logic; and registering the target function plug-in. Through the application, the technical problem that the application service is stopped when the development component is upgraded in the related art is solved, the dynamic update iteration of the user-defined interface function is realized in the manner of hot updating the plug-in, the application service does not need to be restarted, and therefore the update efficiency of the interface function is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software development, and in particular to a plug-in registration method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the continuous development of information technology, industrial digitalization has become an important task for enterprises. To reduce the difficulty of software application development, multiple development components are typically dragged and dropped onto a low-code platform to complete the application. Users do not need to understand the internal code logic of the development components; they only need to understand the corresponding functions.

[0003] In low-code application development, it's often necessary to define custom interface methods to implement specific business logic calls. Current technologies typically compile and package the interface methods and the specific business logic code into an immutable development component, which is then used for development and deployment. When new or modified code is needed, the entire development component must be upgraded, which can cause application service downtime and negatively impact user experience.

[0004] There is currently no effective solution to the technical problem that application services may be down when the development components are upgraded as a whole. Summary of the Invention

[0005] This embodiment provides a plug-in registration method, apparatus, system, electronic device, and storage medium to solve the problem in related technologies where application services may be down when the overall development components are upgraded.

[0006] Firstly, this embodiment provides a plugin registration method, the method comprising:

[0007] Obtain the target function logic, which is created based on a preset interface function format;

[0008] Generate the target function plugin based on the aforementioned target function logic;

[0009] Register the target function plugin.

[0010] In some embodiments, registering the target function plugin includes:

[0011] In response to the call instruction for the target function plugin, a target function example is loaded based on the target function plugin, and the target function example is stored in the cache;

[0012] Return the example of the target function to the caller.

[0013] In some embodiments, the step of loading the target function example based on the function plugin includes:

[0014] In response to a function update instruction, remove the target function example from the cache;

[0015] The update function logic is obtained based on the function update instruction;

[0016] An update function plugin is generated based on the aforementioned update function logic;

[0017] Register the update function plugin.

[0018] In some embodiments, storing the example of the objective function in the cache includes:

[0019] If the target function example in the cache is not called within a preset time, then the target function example in the cache is deleted.

[0020] In some embodiments, storing the example of the objective function in the cache includes:

[0021] If the cache reaches the storage threshold, then delete the loaded function plugin with the fewest historical calls from the cache.

[0022] In some embodiments, the response to the instruction to call the target function plugin further includes:

[0023] Obtain the plugin identifier based on the aforementioned call instruction;

[0024] Match the plugin identifier with the loaded function plugins in the cache;

[0025] If a match is found, the corresponding loaded function plugin will be returned to the caller.

[0026] In some embodiments, returning the target function example to the caller includes:

[0027] Execute the example target function to obtain the target data;

[0028] The target data is then returned to the caller.

[0029] Secondly, this embodiment provides a plug-in registration device, including:

[0030] The acquisition module is used to acquire the target function logic, which is created based on a preset interface function format;

[0031] The generation module is used to generate a target function plugin based on the target function logic;

[0032] The registration module is used to register the target function plugin.

[0033] Thirdly, this embodiment provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the plug-in registration method described in the first aspect above.

[0034] Fourthly, this embodiment provides a storage medium storing a computer program that, when executed by a processor, implements the plug-in registration method described in the first aspect above.

[0035] Compared with related technologies, this application provides a plugin registration method, apparatus, electronic device, and storage medium. The method includes: obtaining target function logic, which is created based on a preset interface function format; generating a target function plugin based on the target function logic; and registering the target function plugin. By establishing the target function logic through the interface function format corresponding to a specific business logic, encapsulating the code corresponding to the target function logic to generate a target function plugin, and finally assigning an identifier to the target function plugin to complete plugin registration, the separate encapsulation of interface functions and business logic functions is achieved. During program execution, the corresponding target function plugin can be directly called based on the identifier, and then the corresponding business logic function can be called based on the code in the target function plugin. Furthermore, when updating the target function plugin, only the new function code needs to be loaded into the plugin, without interrupting the program process of the business logic code. This avoids the program process interruption caused by only being able to update the entire package when encapsulating interface functions and business logic functions together. It solves the technical problem in related technologies where overall upgrades of development components cause application service downtime. By using hot-updating plugins, dynamic updates and iterations of user-defined interface functions are achieved without requiring application service shutdown and restart, thereby improving the update efficiency of interface functions.

[0036] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description

[0037] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0038] Figure 1 This is a hardware structure block diagram of a terminal for a plug-in registration method according to an embodiment of this application;

[0039] Figure 2This is a schematic flowchart of a plug-in registration method according to an embodiment of this application;

[0040] Figure 3 This is a structural block diagram of an embodiment of the operating system of this application;

[0041] Figure 4 This is a flowchart illustrating a method for calling a target function plugin according to an embodiment of this application;

[0042] Figure 5 This is a flowchart illustrating an embodiment of the target function plugin uninstallation method of this application;

[0043] Figure 6 This is a flowchart illustrating a method for calling a target function plugin according to an embodiment of this application;

[0044] Figure 7 This is a structural block diagram of a plug-in registration device according to an embodiment of this application. Detailed Implementation

[0045] To better understand the purpose, technical solution, and advantages of this application, the application is described and illustrated below in conjunction with the accompanying drawings and embodiments.

[0046] Unless otherwise defined, the technical or scientific terms used in this application shall have the general meaning as understood by one of ordinary skill in the art to which this application pertains. Words such as “a,” “an,” “an,” “the,” “the,” and “these,” used in this application, do not indicate quantitative limitation and may be singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or modules (units) is not limited to the listed steps or modules (units) but may include steps or modules (units) not listed, or may include other steps or modules (units) inherent to such processes, methods, products, or devices. The terms “connected,” “linked,” and “coupled,” used in this application, are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. The term “multiple” used in this application refers to two or more. The "and / or" operator describes the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: A alone, A and B simultaneously, and B alone. Typically, the character " / " indicates that the objects before and after it are in an "or" relationship. The terms "first," "second," and "third," etc., used in this application are merely for distinguishing similar objects and do not represent a specific ordering of the objects.

[0047] The method embodiments provided in this example can be executed on a terminal, computer, or similar computing device. For example, it can run on a terminal. Figure 1 This is a hardware structure block diagram of the terminal for the plug-in registration method in this embodiment. For example... Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 and a memory 104 for storing data are also included. The processor 102 may be, but is not limited to, a microprocessor (MCU) or a programmable logic device (FPGA). The terminal may also include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that… Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the terminal described above. For example, the terminal may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown are illustrated.

[0048] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the plug-in registration method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0049] The transmission device 106 is used to receive or send data via a network. This network includes a wireless network provided by the terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 can be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0050] Please see Figure 2 , Figure 2 This is a schematic flowchart of a plug-in registration method according to an embodiment of this application.

[0051] In one embodiment, the plugin registration method includes:

[0052] S202: Obtain the target function logic, which is created based on a preset interface function format.

[0053] For example, the target function logic is established according to the format of the interface function corresponding to the business logic. In this embodiment, the interface function is used to call various business logic functions; it can be understood that the target function in this embodiment is the interface function. For instance, in a class, the interface function can be a public function of that class, and the business logic function can be a private function of that class. The public function is used to call the private function.

[0054] S204: Plugin for generating objective functions based on objective function logic.

[0055] For example, after determining the target function logic, the code of the target function is built based on the target function logic, and the code of the target function is encapsulated to obtain the target function plugin.

[0056] Specifically, the interface function content and basic description information customized by the user based on the target function logic are obtained, and the target function plugin is obtained by encapsulating the above data.

[0057] S206: Register the objective function plugin.

[0058] For example, after creating the target function plugin, each target function plugin is registered to identify its identity, and then the appropriate target function plugin is selected based on different needs. Specifically, a globally unique identifier is assigned to each target function plugin to distinguish between different plugins.

[0059] Please see Figure 3 , Figure 3 This is a structural block diagram of the operating system according to an embodiment of this application.

[0060] Specifically, such as Figure 3 As shown, the runtime system has a plugin registration and management module, which receives requests from the plugin management client, abstracts and encapsulates user-defined interface functions into interface function plugins, and registers them in the runtime system. At the same time, the plugin registration and management module can also support functions such as updating and uninstalling interface function plugins. All of the above processes are processed online in the runtime system without the need for shutdown and restart, which can realize hot updates of interface function plugins.

[0061] More specifically, the plugin registration management module has a registration submodule. The registration submodule provides dynamic registration functionality for custom interface functions to the outside world (plugin management client) in the form of a RESTful API. The registration submodule receives user-defined interface function content and its basic description information in a predefined format as parameters through the RESTful API, generates interface function plugins based on the parameter content, and registers the interface function plugins to the running system.

[0062] More specifically, user-defined interface functions need to meet the following requirements: The interface function content should be defined in the format `module.exports = asyncfunction(params, context, callback) { callback();}`, where `params` is the formal parameter object of the interface function, `callback` is the parameter passed to the callback interface function as the return body of the interface function, and the execution logic of the interface function can be implemented by the user; the basic description information of the interface function must include a globally unique identifier `fid` (function id) to identify the uniqueness of the interface function in the runtime system, while the name, description, and other information of the interface function are not restricted.

[0063] This embodiment obtains the target function logic, which is created based on a preset interface function format; generates a target function plugin based on the target function logic; and registers the target function plugin. By establishing the target function logic through the interface function format corresponding to a specific business logic, the code corresponding to the target function logic is encapsulated to generate a target function plugin. Finally, an identifier is assigned to the target function plugin to complete plugin registration, achieving separate encapsulation of interface functions and business logic functions. During program execution, the corresponding target function plugin can be directly called based on the identifier, and then the corresponding business logic function can be called based on the code in the target function plugin. Furthermore, when updating the target function plugin, only the new function code needs to be loaded into the plugin, without interrupting the program process of the business logic code. This avoids the program process interruption caused by only being able to update the entire package when encapsulating interface functions and business logic functions together. It solves the technical problem in related technologies where overall upgrades of development components cause application service downtime. By using hot-update plugins, dynamic updates and iterations of user-defined interface functions are achieved without requiring application service shutdown and restart, thereby improving the update efficiency of interface functions.

[0064] In another embodiment, registering the target function plugin includes:

[0065] Step 1: In response to the call instruction for the target function plugin, load the target function example based on the target function plugin and store the target function example in the cache;

[0066] Step 2: Return the target function example to the caller.

[0067] For example, after the target function plugin is registered, a call instruction from the running system is received, and the target function plugin is invoked based on the call instruction. The call instruction includes registration information such as the identifier of the target function plugin, used to identify the corresponding target function plugin.

[0068] For example, after the target function plugin is invoked, a target function example is generated based on the plugin. This target function example contains all the code corresponding to the target function to be executed by the running system, as well as all the code corresponding to the business logic function called by the target function. After generating the target function example, it is loaded into the runtime cache of the running system.

[0069] For example, after the target function example is loaded into the runtime cache, when the target function example needs to be called, the target function example is retrieved from the runtime cache and returned to the caller to execute the target function example.

[0070] Specifically, the method in this embodiment is applied to the first loading of the target function plugin after registration. That is, the registered target function plugin does not take effect immediately, but the target function example is generated and loaded into the runtime cache only after it is called by the application for the first time, thereby saving device memory and other resources.

[0071] Please see Figure 4 , Figure 4 This is a flowchart illustrating a method for calling a target function plugin according to an embodiment of this application.

[0072] Specifically, based on Figure 3 The loaded submodule shown executes as follows: Figure 4 The method for calling the target function plugin is shown below. First, the target function plugin is generated, registered, and its registration information is stored. The registered plugin does not take effect immediately but waits for subsequent calls to load it in real time, thus effectively utilizing memory resources. Second, when the target function plugin is called by the application for the first time, a target function instance is generated and stored in the runtime system's cache. Third, the instantiated target function plugin waits for subsequent calls from the application. If it has not been called for a long time, it is then... Figure 3 The load monitoring and management module shown is unloaded and destroyed to free up memory space; finally, when the target function plugin is called, the target function example is loaded into the execution code context, the received argument list is parsed to execute the above code, and the execution result is returned.

[0073] In this embodiment, after registering the target function plugin, the target function example is loaded only upon receiving the plugin's call instruction. The target function example is then stored in a cache, allowing subsequent loading directly from the cache without regeneration. Since the target function plugin is already registered with the runtime system, the loading process is negligible, and the loading action is only performed on the first call; subsequent calls retrieve the target function example directly from the cache. This achieves online loading of the target function plugin while maintaining efficient memory resource utilization.

[0074] In another embodiment, following the example of loading the target function based on the function plugin:

[0075] Step 1: In response to the function update instruction, remove the target function example from the cache;

[0076] Step 2: Obtain the update function logic based on the function update instruction;

[0077] Step 3: Generate update function plugins based on update function logic;

[0078] Step 4: Register the update function plugin.

[0079] For example, this embodiment is used to update the target function plugin after loading the target function plugin and storing the corresponding target function example in the cache. First, the running system receives a function update instruction input by the user. This instruction contains the registration information of the target function plugin that needs to be updated, so that the running system can identify the corresponding target function plugin and then delete the target function example corresponding to the target function plugin from the cache.

[0080] For example, after deleting the cached target function example, based on the new business logic function, the update function logic is re-established according to the corresponding interface function format. Update function code is generated based on the update function logic and encapsulated to obtain the update function plugin. Finally, the update function plugin is registered. The method of generating and registering the update function plugin based on the update function logic has been described in detail in the above embodiments and will not be repeated in this embodiment.

[0081] Specifically, the method in this embodiment can be based on Figure 3 The uninstallation submodule shown is implemented so that when it is necessary to update or delete the target function plugin, it first uninstalls the target function plugin that has been loaded by the running system, thereby deleting the corresponding target function example in the cache. Then, it receives the user-defined function content and re-registers the new target function plugin through the above method of generating and registering the target function plugin.

[0082] In this embodiment, when the target function plugin needs to be updated, the target function instance of the already loaded target function plugin is first deleted, and then a new update function plugin is generated and registered. This releases the cache occupied by the deleted target function instance in a timely manner, thereby improving the resource utilization of the running system.

[0083] In another embodiment, storing the example of the objective function in the cache includes:

[0084] If the target function instance in the cache is not invoked within a preset time, the target function instance in the cache will be deleted.

[0085] For example, once the target function plugin finishes loading and the corresponding target function example is stored in the runtime cache, it is determined whether the target function example will be invoked based on a preset time period. If the target function example is not invoked within the preset time period, it is deleted from the cache.

[0086] Specifically, based on Figure 3 The load monitoring management module shown monitors whether the target function plugin has not been called for a long time. If it has not been called within a certain time threshold, it indicates that the importance of the target function plugin has decreased. At this time, the uninstallation submodule is notified to uninstall the target function plugin and delete the corresponding target function example from the cache.

[0087] In this embodiment, if the target function instance in the cache is not called within a preset time, the target function instance in the cache is deleted, thereby releasing the occupied resources in a timely manner and improving the resource utilization of the running system.

[0088] In another embodiment, storing the example of the objective function in the cache includes:

[0089] If the cache reaches the storage threshold, delete the loaded function plugin with the fewest historical calls from the cache.

[0090] For example, since the runtime system continuously loads target function plugins and stores target function examples in the runtime cache during operation, a storage threshold needs to be set to prevent the cache from becoming overloaded. When the storage amount in the cache reaches the storage threshold, some of the loaded target function plugins are unloaded according to the priority of the number of calls.

[0091] Specifically, the loaded function plugins with the fewest calls are deleted first. After one or more deletion operations, it is determined whether the storage amount in the cache is lower than the storage threshold. If it is lower than the storage threshold, the deletion operation is stopped. Otherwise, the loaded function plugins are deleted based on the priority of the number of calls.

[0092] Please see Figure 5 , Figure 5 This is a flowchart illustrating an embodiment of the target function plugin uninstallation method of this application.

[0093] Specifically, such as Figure 5 As shown, firstly, the application calls the target function plugin to execute the corresponding target function example; secondly, it utilizes... Figure 3 The LRU (Least Recently Used) cache shown records the unique identifier of the target function plugin (as the cache key). When a target function plugin is called, the load listener listens for the call and the route matcher matches the unique identifier. Specifically, the unique identifier of the called target function plugin is retrieved from the LRU cache. If a match is found, the LRU module continues to cache the unique identifier; otherwise, the corresponding unique identifier is added to the LRU cache. When the cache capacity reaches its maximum value, the least recently used target function plugin is determined based on the identifiers cached in the LRU cache and unloaded. The maximum cache capacity can be adjusted according to the actual usage configuration. Finally, the call to the target function plugin is completed, i.e., the received argument list is parsed and the target function plugin is executed to return the execution result.

[0094] Specifically, even after the target function plugin is uninstalled, its registration information remains valid. When the target function plugin needs to be called again, the steps of loading the target function plugin and storing the target function example in the cache in the above embodiment will be triggered again. This improves resource utilization while avoiding a decrease in program execution efficiency caused by uninstalling the target function plugin.

[0095] In this embodiment, if the cache reaches the storage threshold, the loaded function plugin with the fewest historical calls in the cache is deleted, thereby reducing the occupancy rate of low-importance target function examples on the runtime cache and thus improving the utilization rate of system resources.

[0096] In another embodiment, the response to the instruction to call the target function plugin further includes:

[0097] Step 1: Obtain the plugin identifier based on the invocation command;

[0098] Step 2: Match the plugin identifier with the loaded function plugins in the cache;

[0099] Step 3: If a match is found, the corresponding loaded function plugin is returned to the caller.

[0100] For example, when an application calls a target function plugin, its call instruction also contains unique identifier information of the target function plugin to be called. Based on the application's call instruction, the plugin identifier contained therein is obtained, and the plugin identifier is further matched with the loaded function plugins in the cache. If the match is successful, the corresponding loaded function plugin is returned to the caller; otherwise, if the match fails, the method of loading and caching the target function example in the above embodiment is executed.

[0101] Please see Figure 6 , Figure 6 This is a flowchart illustrating a method for calling a target function plugin according to an embodiment of this application.

[0102] Specifically, the method in this embodiment can be achieved through... Figure 3 The function request proxy module shown is implemented as described. This module primarily handles the proxying of system interface functions called by the application during execution; that is, the application calls interface functions in the target function plugin through the unified interface provided by the function request proxy module. For example... Figure 6 As shown, when the application calls the target function plugin through the unified interface, it first verifies the validity of the parameters passed by the interface. After the verification is successful, it first parses the unique identifier of the target function plugin in the parameters and routes and matches the already loaded target function plugins according to the identifier. If the match fails, it indicates that the target function plugin is being called for the first time or that no loaded target function plugin can be found. In this case, the step of loading the target function plugin and generating the target function example in the above embodiment is executed. If the match is successful, the target function plugin is called according to the actual parameter list, and the result is returned to the unified interface. After passing through the unified interface, it is returned to the application. If an error or exception occurs during the call, it is handled uniformly by the function request proxy module, and the prompt information is returned to the application in a unified form.

[0103] This embodiment obtains the plugin identifier based on the call instruction, matches the plugin identifier with the loaded function plugins in the cache, and if the match is successful, returns the corresponding loaded function plugin to the caller. In this way, function plugins can be called uniformly through the plugin identifier, which improves the convenience and integration of function plugin calls, and thus improves the execution efficiency of the application.

[0104] In another embodiment, returning the target function example to the caller includes:

[0105] Step 1: Execute the example target function to obtain the target data;

[0106] Step 2: Return the target data to the caller.

[0107] For example, after storing the target function example in the cache, when the application needs to call the target function plugin, the corresponding target function example is executed to obtain the target data, and the target data is returned to the caller, i.e., the application.

[0108] Specifically, the method in this embodiment can be based on Figure 3 The function runtime module implementation shown parses and receives the application's argument list and executes the corresponding target function. More specifically, the implementation of the runtime module is related to the execution environment required by the specific programming language, which includes, but is not limited to, the Node.js environment.

[0109] This embodiment executes the target function example, obtains the target data, and returns the target data to the caller, thereby improving the efficiency of the application in executing the target function to obtain the execution effect, and thus improving the running speed of the application.

[0110] It should be noted that the steps shown in the above process or in the flowchart of the accompanying figures can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0111] This embodiment also provides a plug-in registration device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. The terms "module," "unit," "subunit," etc., used below refer to combinations of software and / or hardware that perform a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0112] Figure 7 This is a structural block diagram of the plug-in registration device in this embodiment, as shown below. Figure 7 As shown, the device includes:

[0113] Module 10 is used to acquire the target function logic, which is created based on a preset interface function format.

[0114] Generation module 20 is used to generate a plugin for generating an objective function based on the objective function logic;

[0115] Registration module 30 is used to register the target function plugin;

[0116] The plug-in registration device also includes a loading module;

[0117] The loading module is used to respond to the call instruction to the target function plugin, load the target function example based on the target function plugin, and store the target function example in the cache;

[0118] Return the target function example to the caller;

[0119] The plug-in registration device also includes an update module;

[0120] The update module is used to remove the target function instance from the cache in response to a function update instruction;

[0121] Obtain the update function logic based on the function update instruction;

[0122] Generate update function plugins based on update function logic;

[0123] Register the update function plugin;

[0124] The plug-in registration device also includes a first deletion module;

[0125] The first deletion module is used to delete the target function instance in the cache if it has not been called within a preset time.

[0126] The plug-in registration device also includes a second deletion module;

[0127] The second deletion module is used to delete the loaded function plugin with the fewest historical calls from the cache if the cache reaches the storage threshold.

[0128] The plugin registration module also includes a matching module;

[0129] The matching module is used to obtain the plugin identifier based on the calling command;

[0130] Match the plugin identifier with the loaded function plugins in the cache;

[0131] If a match is found, the corresponding loaded function plugin will be returned to the caller.

[0132] The plugin registration module also includes an execution module;

[0133] The execution module is used to execute the target function example and obtain the target data;

[0134] Return the target data to the caller.

[0135] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can reside in the same processor; or the above modules can be located in different processors in any combination.

[0136] This embodiment also provides an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

[0137] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0138] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0139] S1: Obtain the target function logic, which is created based on a preset interface function format;

[0140] S2: Plugin for generating target functions based on target function logic;

[0141] S3: Register the target function plugin.

[0142] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated in this embodiment.

[0143] Furthermore, in conjunction with the plug-in registration method provided in the above embodiments, this embodiment can also provide a storage medium for implementation. This storage medium stores a computer program; when executed by a processor, the computer program implements any of the plug-in registration methods described in the above embodiments.

[0144] It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. All other embodiments derived by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.

[0145] Obviously, the accompanying drawings are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar situations based on these drawings without any creative effort. Furthermore, it is understood that although the work done in this development process may be complex and lengthy, for those skilled in the art, certain design, manufacturing, or production modifications made based on the technical content disclosed in this application are merely conventional technical means and should not be considered as insufficient disclosure of this application.

[0146] The term "embodiment" in this application refers to a specific feature, structure, or characteristic described in connection with an embodiment that may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily imply the same embodiment, nor does it imply that it is mutually exclusive with or independent of other embodiments. It will be clearly or implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0147] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of patent protection. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the appended claims.

Claims

1. A plugin registration method, characterized in that, The method includes: Obtain the target function logic, which is created based on a preset interface function format; The code for the objective function is built based on the objective function logic, and the code for the objective function is encapsulated separately to obtain the objective function plugin; Register the target function plugin; If the target function plugin is not loaded in the cache, in response to the call instruction for the target function plugin, a target function example is loaded based on the target function plugin, the target function example is stored in the cache, and the target function example is returned to the caller; If the target function instance in the cache is not called within a preset time, the target function instance in the cache is deleted to free up memory space; The example of loading the target function based on the function plugin includes: In response to a function update instruction, remove the target function example from the cache; The update function logic is obtained based on the function update instruction; An update function plugin is generated based on the aforementioned update function logic; Register the update function plugin.

2. The method according to claim 1, characterized in that, The step of storing the example of the objective function in the cache includes: If the cache reaches the storage threshold, then delete the loaded function plugin with the fewest historical calls from the cache.

3. The method according to claim 1, characterized in that, The response to the instruction to call the target function plugin also includes: Obtain the plugin identifier based on the aforementioned call instruction; Match the plugin identifier with the loaded function plugins in the cache; If a match is found, the corresponding loaded function plugin will be returned to the caller.

4. The method according to claim 1, characterized in that, Returning the target function example to the caller includes: Execute the example target function to obtain the target data; The target data is then returned to the caller.

5. A plug-in registration device, characterized in that, include: The acquisition module is used to acquire the target function logic, which is created based on a preset interface function format; The generation module is used to build the code of the target function based on the target function logic, and to encapsulate the code of the target function separately to obtain the target function plugin; The registration module is used to register the target function plugin; A loading module is configured to, in response to a call instruction for the target function plugin, load a target function example based on the target function plugin if the target function plugin is not loaded in the cache, store the target function example in the cache, and return the target function example to the caller; The first deletion module is used to delete the target function instance in the cache if it is not called within a preset time, so as to free up memory space. The update module is used to delete the target function example from the cache in response to a function update instruction; The update function logic is obtained based on the function update instruction; An update function plugin is generated based on the update function logic; the update function plugin is then registered.

6. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the plug-in registration method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the plug-in registration method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Method for expanding software application and device

    CN101847100A

  • Dynamic management system and method for C++ application program version

    CN102073520A

  • Browser plug-in generating, issuing, loading and updating method and system

    CN103064663A

  • Hybrid application construction method and device and computing equipment

    CN113535275A