CN115145712A - Interface calling method, device, equipment and medium for external service platform - Google Patents

Interface calling method, device, equipment and medium for external service platform Download PDF

Info

Publication number
CN115145712A
CN115145712A CN202211081428.4A CN202211081428A CN115145712A CN 115145712 A CN115145712 A CN 115145712A CN 202211081428 A CN202211081428 A CN 202211081428A CN 115145712 A CN115145712 A CN 115145712A
Authority
CN
China
Prior art keywords
interface
calling
request
service platform
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211081428.4A
Other languages
Chinese (zh)
Inventor
马希涛
于礁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Accumulus Technologies Tianjin Co Ltd
Original Assignee
Accumulus Technologies Tianjin Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Accumulus Technologies Tianjin Co Ltd filed Critical Accumulus Technologies Tianjin Co Ltd
Priority to CN202211081428.4A priority Critical patent/CN115145712A/en
Publication of CN115145712A publication Critical patent/CN115145712A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application

Abstract

The invention discloses a method, a device, equipment and a medium for calling an interface of an external service platform. The interface calling method for the external service platform comprises the following steps: the method comprises the steps that a preset interface bearing container determines a target interface called by a calling party according to an interface calling request of the calling party and the corresponding relation between a preset interface and a key contained in the interface calling request; the interface bearing container calls an interface of a target interface according to the interface calling request; and the interface bearing container returns a calling result to a calling party according to a response result of the target interface to the interface calling request. The interface calling technology for the external service platform can realize that one interface bearing container bears all external interfaces of one external service platform through one preset interface bearing container, and a calling party directly calls the interfaces of one external service platform through one interface bearing container, so that the calling operation is convenient.

Description

