Method, device and equipment for calling configuration data and readable storage medium
By monitoring the configuration data changes and preprocessing, the problem of configuration data query complexity and time in intelligent online car-hailing orders is solved, and fast and accurate configuration data calls are achieved.
Patent Information
- Application Number
- CN202411190173.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-20
AI Technical Summary
In the process of intelligent order dispatch of online car-hailing, the existing technology needs to pull configuration data in all dimensions when calling configuration data, resulting in increased query complexity and time, making it difficult to quickly obtain configuration data.
By monitoring the changes in configuration data, all configuration data and change data are updated to the preset three-layer data structure memory and hard disk, and the latest configuration data is preprocessed, including splitting, merging and optimizing, calling memory or Configuration data to be called in the hard disk for quick acquisition.
It realizes the ability to flexibly obtain configuration data in different scenarios, reduces query complexity and time, and ensures real-time updates and accurate calls of configuration data.
Smart Images

Figure CN119168280A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular, to a method, apparatus, device and readable storage medium for calling configuration data. Background Art
[0002] At present, in the process of intelligent dispatching of online ride-hailing vehicles, when calling configuration data, the existing technology usually puts the dispatch configuration data of all dimensions on the configuration center. After pulling the configuration data of all dimensions during the actual call, the configuration data of different dimensions are assembled in real time in the code according to the current dispatch path.
[0003] In this way, there will be a lot of logic for assembling data when querying configuration data, which greatly increases the query complexity and query time.
[0004] Therefore, how to quickly call configuration data is a technical problem that needs to be solved. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a method for calling configuration data. The technical solution of the embodiments of the present application can achieve the effect of quickly calling configuration data.
[0006] In a first aspect, an embodiment of the present application provides a method for calling configuration data, including retrieving all configuration data of a policy configuration center, and monitoring through a listener whether there are any changes in the data in all the configuration data; when the listener monitors that there are any changes in the data in all the configuration data, all the configuration data and the changed data are updated to a preset three-layer data structure in the memory and on the hard disk to obtain the latest configuration data; preprocessing the latest configuration data to obtain processed configuration data to be called, wherein the preprocessing includes: at least one of splitting, merging, overwriting and optimizing; calling the configuration data to be called in the memory or on the hard disk.
[0007] In the above embodiments of the present application, the update of the configuration data in the memory and the hard disk is ensured by monitoring the changes in the configuration data. By coordinating the storage of the three-layer data structure in the memory and preprocessing the configuration data, the configuration data in different scenarios can be flexibly obtained, while achieving the effect of quickly calling the configuration data.
[0008] In some embodiments, calling the configuration data to be called in the memory or hard disk includes: when the configuration data to be called in the memory fails to be obtained, obtaining the configuration data to be called in the hard disk; or when the restart service fails to obtain the configuration data to be called by calling the interface, storing the data obtained from the hard disk in the memory.
[0009] In the above embodiments of the present application, when the configuration data fails to be retrieved, the configuration data can be re-acquired from the memory, or when the hard disk fails to retrieve the configuration data when the service is restarted, the data retrieved from the hard disk can be stored in the memory, so that the configuration data can be accurately obtained when it is called subsequently.
[0010] In some embodiments, before calling all the configuration data of the policy configuration center and listening to whether there are any changes in the data in all the configuration data through a listener, it also includes: configuring a three-layer data structure of the memory, wherein the three-layer data structure includes a first-layer data structure, a second-layer data structure, and a third-layer data structure. When the first-layer data structure stores an order path string, the order path maps the time information stored in the second-layer data structure. When the second-layer data structure stores objects of time periods, the time information maps the return type and the key-value pair of the configuration entity stored in the third-layer data structure.
[0011] In the above embodiment of the present application, a three-layer data storage structure of the memory can be constructed to bind and store the order path, time and return type, so that the configuration data can be quickly obtained according to the storage structure when retrieving the data.
[0012] In some embodiments, calling the configuration data to be called in the memory or hard disk includes: performing multi-dimensional configuration data processing on the configuration data to be called to obtain the multi-dimensional configuration data to be called, wherein the multi-dimensional configuration data processing represents dynamically adjusting the configuration data to be called through different business scenarios, and the different business scenarios include at least one of the city type, time, service type and taxi category, vehicle model, channel and order type; calling the multi-dimensional configuration data.
[0013] In the above-mentioned embodiments of the present application, by configuring multiple dimensions of the configuration data, the configuration data of different dimensions can be quickly called according to the corresponding scenarios and priorities.
[0014] In some embodiments, the latest configuration data is preprocessed to obtain processed configuration data to be called, including: storing the latest configuration data in a tree structure in chronological order, and creating a priority queue; storing the configuration data corresponding to non-overlapping time stored in the tree structure in the priority queue; traversing the configuration data in the priority queue, and processing overlapping configuration data to obtain processed configuration data to be called.
[0015] In the above-mentioned embodiments of the present application, the configuration data is stored in a tree structure, and the configuration data can be retrieved in chronological order while the overlapping data in the priority queue is deduplicated, which can improve the efficiency of calling the configuration data.
[0016] In some embodiments, calling the configuration data to be called in the memory or hard disk includes: calling the path information in the configuration data to be called and the configuration data under the path information according to a preset management scheme.
[0017] In the above-mentioned embodiments of the present application, the configuration data can be retrieved according to the path information and the path information according to the requirements of the management solution, so as to achieve the effect of accurately calling the configuration data.
[0018] In some embodiments, all configuration data and changed data are updated to the memory and hard disk of a preset three-layer data structure to obtain the latest configuration data, including: updating all configuration data according to the change information to obtain the changed configuration data; storing the changed configuration data in the memory and hard disk respectively to obtain the latest configuration data.
[0019] In the above-mentioned embodiments of the present application, the configuration data can be updated in real time according to the change information, thereby avoiding the situation where the configuration data acquisition fails.
[0020] In a second aspect, an embodiment of the present application provides a device for calling configuration data, including:
[0021] The monitoring module is used to retrieve all configuration data of the policy configuration center and monitor whether there are any changes in the data of all configuration data through the monitor;
[0022] The update module is used to update all configuration data and the changed data to the memory and hard disk of the preset three-layer data structure when the data in all configuration data is changed through the listener to obtain the latest configuration data;
[0023] A preprocessing module, used to preprocess the latest configuration data to obtain processed configuration data to be called, wherein the preprocessing includes: at least one of splitting, merging, covering and optimizing;
[0024] The calling module is used to call the configuration data to be called in the memory or hard disk.
[0025] Optionally, the calling module is specifically used for:
[0026] When the configuration data to be called in the memory fails to be obtained, the configuration data to be called in the hard disk is obtained;
[0027] Or when the restart service fails to obtain the configuration data to be called by calling the interface, the data obtained from the hard disk is stored in the memory.
[0028] Optionally, the device further comprises:
[0029] A configuration module is used for configuring a three-layer data structure in memory before the listening module retrieves all the configuration data of the policy configuration center and listens through a listener to whether there are any changes in the data of all the configuration data. The three-layer data structure includes a first-layer data structure, a second-layer data structure, and a third-layer data structure. When the first-layer data structure stores an order path string, the order path maps the time information stored in the second-layer data structure. When the second-layer data structure stores objects of time periods, the time information maps the return type and the key-value pair of the configuration entity stored in the third-layer data structure.
[0030] Optionally, the calling module is specifically used to:
[0031] Performing multi-dimensional configuration data processing on the configuration data to be called to obtain the multi-dimensional configuration data to be called, wherein the multi-dimensional configuration data processing means dynamically adjusting the configuration data to be called according to different business scenarios, and the different business scenarios include at least one of city type, time, service type and taxi category, vehicle type, channel and order type;
[0032] Call multi-dimensional configuration data.
[0033] Optionally, the preprocessing module is specifically used for:
[0034] Store the latest configuration data in a tree structure in chronological order and create a priority queue;
[0035] The configuration data corresponding to the non-overlapping time stored in the tree structure is stored in a priority queue;
[0036] The configuration data in the priority queue is traversed, and overlapping configuration data is processed to obtain the processed configuration data to be called.
[0037] Optionally, the calling module is specifically used to:
[0038] The path information in the configuration data to be called and the configuration data under the path information are called according to the preset management scheme.
[0039] Optionally, the update module is specifically used to:
[0040] Update all configuration data according to the change information to obtain the changed configuration data;
[0041] The changed configuration data is stored in the memory and hard disk respectively to obtain the latest configuration data.
[0042] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method provided in the first aspect are performed.
[0043] In a fourth aspect, an embodiment of the present application provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the method provided in the first aspect are performed.
[0044] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the embodiments of the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 A flowchart of a method for calling configuration data provided by an embodiment of the present application;
[0047] Figure 2 A flowchart of an implementation method for calling configuration data provided in an embodiment of the present application;
[0048] Figure 3 A schematic block diagram of a device for calling configuration data provided by an embodiment of the present application;
[0049] Figure 4 A schematic diagram of the structure of a device for calling configuration data provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0051] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0052] First, some terms involved in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.
[0053] SDK is the abbreviation of Software Development Kit, which means "software development kit" in Chinese. This is a very broad term, referring to a collection of relevant documents, examples and tools that assist in the development of a certain type of software. SDK is usually provided by a third-party service provider and is designed to implement a certain function of a software product. It contains a collection of various types of files, such as KPIs, documents, examples and tools.
[0054] RPC (Remote Procedure Call) is a computer communication protocol that allows a computer program to call a subroutine on another computer just like calling a local program without having to understand the details of the underlying network technology.
[0055] The Map structure is a data structure that allows the storage of key-value pairs, where each key is unique and is associated with a specific value. This data structure is often used to quickly find and retrieve data because it allows direct access to the value associated with it through the key. The Map structure is different from an array or list, which usually accesses elements by index or position, while the Map uses keys to quickly locate and retrieve values.
[0056] JSON (JavaScript Object Notation) is a lightweight data exchange format based on a subset of ECMAScript (JavaScript specification developed by the European Computer Association) and uses a text format that is completely independent of the programming language to store and represent data.
[0057] This application is applied to data processing scenarios. The specific scenario is to combine SDK to obtain and monitor configuration data in real time, update and store configuration data, and achieve the effect of quickly obtaining configuration data.
[0058] At present, in the process of intelligent dispatching of online ride-hailing services, the existing technology usually puts all dimensions of dispatching configuration data on the configuration center when calling configuration data. After pulling all dimensions of configuration data during actual calling, the configuration data of different dimensions is assembled in real time in the code according to the current dispatching path. In this way, there will be a lot of data assembly logic in the process of querying configuration data, which greatly increases the query complexity and query time.
[0059] To this end, the present application retrieves all configuration data from the policy configuration center, and monitors all configuration data through a listener to see if there are any changes; when the listener monitors all configuration data to see if there are any changes, all configuration data and changed data are updated to the memory and hard disk of the preset three-layer data structure to obtain the latest configuration data; the latest configuration data is preprocessed to obtain the processed configuration data to be called, wherein the preprocessing includes: at least one of splitting, merging, overwriting and optimizing; calling the configuration data to be called in the memory or hard disk. By monitoring the changes in configuration data, the update of configuration data in the memory and hard disk is ensured, and after the storage of the three-layer data structure in the memory and the preprocessing of the configuration data, the configuration data in different scenarios can be flexibly obtained, and the effect of quickly calling the configuration data can be achieved.
[0060] In the embodiment of the present application, the execution subject may be a device for calling configuration data in a system for calling configuration data. In actual applications, the device for calling configuration data may be electronic devices such as terminal devices and servers, which are not limited here.
[0061] Combine the following Figure 1 The method for calling configuration data in an embodiment of the present application is described in detail.
[0062] Please see Figure 1 , Figure 1 A flowchart of a method for calling configuration data provided by an embodiment of the present application, such as Figure 1 The method for calling configuration data shown includes:
[0063] Step 110: Retrieve all configuration data from the policy configuration center, and monitor through a listener whether there are any changes in the data in all configuration data.
[0064] Among them, this application calls all the configuration data of the policy configuration center to realize the scenario of fast dispatching, such as online car-hailing dispatching, external dispatching, and fast reading dispatching. All configuration data can be the configuration scheme in all configuration data under the corresponding dispatching scenario, and the dispatching scenario can be online car-hailing dispatching, external dispatching, and fast reading dispatching.
[0065] In some embodiments of the present application, before retrieving all configuration data of the policy configuration center and monitoring whether there are changes in the data of all configuration data through a listener, Figure 1 The method shown also includes: configuring a three-layer data structure in memory, wherein the three-layer data structure includes a first-layer data structure, a second-layer data structure, and a third-layer data structure; when the first-layer data structure stores an order path string, the order path maps the time information stored in the second-layer data structure; when the second-layer data structure stores objects of time periods, the time information maps the return type and the key-value pair of the configuration entity stored in the third-layer data structure.
[0066] In the above process, the present application can construct a three-layer data storage structure in memory, and bind the order path, time and return type for storage, so that the configuration data can be quickly obtained according to the storage structure when retrieving data.
[0067] The first layer data structure, the second layer data structure and the third layer data structure are used to store different types of data, and different types of data have corresponding relationships. For example, when obtaining the configuration information of an order in the memory, the configuration information of the corresponding order can be obtained according to the priority and time information.
[0068] Step 120: When the monitor monitors all configuration data and detects changes, all configuration data and the changed data are updated to the memory and hard disk of the preset three-layer data structure to obtain the latest configuration data.
[0069] The changed data may be the changed information of the configuration data, including the changed information of the city, time period, vehicle type, service type and taxi category.
[0070] Optionally, when a change is detected in the data of all the configuration data monitored through the listener, all the configuration data and the changed data are updated to the memory and hard disk of the preset three-layer data structure to obtain the latest configuration data, including: when a change is detected in the data of all the configuration data monitored through the listener, all the queried configuration data are put into the hard disk, all the configuration data in the hard disk are grouped and stored in the memory according to the three-layer data structure.
[0071] In some embodiments of the present application, all configuration data and changed data are updated to the memory and hard disk of a preset three-layer data structure to obtain the latest configuration data, including: updating all configuration data according to the change information to obtain the changed configuration data; storing the changed configuration data in the memory and hard disk respectively to obtain the latest configuration data.
[0072] In the above process, the present application can update the configuration data in real time according to the change information, thus avoiding the situation where the configuration data cannot be obtained.
[0073] Wherein, all configuration data are updated according to the change information, the change information may be inserted into the original configuration data, and the configuration data corresponding to the original configuration data may be deleted.
[0074] Step 130: pre-process the latest configuration data to obtain processed configuration data to be called.
[0075] Among them, preprocessing includes: at least one of splitting, merging, covering and optimizing, and may also include data initialization, insertion, deduplication and retrieval, etc.
[0076] Specifically, splitting, merging, overwriting and optimization can be done within the SDK. Configuration data can be split according to its effective time period. For each time period, if there are effective configuration data of multiple dimensions, the SDK will merge and overwrite them according to the sorting priority of these configuration data. Use the merge sort algorithm to optimize the merging process of configuration data to ensure the consistency and accuracy of configuration data.
[0077] Split the configuration data with overlapping time periods into multiple configurations with no overlapping time periods; the configurations of overlapping time periods will be overwritten or merged according to the priority. For example, if there are two time period configurations, the time periods are: 10:00-14:00, 12:00-16:00, after splitting, they will become three time periods: 10:00-12:00, 12:00-14:00, 14:00-16:00, of which the configuration of 12:00-14:00 will be overwritten and merged according to the priority of the two configurations.
[0078] In some embodiments of the present application, the latest configuration data is preprocessed to obtain processed configuration data to be called, including: storing the latest configuration data in a tree structure in chronological order, and creating a priority queue; storing the configuration data corresponding to non-overlapping time stored in the tree structure in the priority queue; traversing the configuration data in the priority queue, and processing overlapping configuration data to obtain processed configuration data to be called.
[0079] In the above process, the present application stores configuration data through a tree structure, and can retrieve the configuration data in chronological order while deduplicating overlapping data in the priority queue, thereby improving the efficiency of calling the configuration data.
[0080] Among them, the tree structure is for example a binary tree. The specific traversal process is as follows:
[0081] Traverse different layers of the tree structure until the number of layers is reduced to 1. In each loop, pop out the time period configuration data with the earliest start time from the tree structure, and check the next configuration data in the tree structure. Check whether the current and next configuration data overlap in time. If there is an overlap, pop out the next one and process the overlapping and non-overlapping parts. For the non-overlapping parts, keep their respective configuration data unchanged. For the overlapping parts, select one configuration data to overwrite the other configuration data according to the priority rule to generate a new time interval. Reinsert the processed non-overlapping and overlapping time periods into the tree structure and prepare for the next round of processing. If there is no overlap: insert the current configuration data into the priority queue and keep its original configuration data.
[0082] Step 140: Call the configuration data to be called in the memory or hard disk.
[0083] In some embodiments of the present application, calling the configuration data to be called in the memory or hard disk includes: performing multi-dimensional configuration data processing on the configuration data to be called to obtain the multi-dimensional configuration data to be called, wherein the multi-dimensional configuration data processing represents dynamically adjusting the configuration data to be called through different business scenarios, and the different business scenarios include at least one of the city type, time, service type and taxi category, vehicle model, channel and order type; calling the multi-dimensional configuration data.
[0084] In the above process, the present application configures multiple dimensions of the configuration data, so that the configuration data of different dimensions can be quickly called according to the corresponding scenarios and priorities.
[0085] Optionally, the configuration data to be called can also be called according to the configuration strategy. Specifically, a web interface can be provided through the policy configuration center to allow administrators to define and modify multi-dimensional configuration plans and obtain configuration strategies, such as city, national, operational and global configurations.
[0086] In some embodiments of the present application, calling the configuration data to be called in the memory or hard disk includes: calling the path information in the configuration data to be called and the configuration data under the path information according to a preset management scheme.
[0087] In the above process, the present application can retrieve configuration data according to path information and path information according to the requirements of the management solution, so as to achieve the effect of accurately calling configuration data.
[0088] Among them, a management scheme can refer to a set of configuration rules that define the operations or configurations that should be performed under specific conditions. In the policy configuration center, the scheme contains configuration data of multiple dimensions and levels, such as operational strategies, city strategies, national strategies, etc. There can be multiple paths under the same scheme. The path is used to uniquely identify a configuration item or a group of related configuration items. The path can contain hierarchical information to reflect the classification of the configuration, so that the configuration center can support complex configuration trees and multi-dimensional configuration management. There can be multiple configuration items under the same path. Configuration refers to the specific settings or parameter values that should be executed under a specific path. In the policy configuration center, the configuration can include various business rules, service parameters, operation restrictions, etc., which are used to guide the steps or behaviors that the system should take when processing a specific path. Configuration data can be stored in a preset format, for example, JSON format.
[0089] Optionally, the preset management scheme can be set according to the template as follows:
[0090] ID: A unique identifier used to distinguish different plans. Type: Defines the category of the plan, such as national strategy, city strategy, operational strategy, global strategy or algorithm strategy. Name: A descriptive name for the plan for easy identification and management. Status: Indicates whether the plan is in effect, such as "effective" or "ineffective". Sorting: Indicates the priority of the plan, used to determine which plan should be executed first in case of conflict. City: If applicable, lists the cities to which the plan applies. Path: A collection of paths associated with the plan, each path corresponds to a different business scenario or condition.
[0091] Optionally, when quickly dispatching online ride-hailing orders, quickly dispatch orders according to the set path data structure, as follows:
[0092] ID: A unique identifier for the path. Name: A name that describes the path for easy understanding and tracking. Channel: Indicates the business channel to which the path applies, such as Amap, Meituan, Baidu, or self-operated. Type: The type of order corresponding to the path, such as real-time orders or reservation orders. Taxi category: Defines the type of taxi service that the path applies to, such as ordinary taxis, taxis for the elderly, etc. Taxi service: A specific service type, such as express service, taxi service, etc. Service vehicle type: The type of service vehicle, such as economy, comfort, etc. Effective time period: A list of time periods when the path is effective, to ensure that the configuration is valid within the specified time range. Configuration data: A collection of configuration data associated with the path.
[0093] In some embodiments of the present application, calling the configuration data to be called in the memory or hard disk includes: when the configuration data to be called in the memory fails to be obtained, obtaining the configuration data to be called in the hard disk; or when the restart service fails to obtain the configuration data to be called by calling the interface, storing the data obtained from the hard disk in the memory.
[0094] In the above embodiments of the present application, when the configuration data fails to be retrieved, the configuration data can be re-acquired from the memory or when the service is restarted, when the configuration data fails to be retrieved from the hard disk, the data retrieved from the hard disk is stored in the memory, so that the configuration data can be accurately obtained when it is subsequently called.
[0095] Optionally, to call the configuration data to be called in the memory or hard disk, the SDK provides a query method that allows the user to query the configuration data based on the order path, time point and return type. The interface accepts input parameters, including the return type, and fills the configuration data into the specified data transfer object (DTO). Through this interface, the user can quickly obtain the configuration data related to a specific order path and time point, which is encapsulated in the return type DTO.
[0096] In the above Figure 1 In the process shown, the present application retrieves all configuration data of the policy configuration center, and monitors through a listener whether there are any changes in the data in all the configuration data; when the listener monitors that there are any changes in the data in all the configuration data, all the configuration data and the changed data are updated to the memory and hard disk of the preset three-layer data structure to obtain the latest configuration data; the latest configuration data is preprocessed to obtain the processed configuration data to be called, wherein the preprocessing includes: at least one of splitting, merging, overwriting and optimization; calling the configuration data to be called in the memory or hard disk ensures the update of the configuration data in the memory and the hard disk by monitoring the changes in the configuration data, and the storage of the three-layer data structure in the memory and the preprocessing of the configuration data can flexibly obtain the configuration data in different scenarios, and at the same time achieve the effect of quickly calling the configuration data.
[0097] Combine the following Figure 2 The implementation method of calling configuration data in an embodiment of the present application is described in detail.
[0098] Please see Figure 2 , Figure 2 A flowchart of an implementation method for calling configuration data provided in an embodiment of the present application, such as Figure 2 The implementation method of calling configuration data shown includes:
[0099] Step 210: Determine whether the configuration switch is turned on.
[0100] Specifically: when the configuration switch is turned on, step 220 is performed, otherwise the configuration is terminated.
[0101] Step 220: Monitor configuration data.
[0102] Specifically: retrieve all configuration data from the policy configuration center, and use a listener to monitor whether there are any changes in the data in all configuration data.
[0103] Step 230: Execute the configuration task.
[0104] Specifically: call the configuration data to be called in the memory or hard disk.
[0105] also, Figure 2 The specific methods and steps shown can be found in Figure 1 The method shown will not be described in detail here.
[0106] Previous article Figure 1-Figure 2 Describes the method of calling configuration data. Figure 3-Figure 4 Describes the means of calling configuration data.
[0107] Please refer to Figure 3 , is a schematic block diagram of a device 300 for calling configuration data provided in an embodiment of the present application. The device 300 may be a module, program segment or code on an electronic device. The device 300 is similar to the above Figure 1 The method embodiment corresponds to and can be executed Figure 1 The various steps involved in the method embodiment and the specific functions of the device 300 can be found in the description below. To avoid repetition, the detailed description is appropriately omitted here.
[0108] Optionally, the device 300 includes:
[0109] The monitoring module 310 is used to retrieve all configuration data of the policy configuration center and monitor whether there are changes in the data of all configuration data through a monitor;
[0110] The update module 320 is used to update all the configuration data and the changed data to the memory and hard disk of the preset three-layer data structure to obtain the latest configuration data when the data in all the configuration data is changed through the monitor;
[0111] A preprocessing module 330 is used to preprocess the latest configuration data to obtain processed configuration data to be called, wherein the preprocessing includes: at least one of splitting, merging, covering and optimizing;
[0112] The calling module 340 is used to call the configuration data to be called in the memory or hard disk.
[0113] Optionally, the calling module is specifically used for:
[0114] Calling the configuration data to be called in the memory or hard disk includes: when the configuration data to be called in the memory fails to be obtained, obtaining the configuration data to be called in the hard disk; or when the restart service fails to obtain the configuration data to be called by calling the interface, storing the data obtained from the hard disk in the memory.
[0115] Optionally, the device further comprises:
[0116] A configuration module is used for configuring a three-layer data structure in memory before the listening module retrieves all the configuration data of the policy configuration center and listens through a listener to whether there are any changes in the data of all the configuration data. The three-layer data structure includes a first-layer data structure, a second-layer data structure, and a third-layer data structure. When the first-layer data structure stores an order path string, the order path maps the time information stored in the second-layer data structure. When the second-layer data structure stores objects of time periods, the time information maps the return type and the key-value pair of the configuration entity stored in the third-layer data structure.
[0117] Optionally, the calling module is specifically used to:
[0118] Multi-dimensional configuration data processing is performed on the configuration data to be called to obtain the multi-dimensional configuration data to be called, wherein the multi-dimensional configuration data processing means dynamically adjusting the configuration data to be called through different business scenarios, and the different business scenarios include at least one of city type, time, service type and taxi category, vehicle model, channel and order type; calling the multi-dimensional configuration data.
[0119] Optionally, the preprocessing module is specifically used for:
[0120] The latest configuration data is stored in a tree structure in chronological order, and a priority queue is created; the configuration data corresponding to the non-overlapping time stored in the tree structure is stored in the priority queue; the configuration data in the priority queue is traversed, and the overlapping configuration data is processed to obtain the processed configuration data to be called.
[0121] Optionally, the calling module is specifically used to:
[0122] The path information in the configuration data to be called and the configuration data under the path information are called according to the preset management scheme.
[0123] Optionally, the update module is specifically used to:
[0124] All configuration data are updated according to the change information to obtain the changed configuration data; the changed configuration data are stored in the memory and the hard disk respectively to obtain the latest configuration data.
[0125] Please refer to Figure 44 is a schematic block diagram of a device for calling configuration data provided in an embodiment of the present application. The device may include a memory 410 and a processor 420. Optionally, the device may also include: a communication interface 430 and a communication bus 440. The device is similar to the above Figure 1 The method embodiment corresponds to and can be executed Figure 1 The various steps involved in the method embodiment and the specific functions of the device can be found in the description below.
[0126] Specifically, the memory 410 is used to store computer-readable instructions.
[0127] Processor 420 is used to process the readable instructions stored in the memory and can execute Figure 1 The steps in the method.
[0128] The communication interface 430 is used for signaling or data communication with other node devices, for example, for communication with a server or a terminal, or for communication with other device nodes, but the embodiments of the present application are not limited thereto.
[0129] The communication bus 440 is used to realize direct connection and communication among the above components.
[0130] The communication interface 430 of the device in the embodiment of the present application is used to communicate signals or data with other node devices. The memory 410 can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The memory 410 can also be at least one storage device located away from the aforementioned processor. The memory 410 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 420, the electronic device executes the aforementioned Figure 1 The method process shown. The processor 420 can be used on the device 300 and is used to perform the functions in the present application. Exemplarily, the above-mentioned processor 420 can be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and the embodiments of the present application are not limited thereto.
[0131] The embodiment of the present application also provides a readable storage medium, when the computer program is executed by a processor, Figure 1 The method process in the method embodiment shown is executed by the electronic device.
[0132] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method, and will not be described in detail here.
[0133] In summary, the embodiments of the present application provide a method, device, electronic device and readable storage medium for calling configuration data, the method comprising: calling all configuration data of the policy configuration center, and monitoring through a listener whether there are changes in the data in all configuration data; when the data in all configuration data is monitored through the listener, updating all configuration data and changed data to the memory and hard disk of the preset three-layer data structure to obtain the latest configuration data; preprocessing the latest configuration data to obtain the processed configuration data to be called, wherein the preprocessing includes: at least one of splitting, merging, overwriting and optimizing; calling the configuration data to be called in the memory or hard disk. This method can achieve the effect of quickly calling configuration data.
[0134] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0135] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0136] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0137] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0138] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0139] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
Claims
1. A method for calling configuration data, characterized in that: include: Retrieve all configuration data from the policy configuration center, and monitor through a listener whether there are any changes in the data in all the configuration data; When the monitor monitors the data in the entire configuration data and finds that there is a change, the entire configuration data and the changed data are updated to the memory and hard disk of the preset three-layer data structure to obtain the latest configuration data; Preprocessing the latest configuration data to obtain processed configuration data to be called, wherein the preprocessing includes: at least one of splitting, merging, overwriting and optimizing; The configuration data to be called in the memory or the hard disk is called.
2. The method according to claim 1, characterized in that The calling of the configuration data to be called in the memory or the hard disk includes: When the configuration data to be called in the memory fails to be obtained, obtaining the configuration data to be called in the hard disk; Or when the restart service fails to obtain the configuration data to be called by calling the interface, the data obtained from the hard disk is stored in the memory.
3. The method according to claim 1 or 2, characterized in that: Before calling all configuration data of the policy configuration center and monitoring whether data in all configuration data has changed through a listener, the method further includes: A three-layer data structure is configured in the memory, wherein the three-layer data structure includes a first-layer data structure, a second-layer data structure and a third-layer data structure; when the first-layer data structure stores an order path string, the order path maps the time information stored in the second-layer data structure; when the second-layer data structure stores objects of time periods, the time information maps the key-value pairs of the return type and the configuration entity stored in the third-layer data structure.
4. The method according to claim 1 or 2, characterized in that: The calling of the configuration data to be called in the memory or the hard disk includes: Performing multi-dimensional configuration data processing on the configuration data to be called to obtain the multi-dimensional configuration data to be called, wherein the multi-dimensional configuration data processing means dynamically adjusting the configuration data to be called according to different business scenarios, and the different business scenarios include at least one of city type, time, service type and taxi category, car model, channel and order type; The multi-dimensional configuration data is called.
5. The method according to claim 1 or 2, characterized in that: The preprocessing of the latest configuration data to obtain processed configuration data to be called includes: The latest configuration data is stored in a tree structure in chronological order, and a priority queue is created; storing the configuration data corresponding to the non-overlapping time stored in the tree structure in the priority queue; The configuration data in the priority queue is traversed, and overlapping configuration data is processed to obtain the processed configuration data to be called.
6. The method according to claim 1 or 2, characterized in that: The calling of the configuration data to be called in the memory or the hard disk includes: The path information in the configuration data to be called and the configuration data under the path information are called according to a preset management scheme.
7. The method according to claim 1 or 2, characterized in that: The updating of all the configuration data and the changed data to the memory and the hard disk of the preset three-layer data structure to obtain the latest configuration data includes: Update all the configuration data according to the change information to obtain the changed configuration data; The changed configuration data is stored in the memory and the hard disk respectively to obtain the latest configuration data.
8. A device for calling configuration data, characterized in that: include: A monitoring module is used to retrieve all configuration data of the policy configuration center and monitor whether there are changes in the data of all configuration data through a monitor; An update module, configured to update all the configuration data and the changed data to a memory and a hard disk of a preset three-layer data structure to obtain the latest configuration data when the listener monitors changes in the data in the all configuration data; A preprocessing module, used for preprocessing the latest configuration data to obtain processed configuration data to be called, wherein the preprocessing includes: at least one of splitting, merging, covering and optimizing; A calling module is used to call the configuration data to be called in the memory or the hard disk.
9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1 to 7 are executed.
10. A computer-readable storage medium, characterized in that: include: A computer program, when the computer program is run on a computer, causes the computer to execute the method according to any one of claims 1 to 7.