Interface calling method, device, equipment and medium for external service platform
Technical Field
The present invention relates to the field of interface calling technologies, and in particular, to a method, an apparatus, a device, and a medium for calling an interface of an external service platform.
Background
Most of the existing external service platforms provide independent interfaces for calling parties to call the interfaces and obtain the resources provided by the calling parties, each interface has different request parameters, and each interface has different current limiting, fusing or caching strategies. When the interface is called, the caller needs to realize a plurality of corresponding interface calling methods, and needs to know the current limiting and caching strategies of each interface to ensure the normal calling of the interface.
Because the existing external service platform provides a corresponding calling mode and a batch of request parameters for each interface, each calling party needs to maintain a calling method and maintain the request parameters of the calling party, the significance of packaging the external interface is lost, and the difficulty of calling the interface by the calling party is increased;
in addition, most of the existing call requests of external service platforms use independent current limiting and fusing strategies, and a caller needs to know detailed interface request information and interface implementation forms to initiate interface call. In fact, the caller does not pay attention to the implementation of the interface, and only pays attention to two key points of the request and the result, so that the caller is inconvenient to implement the call.
Disclosure of Invention
The invention aims to provide a method, a device, equipment and a medium for calling an interface of an external service platform aiming at technical defects in the prior art.
In a first aspect of the present invention, a method for calling an interface of an external service platform is provided, including:
the method comprises the steps that a preset interface bearing container determines a target interface called by a calling party according to an interface calling request of the calling party and the corresponding relation between a preset interface and a key contained in the interface calling request;
the interface bearing container calls an interface of a target interface according to the interface calling request;
and the interface bearing container returns a calling result to a calling party according to a response result of the target interface to the interface calling request.
In a second aspect of the present invention, an interface invoking device for an external service platform is provided, including a preset interface bearer container, where the interface bearer container includes:
the target interface determining module is used for determining a target interface called by a calling party according to an interface calling request of the calling party and the corresponding relation between a preset interface and a key contained in the interface calling request;
the target interface calling module is used for the interface bearing container to carry out interface calling on a target interface according to the interface calling request;
and the calling result returning module is used for returning the calling result to the calling party by the interface bearing container according to the response result of the target interface to the interface calling request.
In a third aspect of the present invention, there is provided an electronic device comprising:
a processor; and the number of the first and second groups,
a memory for storing a computer program for the processor;
wherein the processor is configured to implement the interface call method for the foreign service platform according to the first aspect of the present invention by executing the computer program.
In a fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, and the computer program, when executed by a processor, implements the interface calling method for an external service platform according to the first aspect of the present invention.
In a fifth aspect of the present invention, a computer program product is provided, which includes a computer program, and when the computer program is executed by a processor, the computer program implements the interface calling method for the external service platform according to the first aspect of the present invention.
The interface calling technology for the external service platform can realize that one interface bearing container bears all external interfaces of one external service platform through one preset interface bearing container, and a calling party directly calls the interfaces of one external service platform through one interface bearing container, so that the calling operation is convenient.
Drawings
Fig. 1 is a flowchart of an interface calling method for an external service platform according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of an effective time threshold adjustment for a cache according to an embodiment of the present invention.
Fig. 3 is a functional block diagram of an interface calling apparatus for an external service platform according to an embodiment of the present invention.
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the figures and the specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the invention is provided with an interface bearing container of the external service platform, and the interface bearing container comprises all external interfaces of the external service platform, so that a calling party can call a required interface only through one interface bearing container and call request information input by the calling party, and the calling of all encapsulated interfaces can be realized. Therefore, for the calling party, the method does not need to pay attention to the implementation form of the interface, does not need to implement a plurality of methods for calling the interface, and can realize the calling of the required interface only by knowing the information required to be acquired.
As shown in fig. 1, a first aspect of the embodiments of the present invention provides a method for calling an interface of an external service platform, including:
s110, a preset interface bearing container determines a target interface called by a calling party according to an interface calling request of the calling party and the corresponding relation between a preset interface and a key contained in the interface calling request;
s120, the interface bearing container calls a target interface according to the interface calling request;
s130, the interface bearing container returns a calling result to a calling party according to a response result of the target interface to the interface calling request.
Illustratively, all interfaces for external calling of an external service platform are encapsulated in the interface bearer container. The interface bearing container is provided with an interface request information input window, and the interface request information is called by the input interface of a calling party through the interface request information input window to realize the calling of the interface.
In the embodiment of the present invention, a manner of encapsulating all common request parameters of different interfaces in an interface bearer into a structure is expressed externally as having only one interface request information input interface, so that a caller can obtain different interface data or information by inputting corresponding interface request information \ parameters from different interfaces according to the attribute of data to be obtained.
In the embodiment of the invention, each interface (VALUE) for external calling is corresponding to one KEY (KEY) in advance to form a KEY-VALUE pair (KEY-VALUE). When a caller inputs request parameters \ information through a request input interface of an interface bearing container, the interface bearing container can determine keywords (keys) contained in the request parameters \ information according to the interface call request parameters \ information, then a server searches a target interface to be called according to the keys, namely the server matches the interface to be called of the caller according to the keys, then the call of the target interface is realized according to the input request parameters \ information, and a call result is returned.
The input request parameter \ information is parameters that need to be requested, such as enterprise name, and content that needs to be queried (such as logout, enterprise share right distribution), and the interface bearing container calls the corresponding interface according to the input request parameter \ information is a matching keyword.
In the embodiment of the invention, after the unified interface bearing container is set, the current-limiting fusing strategy and/or the caching strategy which are suitable for a plurality of packaged interfaces in the interface bearing container are further uniformly set based on the unified interface bearing container, so that the resource allocation of a plurality of service platforms is uniformly allocated, and the whole external service is operated more simply and efficiently.
In implementation, when the interface bearing container calls the target interface according to the interface calling request, the interface bearing container performs current limiting and/or fusing on the calling of the target interface according to the frequency of the interface calling request of the target interface and based on a preset current limiting and/or fusing strategy. The specific current limiting and/or fusing method is the prior art and is not described in detail.
Illustratively, the call result includes a request result obtained from the cache data or a request result obtained from the interface; the cache data is data formed by caching a request result obtained from the target interface in the process of calling the target interface.
In the embodiment of the invention, in order to facilitate the calling party to quickly obtain corresponding data, when cache data is judged according to the cache strategy in the calling process, the request result can be directly returned through the cache data, if no cache data exists, a target interface is called, and the data is obtained through the interface and returned.
In addition, if the current limiting and fusing strategy of the interface bearing container is triggered in the calling process, the calling of the target interface is controlled according to the current limiting and fusing strategy of the interface bearing container, and if the calling times of the interface exceed the specified times, current limiting or fusing is carried out.
Wherein, the current limit only allows the tolerable access amount to come in, and the excess capacity is discarded. Fusing is the direct stopping of the invocation of an interface when the interface is found to be unavailable.
As described above, in the embodiment of the present invention, when the request result called by the interface is obtained, one of the request results can be obtained from the cache data, and the other one can be obtained from the interface, so that in the process of calling the target interface, the number of cache hits is recorded as 0 while the request result obtained from the interface is cached, that is, the cache miss is indicated; and when the request result is obtained from the cache data, the cache hit times are recorded. The statistics of the cache hit times is facilitated, so that the effective storage time of the cache data is adaptively adjusted, and the interface calling requirement is met.
The valid storage time threshold of the cache refers to the valid storage time of one cache data, for example, the valid storage time of one cache data is set to be one week, when the time difference between the query time and the storage time of the cache data is greater than one week, the cache is considered to be invalid, the caller cannot obtain a corresponding request result through the cache data, and still needs to perform interface query to obtain the request result through the interface.
Illustratively, the interface carries a plurality of interfaces encapsulated in the container, and the valid time threshold of the cache is adaptively adjusted according to the number of cache hits and/or the number of call requests of the interfaces. The embodiment of the invention actively senses and records the calling state of the external service interface calling condition and assists the self-adaptive adjustment of the effective time threshold of the cache, optimizes the calling times of the interface and reduces the operation cost under the condition of ensuring that the service using experience is not influenced.
For example, when the effective time threshold of the cache is adaptively adjusted, the effective storage time threshold of the cache may be adaptively reduced or increased according to a change condition of a request result returned by the interface \ or the number of times of interface calls and \ or the number of times of cache hits.
In a specific implementation, please refer to fig. 2, for example, the caching effective time of the adaptive change control data may be implemented by setting an index value, and the caching effective time may be increased or decreased by monitoring a preset index value. When the interface calling times are too many to trigger current limiting and fusing, the effective time threshold of the cache can be increased, and when the current limiting or fusing is not triggered, the effective time threshold of the cache can be reduced; when the number of cache hits is reduced, the validity time threshold of the cache is increased, and when the number of cache hits is increased, the validity time threshold of the cache is reduced. Or if the number of the interface change information is increased, the effective time threshold value of the cache is decreased, and if the number of the interface change information is decreased, the effective time threshold value of the cache is increased. The above are only a few alternative embodiments or modes, which can be adopted but not limited to the above embodiments.
The interface change information refers to change information that is expressed when the request result information returned by the interface under the current call is different from the request result information returned by the interface during the last call. Querying an interface returns a number of fields such as whether the business has logged off, whether the business has changed names. When the returned field information is different from the returned field information of the last query, the interface information is considered to be changed.
In the embodiment of the invention, the self-adaptive adjustment of the effective time threshold of the cache can be realized by a related global or local optimal algorithm, so that automatic local adjustment and optimization according to the index value are realized, manual intervention is reduced, and the self-adaptive capacity of the effective time threshold of the cache is improved. Global or local optimization algorithms such as particle swarm or wolfram algorithms, and LRU (Least centrally Used)/LFU (Least frequency Used) mechanisms can be introduced.
LRU (Least Recently Used) refers to the elimination of the Least Recently accessed data. LFU (Least frequency Used) refers to elimination of the Least Frequently Used data (less number of accesses). The elimination is to remove a specified portion of data in the memory and to free up space for new data.
It can be seen that, the embodiment of the present invention greatly simplifies the interface calling process of the calling party by the interface calling technology. By adaptively adjusting the effective time threshold of the cache, the calling of the container interface is optimized under the condition that the calling Fang Mogan is known, and the calling frequency of the interface is reduced.
Referring to fig. 3, in a second aspect of the embodiment of the present invention, an interface invoking device for an external service platform is provided, including a preset interface bearer container 200, where the interface bearer container includes:
a target interface determining module 210, configured to determine, according to an interface call request of a caller, a target interface called by the caller according to a correspondence between a preset interface and a key included in the interface call request; a target interface calling module 220, configured to perform, by the interface bearer, interface calling on a target interface according to the interface calling request; the calling result returning module 230 is configured to return, by the interface bearer, a calling result to the caller according to a response result of the target interface to the interface calling request.
For the interface calling device for the external service platform according to the second aspect of the present invention, please refer to the detailed description of the interface calling method for the external service platform according to the first aspect of the present invention, which is not described herein again.
Referring to fig. 4, in a third aspect of the embodiments of the present invention, there is provided an electronic device 300, including:
a processor 301; and a memory 302 for storing a computer program for the processor, which memory may also be a flash (flash memory); wherein the processor is configured to implement the interface call method for the external service platform according to the first aspect of the embodiment of the present invention by executing the computer program.
Alternatively, the memory 302 may be separate or integrated with the processor 301.
When the memory 302 is a device independent of the processor 301, the electronic device 300 may further include:
a bus 303 for connecting the processor 301 and the memory 302.
In a fourth aspect of the embodiments of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the interface calling method for the external service platform according to the first aspect of the embodiments of the present invention.
In a fifth aspect of the embodiments of the present invention, a computer program product is provided, where the computer program includes a computer program, and when executed by a processor, the computer program implements the interface calling method for the external service platform according to the first aspect of the embodiments of the present invention.
According to the interface calling technology of the external service platform, one preset interface bearing container can be used for bearing all external interfaces of one external service platform, and a calling party directly calls the interfaces of the external service platform through one interface bearing container, so that calling operation is facilitated.
While there have been shown and described the fundamental principles and essential features of the invention and advantages thereof, it will be apparent to those skilled in the art that the invention is not limited to the details of the foregoing exemplary embodiments, but is capable of other specific forms without departing from the spirit or essential characteristics thereof;
the present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein.
Furthermore, it should be understood that although the present description refers to embodiments, not every embodiment may contain only a single embodiment, and such description is for clarity only, and those skilled in the art should integrate the description, and the embodiments may be combined as appropriate to form other embodiments understood by those skilled in the art.

Claims (9)

1. The interface calling method of the external service platform is characterized by comprising the following steps:
the method comprises the steps that a preset interface bearing container determines a target interface called by a calling party according to an interface calling request of the calling party and the corresponding relation between a preset interface and a key contained in the interface calling request;
the interface bearing container calls an interface of a target interface according to the interface calling request;
and the interface bearing container returns a calling result to a calling party according to a response result of the target interface to the interface calling request.
2. The method for invoking an interface to a foreign service platform according to claim 1, wherein all interfaces for external invocation of a foreign service platform are encapsulated in the interface bearer container.
3. The interface calling method for the external service platform according to claim 2, wherein the calling result includes a request result obtained from the cache data or a request result obtained from the interface;
the cache data is data formed by caching a request result obtained from the target interface in the process of calling the target interface.
4. The interface calling method for the external service platform according to claim 3, wherein in the process of calling the target interface, the number of cache hits is recorded as 0 while caching the request result obtained from the target interface; and recording cache hit times when the request result is obtained from the cache data.
5. The interface call method for the external service platform according to claim 4, wherein when the interface bearer container performs the interface call to the target interface according to the interface call request, the method includes:
and carrying out current limiting and/or fusing on the calling of the target interface based on a preset current limiting and/or fusing strategy according to the frequency of the interface calling request of the target interface.
6. The method for calling the interface of the external service platform according to claim 4, wherein the plurality of interfaces encapsulated in the interface bearer container adaptively adjust the valid time threshold of the cache according to the number of cache hits and/or the number of call requests.
7. The interface of external service platform calls the device, characterized by, include a predetermined interface and bear the weight of the container, this interface bears the weight of the container and includes:
the target interface determining module is used for determining a target interface called by a calling party according to an interface calling request of the calling party and the corresponding relation between a preset interface and a key contained in the interface calling request;
the target interface calling module is used for the interface bearing container to carry out interface calling on a target interface according to the interface calling request;
and the calling result returning module is used for returning the calling result to the calling party by the interface bearing container according to the response result of the target interface to the interface calling request.
8. An electronic device, comprising:
a processor; and (c) a second step of,
a memory for storing a computer program for the processor;
wherein the processor is configured to implement the interface call method to the foreign service platform of any one of claims 1 to 6 by executing the computer program.
9. A computer-readable storage medium on which a computer program is stored, the computer program, when being executed by a processor, implementing the interface call method for the external service platform according to any one of claims 1 to 6.
CN202211081428.4A 2022-09-06 2022-09-06 Interface calling method, device, equipment and medium for external service platform Pending CN115145712A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211081428.4A CN115145712A (en) 2022-09-06 2022-09-06 Interface calling method, device, equipment and medium for external service platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211081428.4A CN115145712A (en) 2022-09-06 2022-09-06 Interface calling method, device, equipment and medium for external service platform

Publications (1)

Publication Number Publication Date
CN115145712A true CN115145712A (en) 2022-10-04

Family

ID=83415893

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211081428.4A Pending CN115145712A (en) 2022-09-06 2022-09-06 Interface calling method, device, equipment and medium for external service platform

Country Status (1)

Country Link
CN (1) CN115145712A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108282405A (en) * 2017-12-27 2018-07-13 努比亚技术有限公司 Application programming interfaces buffer memory management method, application server and storage medium
CN113312427A (en) * 2021-05-24 2021-08-27 网易(杭州)网络有限公司 Block chain calling method and device, management service platform and storage medium
WO2022068761A1 (en) * 2020-09-29 2022-04-07 京东科技控股股份有限公司 Data processing method and apparatus, electronic device, and storage medium
WO2022082892A1 (en) * 2020-10-20 2022-04-28 苏州莱锦机电自动化有限公司 Big data analysis method and system, and computer device and storage medium thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108282405A (en) * 2017-12-27 2018-07-13 努比亚技术有限公司 Application programming interfaces buffer memory management method, application server and storage medium
WO2022068761A1 (en) * 2020-09-29 2022-04-07 京东科技控股股份有限公司 Data processing method and apparatus, electronic device, and storage medium
WO2022082892A1 (en) * 2020-10-20 2022-04-28 苏州莱锦机电自动化有限公司 Big data analysis method and system, and computer device and storage medium thereof
CN113312427A (en) * 2021-05-24 2021-08-27 网易(杭州)网络有限公司 Block chain calling method and device, management service platform and storage medium

Similar Documents

Publication Publication Date Title
US8868831B2 (en) Caching data between a database server and a storage system
US6871268B2 (en) Methods and systems for distributed caching in presence of updates and in accordance with holding times
JP4317531B2 (en) System and method for balancing multiple memory buffer sizes
US6282613B1 (en) Very efficient technique for dynamically tracking locality of a reference
EP1677201A2 (en) Common cache management in a plurality of virtual machines
US20030229760A1 (en) Storage-assisted quality of service (QoS)
US6944715B2 (en) Value based caching
CN111339143A (en) Data caching method and device and cloud server
US9170943B2 (en) Selectively enabling write caching in a storage system based on performance metrics
CN112035766A (en) Webpage access method and device, storage medium and electronic equipment
CN105512222A (en) Data query method and system, and data reading method and system
US20230121843A1 (en) Managing data stored in a cache using a reinforcement learning agent
US20050160225A1 (en) Self-tuning cache
CN111078585B (en) Memory cache management method, system, storage medium and electronic equipment
CN103294609B (en) Signal conditioning package and storage management method
CN113094392A (en) Data caching method and device
CN117130792A (en) Processing method, device, equipment and storage medium for cache object
CN115145712A (en) Interface calling method, device, equipment and medium for external service platform
US6915386B2 (en) Processing service level agreement (SLA) terms in a caching component of a storage system
CN112925472A (en) Request processing method and device, electronic equipment and computer storage medium
CN116089425A (en) Method and device for improving redis memory elimination strategy based on LFU algorithm
CN109582233A (en) A kind of caching method and device of data
CN110944050B (en) Reverse proxy server cache dynamic configuration method and system
CN114528068A (en) Method for eliminating cold start of server-free computing container
CN115858419B (en) Metadata management method, device, equipment, server and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20221004

RJ01 Rejection of invention patent application after publication