WO2020135485A1 - Result acquisition method, apparatus and device - Google Patents

Result acquisition method, apparatus and device Download PDF

Info

Publication number
WO2020135485A1
WO2020135485A1 PCT/CN2019/128240 CN2019128240W WO2020135485A1 WO 2020135485 A1 WO2020135485 A1 WO 2020135485A1 CN 2019128240 W CN2019128240 W CN 2019128240W WO 2020135485 A1 WO2020135485 A1 WO 2020135485A1
Authority
WO
WIPO (PCT)
Prior art keywords
target api
api
cache
target
return
Prior art date
Application number
PCT/CN2019/128240
Other languages
French (fr)
Chinese (zh)
Inventor
冯绍波
王根良
邵哲平
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2020135485A1 publication Critical patent/WO2020135485A1/en

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/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • 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/54Interprogram communication

Definitions

  • This application relates to the field of mobile terminals, and in particular, to a method, device, and device for obtaining results.
  • a process in order to ensure the security of the data, each process runs independently and cannot directly use the resources of other processes.
  • a process may need to use the resources of other processes, for example, a service process can provide services for the process where the application is located, so that the application can use the resources of the service process to achieve the desired function, such as service
  • the process can provide terminal memory information, hard disk information, etc. for the application.
  • the service process provides services for the process where the application is located, and can be implemented through inter-process communication (IPC). Specifically, corresponding application programming interfaces (APIs) can be set for these services in advance.
  • the application can use the resources in the service process by calling the APIs corresponding to the services to achieve the desired functions.
  • Embodiments of the present application provide a method, device, and device for obtaining a result.
  • a return result corresponding to a target API By storing a return result corresponding to a target API in a cache, the number of calls to the target API is reduced, system load is reduced, and system performance is improved.
  • the first aspect of the present application provides a method for obtaining results.
  • the method includes:
  • the target API in response to the first request instruction to the target API, the target API is called to obtain the return result of the target API, and the target API and the return result are stored in the cache correspondingly, therefore, in response to the second request to the target API Instruction, you can find the return result corresponding to the target API in the cache, without having to call the target API again to get the return result of the target API, reducing the number of calls to the target API, thereby reducing system load and improving system performance.
  • the searching the cache for the returned result corresponding to the target API includes:
  • the returned result corresponding to the target API found in the cache satisfies the valid time condition. Therefore, the returned result is a valid result, thereby improving the accuracy of the returned result.
  • the method further includes:
  • the target API is called to obtain the return result corresponding to the target API.
  • the method further includes:
  • the type of the target API is the first preset type.
  • the first preset type indicates that the return result of the target API is related to time, but the difference between multiple return results is not large. Therefore, it can be determined whether the return result corresponding to the target API meets the valid time condition. If it is, it means that the return result is valid. If not, the returned result is considered invalid.
  • the method further includes:
  • the method further includes:
  • the to-be-processed API determine whether the to-be-processed API is a target API, and the target API is a first preset type or a second preset type; the first preset type represents multiple times of the target API The return results are different, and the difference between the multiple return results is less than or equal to a preset difference, and the second preset type indicates that the multiple return results of the target API are the same.
  • the target API is of a specific type in the to-be-processed API, such as the first preset type or the second preset type, and the returned result corresponding to the target API can be stored to reduce the number of times the target API is called.
  • the method further includes:
  • the return result corresponding to the target API can also be deleted or updated according to the service information, so that the return result corresponding to the target API is more accurate.
  • the responding to the first request instruction to the target API, invoking the target API, and obtaining a return result of the target API includes:
  • the target API In response to the first request instruction to the target API, if the return result corresponding to the target API does not exist in the cache, the target API is called to obtain the return result corresponding to the target API.
  • the return result corresponding to the target API may be searched first, and if the cache does not exist, then the target API is called to reduce the number of times the target API is called.
  • a second aspect of an embodiment of the present application provides an apparatus for obtaining results.
  • the apparatus includes:
  • a first calling unit configured to call the target API in response to a first request instruction to the target API, and obtain a return result of the target API
  • a storage unit configured to store the target API and the returned result correspondingly in the cache
  • the searching unit is configured to search for the returned result corresponding to the target API in the cache in response to the second request instruction to the target API.
  • the search unit is specifically used to:
  • the device further includes:
  • the second calling unit is configured to call the target API to obtain the return result corresponding to the target API if the return result corresponding to the target API that meets the valid time condition does not exist in the cache.
  • the device further includes:
  • the first deleting unit is configured to delete the returned result corresponding to the target API in the cache that does not satisfy the valid time condition.
  • the type of the target API is the first preset type.
  • the device further includes:
  • the second deleting unit is configured to delete the returned result in the cache that does not meet the valid time condition.
  • the device further includes:
  • a target API determining unit configured to determine whether the API to be processed is a target API according to the type of the API to be processed, and the target API is a first preset type or a second preset type; the first preset type is characterized The multiple return results of the target API are different, and the difference between the multiple return results is less than or equal to a preset difference.
  • the second preset type indicates that the multiple return results of the target API are the same.
  • the device further includes:
  • the updating unit is configured to delete the return result corresponding to the target API in the cache when the service information of the target service corresponding to the target API changes, or, to the target API corresponding to the cache Return the result to update.
  • the first calling unit is specifically configured to:
  • the target API In response to the first request instruction to the target API, if the return result corresponding to the target API does not exist in the cache, the target API is called to obtain the return result corresponding to the target API.
  • a third aspect of the embodiments of the present application provides a result acquisition device, where the device includes a processor and a memory;
  • the memory is used to store instructions
  • the processor is configured to execute the instructions in the memory and execute a method for obtaining results provided in the first aspect of the embodiments of the present application.
  • a fourth aspect of an embodiment of the present application provides a computer-readable storage medium, including instructions, which when executed on a computer, causes the computer to obtain a result acquisition method provided by the first aspect of the embodiment of the present application.
  • a fifth aspect of an embodiment of the present application provides a computer program product containing instructions, which, when run on a computer, causes the computer to obtain a result acquisition method provided by the first aspect of the embodiment of the present application.
  • the target API in response to the first request instruction to the target API, the target API is called to obtain the return result of the target API, and the target API and the return are correspondingly stored in the cache
  • the return result corresponding to the target API can be found in the cache without calling the target API again to get the return result of the target API, reducing the number of calls to the target API, Thereby reducing system load and improving system performance.
  • FIG. 1 is a schematic diagram of information interaction for obtaining results in the prior art
  • FIG. 3 is a schematic diagram of a scenario embodiment in an embodiment of the present application.
  • FIG. 4 is a structural block diagram of an apparatus for obtaining results in an embodiment of the present application.
  • FIG. 5 is a structural block diagram of a result acquisition device in an embodiment of this application.
  • Embodiments of the present application provide a method, device, and device for obtaining results, which are used to reduce the number of target API calls in a terminal device, reduce system load, and improve system performance.
  • the service process provides services for the process where the application is located, and can be realized through inter-process communication.
  • the corresponding API can be set for the service in advance, and the application program can call the API to use the corresponding resource in the service process to achieve the desired function.
  • an application can call the system API to obtain information such as the terminal's memory, hard disk, whether it supports Bluetooth, and whether it supports flash.
  • an application in the process of using the application program, the application program may repeatedly call the API.
  • FIG. 1 is a schematic diagram of information interaction for obtaining results in the prior art
  • an application can make three API calls and send three information query requests to a system service.
  • the system service obtains a query The result is returned to the application.
  • the information query request here may be to query whether the terminal device supports a certain function, such as the Bluetooth function and the flash function.
  • some of the returned results may not be related to time, that is to say, the process of calling the API three times is the same, and the query results returned by the system service are also the same. Therefore, making three API calls is completely unnecessary, resulting in unnecessary Waste of resources.
  • the embodiments of the present application provide a method, device and device for obtaining a result.
  • the target API When responding to the first request instruction to the target API, the target API is called to obtain the return result of the target API and stored in the cache correspondingly The target API and the corresponding return result. Therefore, in response to the second request instruction to the target API, the return result corresponding to the target API can be found in the cache without having to call the target API again to obtain the return result of the target API.
  • the number of target API calls to reduce system load and improve system performance. In other words, corresponding to the three information query requests shown in Figure 1, the optimal result is that as long as the first information query is required, the target API is called once and the returned result is obtained. During the query, the corresponding return result is obtained from the cache, which greatly reduces the number of calls to the target API.
  • FIG. 2 is a flowchart of a method for obtaining results in an embodiment of the present application. The following specifically describes the method for obtaining results provided by the embodiments of the present application.
  • the target API corresponds to the target service. It can be a predefined function provided by the operating system or service provider.
  • the application can call the API to obtain the target service without the source code of the target service or without understanding the internal principles. Resources in the process.
  • inter-process communication can be achieved through Binder.
  • the Android framework itself can provide a series of system services and provide Java/C++ APIs to call these services. Therefore, you can transfer the query request from the process where the application is located to the service process based on the Binder mechanism by calling the API. After the service process obtains the corresponding query result, the query result is returned to the process where the application is located through the Binder mechanism.
  • the target API may be the first preset type.
  • the first preset type indicates that the return result of the target API is related to time, but the difference between multiple return results is not large, that is, the time to call the target API is different, and the difference between the return results is less than or equal to the preset difference, for example
  • the location gap of the mobile terminal is also small.
  • the target API is the first preset type may be preset by the provider of the target service corresponding to the target API, or may be preset by an operating system developer, or may be automatically determined by the terminal device.
  • the terminal device can determine the type of the target API according to the historical record of the target API call and the historical return result. Specifically, it can compare the time of calling the target API multiple times, and compare the historical return results obtained after multiple calls to the target API. If the change rate of the historical return result is less than or equal to the preset rate, the target API has the first preset type.
  • the terminal device determines the type of the target API according to the historical records and historical return results of calling the target API, and can also refer to the current scene of the terminal device, for example, when the user is walking, the location of the terminal device is within a short time gap Small, at this time, it can be considered that the API corresponding to the positioning function can be the first preset type, but when the terminal device is on a vehicle with a fast moving speed, the gap in a short time is large, then the corresponding function of the positioning function cannot be considered API is the first preset type.
  • the current scene of the terminal device can be obtained according to the information of the sensor of the terminal device.
  • the target API may also be the second preset type.
  • the second preset type indicates that the return result of the target API is independent of time, that is, the multiple return results of the target API are always the same.
  • Whether the target API is the second preset type may be preset by the provider of the target service corresponding to the target API, or may be preset by the operating system developer, or may be automatically determined by the terminal device.
  • the terminal device can determine the type of the target API according to the history records of the call to the target API and the historical return results. Specifically, it can compare whether multiple historical return results are always the same.
  • the target API is an API with a first preset type or a second preset type, and the return result of other APIs other than that has a greater correlation with the calling time, so it is not the target API and does not belong to the embodiment of this application Need to consider the scope.
  • Which target APIs are included can be determined by the service thread in multiple pending APIs, and then the determination result is sent to the thread where the application is located.
  • the service thread can also send the type of pending API to the thread where the application is located.
  • the thread where the program resides determines whether the API is the target API according to the type of API.
  • the service thread may be the thread where the system service is located.
  • the service thread may run in a separate thread, which is not limited again.
  • the first request instruction to the target API may be generated according to the user's operation on the terminal device, for example, the user starts the application operation, or clicks on the corresponding control when there is a query or use demand for the target service;
  • the first request instruction of the target API may also be automatically generated, for example, the information of the target service may be queried periodically, so the first request instruction is generated.
  • the target API to get the return result of the target API.
  • the application can query whether the current terminal device supports a certain function or feature.
  • the application can query whether the current terminal device supports the Bluetooth function by calling the pm.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH) function, and the returned result can be "yes" or "no”; the application can also be called by pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH) function, query whether the current device has a flash, the return result can be "yes" or "no”.
  • the application can make further operations according to the return result of the target API, for example, when the current terminal device supports the Bluetooth function, the Bluetooth function can be used.
  • the cache is the cache in the process where the application is located, so that the application can read the cache to obtain the return result of the target API without having to obtain it through inter-process communication; the cache here can also be the cache in the service process In this way, the process where the application is located can obtain the return result in the cache through inter-process communication with the service process, and the service process does not need to perform the action of obtaining the return result again.
  • the storage time of the returned result may also be recorded, for example, adding a timestamp to the returned result.
  • the return result is related to the time when the target API is called, that is, the longer the time from the call to the target API, the greater the possibility that the returned result will be invalid. Therefore, it can be
  • the target API sets valid time conditions. If the storage time of the returned result meets the valid time condition, the returned result is regarded as valid data; if the stored time of the returned result does not satisfy the valid time condition, the returned result is regarded as invalid data.
  • the storage time can be the time when the returned result is stored.
  • the storage time of the returned result that meets the valid time condition can be specifically that the storage time is later than the preset time; the storage time can also be the length of time the returned result is stored in the cache.
  • the length of time can be determined according to the current time information and the time information when the returned result is stored.
  • the storage time of the returned result meeting the valid time condition may be specifically that the storage time is shorter than the preset time.
  • an application can call the getProcessMemoryInfo interface to obtain the memory of the process where the application is located to detect whether the process has a memory leak. Therefore, the returned result does not change too much over time, and the time stamp can be added to the returned result. , In order to determine whether the data is within the validity period in use, so as to increase the validity of the data.
  • the invalid data in the cache can also be deleted, that is, when the type of the target API is the second preset type, it is determined whether the storage time of the return result of the target API meets the effective time If the condition is not met, the returned result is deleted.
  • the returned result is always valid, and the effective time condition can be any time.
  • the storage time of the returned result may not be recorded, and the target is the default The return result of the API is valid data.
  • the service process when it detects that the service information of the target service corresponding to the target API changes, it sends an update reminder to the process where the application is located, such as wireless network changes, turning off the screen, etc.
  • an update reminder When the information changes, you can send an update reminder to the process where the application is located, and the update reminder can be sent by broadcast.
  • the update reminder includes the identification of the target API, and the update reminder may also include service information of the target service corresponding to the target API.
  • the thread where the application resides may delete the return result of the target API in the cache, or, based on the service information of the target service in the update reminder, update the return result of the target API in the cache to Ensure that the returned result in the cache is valid data.
  • Android needs to repeatedly obtain storage information during the application startup process to determine whether the application data can be stored in a secure digital card (SD card) or internal storage device
  • SD card secure digital card
  • the service process can collect the storage information in real time, and send an update reminder to the process corresponding to the application when the storage information changes, so that the process where the application is located can delete or update the storage information in the cache.
  • the application can register with the service process, so that the service process can collect service information corresponding to the API related to the application.
  • the application can start a new thread when it is started, and send registration information to the service thread.
  • the registration information can include the application identification and callback function.
  • the service thread can determine which service information needs to be collected according to the application identifier. After detecting that the target service information corresponding to the target API related to the application has changed, it can send an update reminder to the thread where the application is located through a callback function.
  • the registration information may also include a user ID, and the service thread determines which service information needs to be collected based on the application ID and the user ID.
  • the second request instruction may be generated according to the user's operation on the terminal device or may be automatically generated.
  • the target API in response to the second request instruction to the target API, the target API is called again to obtain The corresponding return result of the target API, so that multiple calls to the same target API increase the load on the system.
  • the return result corresponding to the target API in response to the second request instruction, may be searched in the cache, thereby reducing the number of times the target API is called. If there is no return result corresponding to the target API in the cache, the target API can be called to obtain the return result corresponding to the target API.
  • the return result corresponding to the target API can find the return result corresponding to the target API and the storage time meeting the valid time condition in the cache. Specifically, you can directly search for the return result corresponding to the target API and the storage time meets the valid time condition; you can also first obtain the return result corresponding to the target API in the cache, and then determine whether the storage time of the obtained return result is satisfactory The valid time condition, if it is, the corresponding return result is found, if not, the return result can be deleted to improve the effective utilization of the cache.
  • the target API can be called to obtain the return result corresponding to the target API.
  • S101 may also be specifically: in response to the first request instruction to the target API, if there is no return result corresponding to the target API in the cache, the target API is called to obtain the return result corresponding to the target API.
  • the cache and the return result in the cache can be deleted.
  • a BinderDied call can be generated, and the service thread deletes the data related to the application, such as application callback information.
  • Tmall, Douyin, WeChat, CNTV v6.5.2 are pre-installed and installed on the mobile phone, stimulating the battlefield, Vipshop, Chedi, Tuniu Travel, Tencent Video, NetEase News 10 applications, and start 5 applications: Tmall, Douyin, WeChat, CNTV v6.5.2, stimulate the battlefield, will getPackageInfoAsUser (used to obtain the application package information), getPackageUidAsUser (used to obtain the application package Name), getApplicationInfoAsUser (for obtaining application information of the application), getVolumeList (for obtaining storage information of the current terminal device), getProcessMemoryInfo (for obtaining the memory of the process where the application is located), getDisplayInfo (for obtaining the terminal device's memory) Screen display information)
  • these five target API interfaces can be added to the following interface classes: ApplicationPackageManager, ApplicationPack
  • the embodiment of the present application provides a method for obtaining a result.
  • the target API is called to obtain the return result of the target API, and the target API and the corresponding return result are stored in the cache correspondingly.
  • the returned result corresponding to the target API can be searched in the cache. Because the application cache is in the thread where the application is located, the application can obtain the return result within the thread without calling the target API again to get the return result of the target API, which reduces the number of calls to the target API, thereby reducing System load, improve system performance.
  • FIG. 3 is a schematic diagram of a scenario embodiment in an embodiment of the present application.
  • the application starts.
  • BindApplication a new thread is started, the application program runs in the thread, and registration information is sent to the service process, and the registration information may include an application identification, a user identification, and a callback function.
  • the service thread determines the target API according to the thread ID and the user ID, notifies the application of the determination result according to the callback function, and starts to collect the service information of the target service corresponding to the target API.
  • the application program calls the target API to obtain the return result of the target API.
  • the application program can call the getVolumeList interface to obtain the storage information of the current terminal device.
  • the application program correspondingly stores the target API and the returned result in the cache. Specifically, you can first enable the caching mechanism of the getVolumeList interface in StorageManager.java, and then store the return result of the getVolumeList interface.
  • the application program In response to the second service request to the target API, the application program looks up the return result corresponding to the target API from the cache.
  • the service thread collects that the service information of the target service corresponding to the target API changes, and sends an update notification to the application. For example, after the user removes the SD card and the service thread collects that the storage information has changed, it can send an update notification to the thread where the application is located through the callback information of the application.
  • the application deletes the return result corresponding to the target API according to the update notification.
  • the application program calls the target API, obtains the return result of the target API, and stores the target API and the return result in the cache correspondingly.
  • the result obtaining apparatus 400 specifically corresponds to the function of the result obtaining method provided above.
  • the function can be realized by hardware, and can also be realized by hardware executing corresponding software.
  • the hardware or software includes one or more units corresponding to the above functions, and the unit may be software and/or hardware.
  • the device 400 may include:
  • the first calling unit 110 is configured to call the target API and obtain a return result of the target API in response to the first request instruction to the target API;
  • the storage unit 120 is configured to store the target API and the returned result correspondingly in the cache
  • the searching unit 130 is configured to search for the returned result corresponding to the target API in the cache in response to the second request instruction to the target API.
  • the search unit is specifically used to:
  • the device further includes:
  • the second calling unit is configured to call the target API to obtain the return result corresponding to the target API if the return result corresponding to the target API that meets the valid time condition does not exist in the cache.
  • the device further includes:
  • the first deleting unit is configured to delete the returned result corresponding to the target API in the cache that does not satisfy the valid time condition.
  • the type of the target API is the first preset type.
  • the device further includes:
  • the second deleting unit is configured to delete the returned result in the cache that does not meet the valid time condition.
  • the device further includes:
  • a target API determining unit configured to determine whether the API to be processed is a target API according to the type of the API to be processed, and the target API is a first preset type or a second preset type; the first preset type is characterized The multiple return results of the target API are different, and the difference between the multiple return results is less than or equal to a preset difference.
  • the second preset type indicates that the multiple return results of the target API are the same.
  • the device further includes:
  • the updating unit is configured to delete the return result corresponding to the target API in the cache when the service information of the target service corresponding to the target API changes, or, to the target API corresponding to the cache Return the result to update.
  • the first calling unit is specifically configured to:
  • the target API In response to the first request instruction to the target API, if the return result corresponding to the target API does not exist in the cache, the target API is called to obtain the return result corresponding to the target API.
  • the target API in response to a first request instruction to a target API, the target API is called to obtain the return result of the target API, and the target API and the return result are stored in the cache correspondingly. Therefore, In response to the second request instruction to the target API, the return result corresponding to the target API can be found in the cache without having to call the target API again to obtain the return result of the target API, which reduces the number of calls to the target API, thereby reducing the system load To improve system performance.
  • the result acquisition device 500 includes:
  • the receiver 501, the transmitter 502, the processor 503, and the memory 504 (wherein the number of the processor 503 in the device 500 for generating a message may be one or more, and one processor is taken as an example in FIG. 5).
  • the receiver 501, the transmitter 502, the processor 503, and the memory 504 may be connected through a bus or in other ways. In FIG. 5, connection through a bus is used as an example.
  • the memory 504 may include a read-only memory and a random access memory, and provide instructions and data to the processor 503. A portion of the memory 504 may also include NVRAM.
  • the memory 504 stores an operating system and operation instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, where the operation instructions may include various operation instructions for implementing various operations.
  • the operating system may include various system programs for implementing various basic services and processing hardware-based tasks.
  • the processor 503 controls the operation of the terminal device, and the processor 503 may also be referred to as a CPU.
  • each component of the device for generating a message is coupled together through a bus system.
  • the bus system may also include a power bus, a control bus, and a status signal bus.
  • various buses are called bus systems in the figure.
  • the method disclosed in the above embodiments of the present application may be applied to the processor 503 or implemented by the processor 503.
  • the processor 503 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware in the processor 503 or instructions in the form of software.
  • the foregoing processor 503 may be a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component.
  • the methods, steps, and logical block diagrams disclosed in the embodiments of the present application may be implemented or executed.
  • the general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied and executed by a hardware decoding processor, or may be executed and completed by a combination of hardware and software modules in the decoding processor.
  • the software module may be located in a random storage memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, and other mature storage media in the art.
  • the storage medium is located in the memory 504, and the processor 503 reads the information in the memory 504, and completes the steps of the above method in combination with its hardware.
  • the receiver 501 can be used to receive input digital or character information, and generate signal input related to user plane device related settings and function control.
  • the transmitter 502 can include a display device such as a display screen, and the transmitter 502 can be used to output through an external interface Number or character information.
  • the receiver 501 and the transmitter 502 are used to implement data transmission and reception.
  • the processor 503 is configured to transmit and receive data through the receiver 501 and the transmitter 502, and complete the result acquisition process performed by the foregoing result acquisition device.
  • Embodiments of the present application also provide a computer-readable storage medium for storing program code, and the program code is used to perform any one of the implementation methods in a result acquisition method of the foregoing embodiments.
  • Embodiments of the present application also provide a computer program product including instructions that, when run on a computer, cause the computer to execute any one of the method for obtaining a result of the foregoing embodiments.
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are only schematic.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical, or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or software function unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
  • the technical solution of the present application essentially or part of the contribution to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , Including several instructions to enable a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code .

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

Disclosed are a result acquisition method, apparatus and device for reducing the number of times a target API in a terminal device is invoked, reducing a system load, and improving the system performance. The method in the embodiments of the present application comprises: in response to a first request instruction for a target API, invoking the target API, so as to acquire a return result of the target API; and correspondingly storing the target API and the return result in a cache. Therefore, in response to a second request instruction for the target API, the return result corresponding to the target API can be searched for in the cache, without the need to invoke the target API again, in order to obtain the return result of the target API, so that the number of times the target API is invoked is reduced, thereby reducing the system load and improving the performance of the system.

Description

一种结果获取方法、装置及设备Method, device and equipment for obtaining results
本申请要求于2018年12月25日提交中国专利局、申请号为201811592873.0、发明名称为“一种结果获取方法、装置及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires the priority of the Chinese patent application filed on December 25, 2018 in the Chinese Patent Office with the application number 201811592873.0 and the invention titled "A method, device and equipment for obtaining results", the entire contents of which are incorporated herein by reference Applying.
技术领域Technical field
本申请涉及移动终端领域,尤其涉及一种结果获取方法、装置及设备。This application relates to the field of mobile terminals, and in particular, to a method, device, and device for obtaining results.
背景技术Background technique
通常来说,在终端系统中,为了保证数据的安全性,每个进程都是独立运行的,不能直接使用其他进程资源。但是在一些应用场景下,某进程会有使用其他进程资源的需求,例如服务进程可以为应用程序所在的进程提供服务,以使应用程序使用服务进程的资源,从而实现想要的功能,比如服务进程可以为应用程序提供终端的内存信息、硬盘信息等。Generally speaking, in the terminal system, in order to ensure the security of the data, each process runs independently and cannot directly use the resources of other processes. However, in some application scenarios, a process may need to use the resources of other processes, for example, a service process can provide services for the process where the application is located, so that the application can use the resources of the service process to achieve the desired function, such as service The process can provide terminal memory information, hard disk information, etc. for the application.
服务进程为应用程序所在的进程提供服务,可以通过进程间通信(inter-process communication,IPC)实现。具体的,可以预先为这些服务设置对应的应用程序编程接口(application programming interface,API),应用程序通过调用服务对应的API,即可使用该服务进程中的资源,从而实现想要的功能。The service process provides services for the process where the application is located, and can be implemented through inter-process communication (IPC). Specifically, corresponding application programming interfaces (APIs) can be set for these services in advance. The application can use the resources in the service process by calling the APIs corresponding to the services to achieve the desired functions.
终端系统与用户的交互通常较多,因此调用系统API以获取服务信息的次数也较多。但是频繁调用系统API会导致整个系统的负载增加,从而降低系统性能。The interaction between the terminal system and the user is usually more, so the system API is called more times to obtain service information. However, frequent calls to system APIs will increase the load on the entire system, thereby reducing system performance.
发明内容Summary of the invention
本申请实施例提供了一种结果获取方法、装置及设备,通过在缓存中存储目标API对应的返回结果,以减少目标API的调用次数,降低系统负载,提高系统性能。Embodiments of the present application provide a method, device, and device for obtaining a result. By storing a return result corresponding to a target API in a cache, the number of calls to the target API is reduced, system load is reduced, and system performance is improved.
本申请第一方面提供了一种结果获取方法,该方法包括:The first aspect of the present application provides a method for obtaining results. The method includes:
响应于对目标API的第一请求指令,调用所述目标API,获得所述目标API的返回结果;In response to the first request instruction to the target API, call the target API to obtain a return result of the target API;
在缓存中对应存储所述目标API和所述返回结果;Correspondingly storing the target API and the returned result in the cache;
响应于对所述目标API的第二请求指令,在所述缓存中查找与所述目标API对应的所述返回结果。In response to the second request instruction to the target API, look up the returned result corresponding to the target API in the cache.
在上述方法中,响应于对目标API的第一请求指令,调用目标API,从而获取目标API的返回结果,在缓存中对应存储目标API和返回结果,因此,响应于对目标API的第二请求指令,可以在缓存中查找与目标API对应的返回结果,而无需再次调用目标API以得到目标API的返回结果,减少了目标API的调用次数,从而降低系统负载,提高系统性能。In the above method, in response to the first request instruction to the target API, the target API is called to obtain the return result of the target API, and the target API and the return result are stored in the cache correspondingly, therefore, in response to the second request to the target API Instruction, you can find the return result corresponding to the target API in the cache, without having to call the target API again to get the return result of the target API, reducing the number of calls to the target API, thereby reducing system load and improving system performance.
在一些可能的实施方式中,所述在所述缓存中查找与所述目标API对应的所述返回结果,包括:In some possible implementation manners, the searching the cache for the returned result corresponding to the target API includes:
在所述缓存中查找与所述目标API对应的满足有效时间条件的所述返回结果。Searching in the cache for the returned result corresponding to the target API and satisfying the valid time condition.
在缓存中查找到的目标API对应的返回结果是满足有效时间条件的,因此,返回结果是有效的结果,从而提高返回结果的准确性。The returned result corresponding to the target API found in the cache satisfies the valid time condition. Therefore, the returned result is a valid result, thereby improving the accuracy of the returned result.
在一些可能的实施方式中,所述方法还包括:In some possible implementations, the method further includes:
若所述缓存中不存在与所述目标API对应的满足有效时间条件的所述返回结果,则调用所述目标API,获取所述目标API对应的返回结果。If there is no return result corresponding to the target API satisfying the valid time condition in the cache, the target API is called to obtain the return result corresponding to the target API.
在缓存中不存在目标API对应的返回结果,或者在缓存中的目标API对应的返回结果不满足时间条件在,则认为缓存中不存在与目标API对应的满足有效时间条件的返回结果,需要对返回结果进行重新获取,因此可以再次调用目标API,以满足用户需求。If there is no return result corresponding to the target API in the cache, or the return result corresponding to the target API in the cache does not meet the time condition, it is considered that there is no return result corresponding to the target API that meets the valid time condition in the cache. The results are returned for reacquisition, so the target API can be called again to meet user needs.
在一些可能的实施方式中,所述方法还包括:In some possible implementations, the method further includes:
删除所述缓存中与所述目标API对应的不满足有效时间条件的所述返回结果。Deleting the returned result corresponding to the target API in the cache that does not meet the valid time condition.
在查找到目标API对应的返回结果后,可以删除不满足有效时间条件的返回结果,以节省存储空间。After finding the return result corresponding to the target API, you can delete the return result that does not meet the valid time condition to save storage space.
在一些可能的实施方式中,所述目标API的类型为第一预设类型。In some possible implementations, the type of the target API is the first preset type.
第一预设类型表征目标API的返回结果与时间相关,但是多次返回结果之间相差不大,因此,可以判断目标API对应的返回结果是否满足有效时间条件,若是,则说明返回结果有效,若不是,则认为返回结果无效。The first preset type indicates that the return result of the target API is related to time, but the difference between multiple return results is not large. Therefore, it can be determined whether the return result corresponding to the target API meets the valid time condition. If it is, it means that the return result is valid. If not, the returned result is considered invalid.
在一些可能的实施方式中,所述方法还包括:In some possible implementations, the method further includes:
删除所述缓存中不满足有效时间条件的所述返回结果。Deleting the returned result in the cache that does not meet the valid time condition.
为了对缓存进行有效管理,可以将不满足有效时间条件的返回结果删除,以便节省存储空间,以及返回结果的查找效率。In order to effectively manage the cache, you can delete the returned results that do not meet the valid time condition, so as to save storage space and the efficiency of the search for returned results.
在一些可能的实施方式中,所述方法还包括:In some possible implementations, the method further includes:
根据待处理API的类型,确定所述待处理API是否为目标API,所述目标API为第一预设类型或第二预设类型;所述第一预设类型表征所述目标API的多次返回结果不同,且多次返回结果的差值小于或等于预设差值,所述第二预设类型表征所述目标API的多次返回结果相同。According to the type of the to-be-processed API, determine whether the to-be-processed API is a target API, and the target API is a first preset type or a second preset type; the first preset type represents multiple times of the target API The return results are different, and the difference between the multiple return results is less than or equal to a preset difference, and the second preset type indicates that the multiple return results of the target API are the same.
目标API是待处理API中具有特定类型的,例如为第一预设类型或第二预设类型,则可以对目标API对应的返回结果进行存储,以减少目标API的调用次数。The target API is of a specific type in the to-be-processed API, such as the first preset type or the second preset type, and the returned result corresponding to the target API can be stored to reduce the number of times the target API is called.
在一些可能的实施方式中,所述方法还包括:In some possible implementations, the method further includes:
在所述目标API对应的目标服务的服务信息有变化时,删除所述缓存中的所述目标API对应的返回结果,或,对所述缓存中的所述目标API对应的返回结果进行更新。When the service information of the target service corresponding to the target API changes, delete the return result corresponding to the target API in the cache, or update the return result corresponding to the target API in the cache.
目标API对应的返回结果还可以根据服务信息而被删除或被更新,以使目标API对应的返回结果更加准确。The return result corresponding to the target API can also be deleted or updated according to the service information, so that the return result corresponding to the target API is more accurate.
在一些可能的实施方式中,所述响应于对目标API的第一请求指令,调用所述目标API,获得所述目标API的返回结果,包括:In some possible implementation manners, the responding to the first request instruction to the target API, invoking the target API, and obtaining a return result of the target API includes:
响应于对所述目标API的第一请求指令,若所述缓存中不存在与所述目标API对应的所述返回结果,则调用所述目标API,获取所述目标API对应的返回结果。In response to the first request instruction to the target API, if the return result corresponding to the target API does not exist in the cache, the target API is called to obtain the return result corresponding to the target API.
响应于对目标API的第一请求指令,可以先查找目标API对应的返回结果,若缓存中不存在,再进行目标API的调用,以减少目标API的调用次数。In response to the first request instruction to the target API, the return result corresponding to the target API may be searched first, and if the cache does not exist, then the target API is called to reduce the number of times the target API is called.
本申请实施例第二方面提供了一种结果获取装置,所述装置包括:A second aspect of an embodiment of the present application provides an apparatus for obtaining results. The apparatus includes:
第一调用单元,用于响应于对目标API的第一请求指令,调用所述目标API,获得所述目标API的返回结果;A first calling unit, configured to call the target API in response to a first request instruction to the target API, and obtain a return result of the target API;
存储单元,用于在缓存中对应存储所述目标API和所述返回结果;A storage unit, configured to store the target API and the returned result correspondingly in the cache;
查找单元,用于响应于对所述目标API的第二请求指令,在所述缓存中查找与所述目标API对应的所述返回结果。The searching unit is configured to search for the returned result corresponding to the target API in the cache in response to the second request instruction to the target API.
在一些可能的实施方式中,所述查找单元具体用于:In some possible implementations, the search unit is specifically used to:
响应于对所述目标API的第二请求指令,在所述缓存中查找与所述目标API对应的满足有效时间条件的所述返回结果。In response to the second request instruction to the target API, search the cache for the return result corresponding to the target API that satisfies the valid time condition.
在一些可能的实施方式中,所述装置还包括:In some possible implementations, the device further includes:
第二调用单元,用于若所述缓存中不存在与所述目标API对应的满足有效时间条件的所述返回结果,则调用所述目标API,获取所述目标API对应的返回结果。The second calling unit is configured to call the target API to obtain the return result corresponding to the target API if the return result corresponding to the target API that meets the valid time condition does not exist in the cache.
在一些可能的实施方式中,所述装置还包括:In some possible implementations, the device further includes:
第一删除单元,用于删除所述缓存中与所述目标API对应的不满足有效时间条件的所述返回结果。The first deleting unit is configured to delete the returned result corresponding to the target API in the cache that does not satisfy the valid time condition.
在一些可能的实施方式中,所述目标API的类型为第一预设类型。In some possible implementations, the type of the target API is the first preset type.
在一些可能的实施方式中,所述装置还包括:In some possible implementations, the device further includes:
第二删除单元,用于删除所述缓存中不满足有效时间条件的所述返回结果。The second deleting unit is configured to delete the returned result in the cache that does not meet the valid time condition.
在一些可能的实施方式中,所述装置还包括:In some possible implementations, the device further includes:
目标API确定单元,用于根据待处理API的类型,确定所述待处理API是否为目标API,所述目标API为第一预设类型或第二预设类型;所述第一预设类型表征所述目标API的多次返回结果不同,且多次返回结果的差值小于或等于预设差值,所述第二预设类型表征所述目标API的多次返回结果相同。A target API determining unit, configured to determine whether the API to be processed is a target API according to the type of the API to be processed, and the target API is a first preset type or a second preset type; the first preset type is characterized The multiple return results of the target API are different, and the difference between the multiple return results is less than or equal to a preset difference. The second preset type indicates that the multiple return results of the target API are the same.
在一些可能的实施方式中,所述装置还包括:In some possible implementations, the device further includes:
更新单元,用于在所述目标API对应的目标服务的服务信息有变化时,删除所述缓存中的所述目标API对应的返回结果,或,对所述缓存中的所述目标API对应的返回结果进行更新。The updating unit is configured to delete the return result corresponding to the target API in the cache when the service information of the target service corresponding to the target API changes, or, to the target API corresponding to the cache Return the result to update.
在一些可能的实施方式中,所述第一调用单元具体用于:In some possible implementation manners, the first calling unit is specifically configured to:
响应于对所述目标API的第一请求指令,若所述缓存中不存在与所述目标API对应的所述返回结果,则调用所述目标API,获取所述目标API对应的返回结果。In response to the first request instruction to the target API, if the return result corresponding to the target API does not exist in the cache, the target API is called to obtain the return result corresponding to the target API.
本申请实施例第三方面提供了一种结果获取设备,所述设备包括处理器和存储器;A third aspect of the embodiments of the present application provides a result acquisition device, where the device includes a processor and a memory;
所述存储器,用于存储指令;The memory is used to store instructions;
所述处理器,用于执行所述存储器中的所述指令,执行本申请实施例第一方面提供的一种结果获取方法。The processor is configured to execute the instructions in the memory and execute a method for obtaining results provided in the first aspect of the embodiments of the present application.
本申请实施例第四方面提供了一种计算机可读存储介质,包括指令,当其在计算机上运行时,使得计算机本申请实施例第一方面提供的一种结果获取方法。A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, including instructions, which when executed on a computer, causes the computer to obtain a result acquisition method provided by the first aspect of the embodiment of the present application.
本申请实施例第五方面提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机本申请实施例第一方面提供的一种结果获取方法。A fifth aspect of an embodiment of the present application provides a computer program product containing instructions, which, when run on a computer, causes the computer to obtain a result acquisition method provided by the first aspect of the embodiment of the present application.
从以上技术方案可以看出,本申请实施例具有以下优点:It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
在本申请实施例提供的一种结果获取方法、装置及设备中,响应于对目标API的第一请求指令,调用目标API,从而获取目标API的返回结果,在缓存中对应存储目标API和返回结果,因此,响应于对目标API的第二请求指令,可以在缓存中查找与目标API对应的返回结果,而无需再次调用目标API以得到目标API的返回结果,减少了目标API的调用次数,从而降低系统负载,提高系统性能。In a method, device and device for obtaining a result provided by an embodiment of the present application, in response to the first request instruction to the target API, the target API is called to obtain the return result of the target API, and the target API and the return are correspondingly stored in the cache As a result, therefore, in response to the second request instruction to the target API, the return result corresponding to the target API can be found in the cache without calling the target API again to get the return result of the target API, reducing the number of calls to the target API, Thereby reducing system load and improving system performance.
附图说明BRIEF DESCRIPTION
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。In order to more clearly explain the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required in the description of the embodiments. Obviously, the drawings in the following description are only some of the implementations described in the present application For example, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
图1为现有技术中的一种获取结果的信息交互示意图;FIG. 1 is a schematic diagram of information interaction for obtaining results in the prior art;
图2为本申请实施例中一种结果获取方法的流程图;2 is a flowchart of a method for obtaining results in an embodiment of the present application;
图3为本申请实施例中一种场景实施例的示意图;FIG. 3 is a schematic diagram of a scenario embodiment in an embodiment of the present application;
图4为本申请实施例中一种结果获取装置的结构框图;4 is a structural block diagram of an apparatus for obtaining results in an embodiment of the present application;
图5为本申请实施例中一种结果获取设备的结构框图。FIG. 5 is a structural block diagram of a result acquisition device in an embodiment of this application.
具体实施方式detailed description
本申请实施例提供了一种结果获取方法、装置及设备,用于减少终端设备中目标API的调用次数,降低系统负载,提高系统性能。Embodiments of the present application provide a method, device, and device for obtaining results, which are used to reduce the number of target API calls in a terminal device, reduce system load, and improve system performance.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of this application and the above drawings are used to distinguish similar objects without using To describe a specific order or sequence. It should be understood that the data so used can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in an order other than what is illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, processes, methods, systems, products or devices that contain a series of steps or units are not necessarily limited to those clearly listed Those steps or units, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or equipment.
在终端系统中,为了保证数据的安全性,每个进程都是独立运行的,不能直接使用其他进程的资源,因此,服务进程为应用程序所在的进程提供服务,可以通过进程间通信实 现。具体的,可以预先为服务设置对应的API,应用程序调用API,即可使用该服务进程中相应的资源,从而实现想要的功能。例如应用程序可以调用系统API,获取终端的内存、硬盘、是否支持蓝牙、是否支持闪光灯等信息。然而,随着移动智能终端功能的不断丰富,终端系统与用户的交互也越来越多,应用程序调用系统API以获取服务信息的次数也越来越多,而频繁调用系统API会导致整个系统的负载增加,从而使系统性能下降,进而导致终端设备耗电严重以及卡顿等,影响用户使用。In the terminal system, in order to ensure the security of the data, each process runs independently and cannot directly use the resources of other processes. Therefore, the service process provides services for the process where the application is located, and can be realized through inter-process communication. Specifically, the corresponding API can be set for the service in advance, and the application program can call the API to use the corresponding resource in the service process to achieve the desired function. For example, an application can call the system API to obtain information such as the terminal's memory, hard disk, whether it supports Bluetooth, and whether it supports flash. However, with the continuous enrichment of mobile smart terminal functions, the interaction between terminal systems and users is increasing, and the number of times applications call system APIs to obtain service information, and frequent calls to system APIs will cause the entire system The load of the system increases, which degrades the performance of the system, which in turn leads to serious power consumption of the terminal equipment and stuck, which affects the user's use.
现有的终端系统中,在应用程序使用过程中,存在应用程序重复调用API的情况。参考图1所示,为现有技术中一种获取结果的信息交互示意图,应用程序可以进行三次API的调用,向系统服务发送三次信息查询请求,对应于每次信息查询请求,系统服务获取查询结果并返回给应用程序,这里的信息查询请求可以是查询终端设备是否支持某项功能,比如蓝牙功能、闪光灯功能等。然而,一些返回结果可能与时间无关,也就是说,三次调用API的过程是一样的,系统服务返回的查询结果也是一样的,因此,进行三次API的调用是完全没有必要的,造成了不必要的资源浪费。In the existing terminal system, in the process of using the application program, the application program may repeatedly call the API. Referring to FIG. 1, which is a schematic diagram of information interaction for obtaining results in the prior art, an application can make three API calls and send three information query requests to a system service. Corresponding to each information query request, the system service obtains a query The result is returned to the application. The information query request here may be to query whether the terminal device supports a certain function, such as the Bluetooth function and the flash function. However, some of the returned results may not be related to time, that is to say, the process of calling the API three times is the same, and the query results returned by the system service are also the same. Therefore, making three API calls is completely unnecessary, resulting in unnecessary Waste of resources.
基于以上技术问题,本申请实施例提供了一种结果获取方法、装置及设备,在响应于对目标API的第一请求指令时,调用目标API,获取目标API的返回结果,在缓存中对应存储目标API和对应的返回结果,因此,响应于对目标API的第二请求指令,可以在缓存中查找与目标API对应的返回结果,而无需再次调用目标API以得到目标API的返回结果,减少了目标API的调用次数,从而降低系统负载,提高系统性能。也就是说,对应于图1所示的三次信息查询请求,最优的结果就是,只要在需要进行第一次信息查询时,调用一次目标API,得到返回结果,则可以在之后的两次信息查询中,从缓存中获取相应的返回结果,大大减少了目标API的调用次数。Based on the above technical problems, the embodiments of the present application provide a method, device and device for obtaining a result. When responding to the first request instruction to the target API, the target API is called to obtain the return result of the target API and stored in the cache correspondingly The target API and the corresponding return result. Therefore, in response to the second request instruction to the target API, the return result corresponding to the target API can be found in the cache without having to call the target API again to obtain the return result of the target API. The number of target API calls to reduce system load and improve system performance. In other words, corresponding to the three information query requests shown in Figure 1, the optimal result is that as long as the first information query is required, the target API is called once and the returned result is obtained. During the query, the corresponding return result is obtained from the cache, which greatly reduces the number of calls to the target API.
参考图2所示,图2为本申请实施例中一种结果获取方法的流程图。下面对本申请实施例提供的结果获取方法进行具体的示例性说明。Referring to FIG. 2, FIG. 2 is a flowchart of a method for obtaining results in an embodiment of the present application. The following specifically describes the method for obtaining results provided by the embodiments of the present application.
S101,响应于对目标API的第一请求指令,调用目标API,获得目标API的返回结果。S101: In response to the first request instruction to the target API, call the target API to obtain a return result of the target API.
目标API是对应于目标服务的,可以是操作系统或服务提供厂商提供的预先定义好的函数,应用程序可以调用API,在没有目标服务的源码或不了解内部原理的情况下获取目标服务所在的进程中的资源。The target API corresponds to the target service. It can be a predefined function provided by the operating system or service provider. The application can call the API to obtain the target service without the source code of the target service or without understanding the internal principles. Resources in the process.
举例来说,在Android系统中,可以通过Binder实现进程间通信,安卓系统框架(Android framework)本身可以提供一系列的系统服务,并提供Java/C++的API来调用这些服务。因此,可以通过调用API,基于Binder机制将查询请求从应用程序所在的进程传输至服务进程,在服务进程获取到相应的查询结果后,再通过Binder机制将查询结果返回至应用程序所在的进程。For example, in the Android system, inter-process communication can be achieved through Binder. The Android framework itself can provide a series of system services and provide Java/C++ APIs to call these services. Therefore, you can transfer the query request from the process where the application is located to the service process based on the Binder mechanism by calling the API. After the service process obtains the corresponding query result, the query result is returned to the process where the application is located through the Binder mechanism.
在本申请实施例中,目标API可以为第一预设类型。其中,第一预设类型表征目标API的返回结果与时间相关,但是多次返回结果之间相差不大,即调用目标API的时间不同,返回结果的差值小于或等于预设差值,例如移动终端的定位功能,在调用目标API的时间差距不大时,移动终端所处的位置差距也较小。In the embodiment of the present application, the target API may be the first preset type. The first preset type indicates that the return result of the target API is related to time, but the difference between multiple return results is not large, that is, the time to call the target API is different, and the difference between the return results is less than or equal to the preset difference, for example For the positioning function of the mobile terminal, when the time gap for calling the target API is not large, the location gap of the mobile terminal is also small.
目标API是否为第一预设类型,可以由目标API对应的目标服务的提供商预先设定, 也可以由操作系统开发人员预先设定,还可以由终端设备自动判断。其中,终端设备可以根据调用目标API的历史记录和历史返回结果确定目标API的类型,具体的,可以比较多次调用目标API的时间,以及比较对应于多次调用目标API后获取的历史返回结果,若历史返回结果变化速率小于或等于预设速率,则目标API具有第一预设类型。Whether the target API is the first preset type may be preset by the provider of the target service corresponding to the target API, or may be preset by an operating system developer, or may be automatically determined by the terminal device. Among them, the terminal device can determine the type of the target API according to the historical record of the target API call and the historical return result. Specifically, it can compare the time of calling the target API multiple times, and compare the historical return results obtained after multiple calls to the target API. If the change rate of the historical return result is less than or equal to the preset rate, the target API has the first preset type.
需要说明的是,终端设备根据调用目标API的历史记录和历史返回结果确定目标API的类型,还可以参考终端设备当前的场景,例如用户在步行时,终端设备所处的位置在短时间内差距较小,此时,可以认为定位功能对应的API可以是第一预设类型,但是终端设备在移动速度较快的交通工具上时,短时间内的差距较大,则不能认为定位功能对应的API是第一预设类型。终端设备的当前场景可以根据终端设备的传感器的信息得到。It should be noted that the terminal device determines the type of the target API according to the historical records and historical return results of calling the target API, and can also refer to the current scene of the terminal device, for example, when the user is walking, the location of the terminal device is within a short time gap Small, at this time, it can be considered that the API corresponding to the positioning function can be the first preset type, but when the terminal device is on a vehicle with a fast moving speed, the gap in a short time is large, then the corresponding function of the positioning function cannot be considered API is the first preset type. The current scene of the terminal device can be obtained according to the information of the sensor of the terminal device.
在本申请实施例中,目标API也可以为第二预设类型。第二预设类型表征目标API的返回结果与时间无关,即目标API的多次返回结果始终是相同的。In the embodiment of the present application, the target API may also be the second preset type. The second preset type indicates that the return result of the target API is independent of time, that is, the multiple return results of the target API are always the same.
目标API是否为第二预设类型,可以由目标API对应的目标服务的提供商预先设定,也可以由操作系统开发人员预先设定,还可以由终端设备自动判断。其中,终端设备可以根据调用目标API的历史记录和历史返回结果确定目标API的类型,具体的,可以比较多个历史返回结果是否一直相同。Whether the target API is the second preset type may be preset by the provider of the target service corresponding to the target API, or may be preset by the operating system developer, or may be automatically determined by the terminal device. The terminal device can determine the type of the target API according to the history records of the call to the target API and the historical return results. Specifically, it can compare whether multiple historical return results are always the same.
也就是说,目标API是具有第一预设类型或第二预设类型的API,除此之外的其他API的返回结果与调用时间关联较大,因此不是目标API,不属于本申请实施例需要考虑的范围。目标API包括哪些,可以通过服务线程在多个待处理API中确定,再向应用程序所在的线程发送确定结果,当然,服务线程也可以向应用程序所在的线程发送待处理API的类型,由应用程序所在的线程根据API的类型确定该API是否为目标API。That is to say, the target API is an API with a first preset type or a second preset type, and the return result of other APIs other than that has a greater correlation with the calling time, so it is not the target API and does not belong to the embodiment of this application Need to consider the scope. Which target APIs are included can be determined by the service thread in multiple pending APIs, and then the determination result is sent to the thread where the application is located. Of course, the service thread can also send the type of pending API to the thread where the application is located. The thread where the program resides determines whether the API is the target API according to the type of API.
本申请实施例中,服务线程可以是系统服务所在线程,当然,为了不影响其他模块,服务线程可以在独立的线程中运行,再次不做限定。In the embodiment of the present application, the service thread may be the thread where the system service is located. Of course, in order not to affect other modules, the service thread may run in a separate thread, which is not limited again.
对目标API的第一请求指令可以是根据用户对终端设备的操作生成的,例如用户启动应用程序的操作,或者在对目标服务有查询的需求或使用的需求时点击相应的控件的操作;对目标API的第一请求指令也可以是自动生成的,例如可以定期对目标服务的信息进行查询,因此生成第一请求指令。The first request instruction to the target API may be generated according to the user's operation on the terminal device, for example, the user starts the application operation, or clicks on the corresponding control when there is a query or use demand for the target service; The first request instruction of the target API may also be automatically generated, for example, the information of the target service may be queried periodically, so the first request instruction is generated.
调用目标API,可以获得目标API的返回结果。以Android系统为例,通过调用hasSystemFeature函数,可以获取当前终端设备是否支持某种功能或特性。作为一种实例,应用程序可以通过调用pm.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)函数,查询当前终端设备是否支持蓝牙功能,返回结果可以为“是”,也可以为“否”;应用程序也可以通过调用pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)函数,查询当前设备是否有闪光灯,返回结果可以为“是”,也可以为“否”。Call the target API to get the return result of the target API. Taking the Android system as an example, by calling the hasSystemFeature function, you can obtain whether the current terminal device supports a certain function or feature. As an example, the application can query whether the current terminal device supports the Bluetooth function by calling the pm.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH) function, and the returned result can be "yes" or "no"; the application can also be called by pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH) function, query whether the current device has a flash, the return result can be "yes" or "no".
应用程序可以根据目标API的返回结果,做出进一步的操作,例如在当前终端设备支持蓝牙功能时,可以使用蓝牙功能等。The application can make further operations according to the return result of the target API, for example, when the current terminal device supports the Bluetooth function, the Bluetooth function can be used.
S102,在缓存中对应存储目标API和返回结果。S102, correspondingly store the target API and the returned result in the cache.
在获得目标API的返回结果后,可以在缓存中对应存储目标API和返回结果。这里的缓存是应用程序所在的进程中的缓存,这样,应用程序可以通过读取缓存来获取目标API 的返回结果,而不必通过进程间通信来获取;这里的缓存也可以是服务进程中的缓存,这样,应用程序所在的进程可以与服务进程通过进程间通信获取缓存中的返回结果,服务进程不需要再次执行获取返回结果的动作。After the return result of the target API is obtained, the target API and the return result can be stored in the cache correspondingly. The cache here is the cache in the process where the application is located, so that the application can read the cache to obtain the return result of the target API without having to obtain it through inter-process communication; the cache here can also be the cache in the service process In this way, the process where the application is located can obtain the return result in the cache through inter-process communication with the service process, and the service process does not need to perform the action of obtaining the return result again.
在对应存储目标API和返回结果时,若目标API的类型为第二预设类型,则还可以记录返回结果的存储时间,例如为返回结果增加时间戳。这是因为目标API的类型为第二预设类型时,返回结果与调用目标API的时间相关,也就是说,距离调用目标API的时间越久,返回结果失效的可能性越大,因此,可以为目标API设置有效时间条件。若返回结果的存储时间满足有效时间条件,则将该返回结果视为有效数据;若返回结果的存储时间不满足有效时间条件,则将该返回结果视为无效数据。When correspondingly storing the target API and the returned result, if the type of the target API is the second preset type, the storage time of the returned result may also be recorded, for example, adding a timestamp to the returned result. This is because when the type of the target API is the second preset type, the return result is related to the time when the target API is called, that is, the longer the time from the call to the target API, the greater the possibility that the returned result will be invalid. Therefore, it can be The target API sets valid time conditions. If the storage time of the returned result meets the valid time condition, the returned result is regarded as valid data; if the stored time of the returned result does not satisfy the valid time condition, the returned result is regarded as invalid data.
存储时间可以是对返回结果进行存储时候的时间,则返回结果的存储时间满足有效时间条件可以具体为,存储时间晚于预设时刻;存储时间也可以是返回结果在缓存中存储的时长,存储的时长可以根据当前时间信息和对返回结果进行存储时候的时间信息确定,则返回结果的存储时间满足有效时间条件可以具体为,存储时间短于预设时长。The storage time can be the time when the returned result is stored. The storage time of the returned result that meets the valid time condition can be specifically that the storage time is later than the preset time; the storage time can also be the length of time the returned result is stored in the cache. The length of time can be determined according to the current time information and the time information when the returned result is stored. The storage time of the returned result meeting the valid time condition may be specifically that the storage time is shorter than the preset time.
例如,应用程序可以调用getProcessMemoryInfo接口,用于获取应用程序所在的进程的内存,从而检测该进程是否有内存泄露,因此,返回的结果随时间的变化范围不太大,可以为返回结果增加时间戳,以便在使用时判断该数据是否在有效期内,以增加数据的有效性。For example, an application can call the getProcessMemoryInfo interface to obtain the memory of the process where the application is located to detect whether the process has a memory leak. Therefore, the returned result does not change too much over time, and the time stamp can be added to the returned result. , In order to determine whether the data is within the validity period in use, so as to increase the validity of the data.
在本申请实施例中,为了提高缓存的利用率,还可以删除缓存中的无效数据,即在目标API的类型为第二预设类型时,判断目标API的返回结果的存储时间是否满足有效时间条件,若不满足,则删除该返回结果。In the embodiment of the present application, in order to improve the utilization rate of the cache, the invalid data in the cache can also be deleted, that is, when the type of the target API is the second preset type, it is determined whether the storage time of the return result of the target API meets the effective time If the condition is not met, the returned result is deleted.
可以理解的是,若目标API的类型为第一预设类型,则认为返回结果始终有效,其有效时间条件可以是任意时间,当然,也可以不进行返回结果的存储时间的记录,默认该目标API的返回结果为有效数据。It can be understood that if the type of the target API is the first preset type, the returned result is always valid, and the effective time condition can be any time. Of course, the storage time of the returned result may not be recorded, and the target is the default The return result of the API is valid data.
此外,为了提高目标API的返回结果的准确性,服务进程在检测到目标API对应的目标服务的服务信息有变化时,向应用程序所在的进程发送更新提醒,例如无线网络变化,亮灭屏等信息有变化时,可以向应用程序所在的进程发送更新提醒,更新提醒的发送方式可以是广播。更新提醒中包括目标API的标识,更新提醒中还可以有目标API对应的目标服务的服务信息。本申请实施例中,应用程序所在的线程响应于更新提醒,可以删除缓存中目标API的返回结果,或者,根据更新提醒中目标服务的服务信息,对缓存中目标API的返回结果进行更新,以保证缓存中的返回结果是有效的数据。In addition, in order to improve the accuracy of the return result of the target API, when the service process detects that the service information of the target service corresponding to the target API changes, it sends an update reminder to the process where the application is located, such as wireless network changes, turning off the screen, etc. When the information changes, you can send an update reminder to the process where the application is located, and the update reminder can be sent by broadcast. The update reminder includes the identification of the target API, and the update reminder may also include service information of the target service corresponding to the target API. In the embodiment of the present application, in response to the update reminder, the thread where the application resides may delete the return result of the target API in the cache, or, based on the service information of the target service in the update reminder, update the return result of the target API in the cache to Ensure that the returned result in the cache is valid data.
举例来说,Android在实现应用程序启动过程中需要重复多次获取存储信息,以此判断该应用程序的数据是否可以存放在安全数码卡(secure digital memory card,SD卡)中或者内部的存储设备中,在用户插拔SD卡时,存储信息会发生变化。因此,服务进程可以对存储信息进行实时采集,在发现存储信息发生变化时,向应用程序对应的进程发送更新提醒,以使应用程序所在的进程对缓存中的存储信息进行删除或更新。For example, Android needs to repeatedly obtain storage information during the application startup process to determine whether the application data can be stored in a secure digital card (SD card) or internal storage device In, when the user inserts or removes the SD card, the storage information will change. Therefore, the service process can collect the storage information in real time, and send an update reminder to the process corresponding to the application when the storage information changes, so that the process where the application is located can delete or update the storage information in the cache.
为了实现服务进行对应用程序所在进程的更新提醒,在应用程序启动时,可以向服务进程注册,以使服务进程对应用程序相关的API对应的服务信息进行采集。具体的,应用 程序在启动时可以开启一个新线程,并向服务线程发送注册信息,注册信息可以包括应用程序标识和回调函数。服务线程可以根据应用程序标识判断需要采集哪些服务信息,在检测到于该应用程序相关的目标API对应的目标服务信息发生了改变后,可以通过回调函数向应用程序所在的线程发送更新提醒。In order to realize the service to update the process of the application, when the application is started, you can register with the service process, so that the service process can collect service information corresponding to the API related to the application. Specifically, the application can start a new thread when it is started, and send registration information to the service thread. The registration information can include the application identification and callback function. The service thread can determine which service information needs to be collected according to the application identifier. After detecting that the target service information corresponding to the target API related to the application has changed, it can send an update reminder to the thread where the application is located through a callback function.
当然,为了向用户提供个性化的服务,注册信息中还可以包括用户标识,服务线程根据应用程序标识和用户标识判断需要采集哪些服务信息。Of course, in order to provide users with personalized services, the registration information may also include a user ID, and the service thread determines which service information needs to be collected based on the application ID and the user ID.
S103,响应于对目标API的第二请求指令,在缓存中查找与目标API对应的返回结果。S103: In response to the second request instruction to the target API, search for a return result corresponding to the target API in the cache.
与第一请求指令类似,第二请求指令可以是根据用户对终端设备的操作生成的,也可以是自动生成的,现有技术响应于对目标API的第二请求指令,再次调用目标API以获得目标API对应的返回结果,这样,对同一目标API的多次调用,使系统的负载增加。Similar to the first request instruction, the second request instruction may be generated according to the user's operation on the terminal device or may be automatically generated. In the prior art, in response to the second request instruction to the target API, the target API is called again to obtain The corresponding return result of the target API, so that multiple calls to the same target API increase the load on the system.
而本申请实施例中,响应于第二请求指令,可以在缓存中查找与目标API对应的返回结果,从而减少调用目标API的次数。若缓存中不存在与目标API对应的返回结果,则可以调用目标API,以获得目标API对应的返回结果。In the embodiment of the present application, in response to the second request instruction, the return result corresponding to the target API may be searched in the cache, thereby reducing the number of times the target API is called. If there is no return result corresponding to the target API in the cache, the target API can be called to obtain the return result corresponding to the target API.
在目标API对应的返回结果对应有存储时间,则可以在缓存中查找与目标API对应的、且存储时间满足有效时间条件的返回结果。具体的,可以直接进行查找与目标API对应的、且存储时间满足有效时间条件的返回结果;也可以先获取缓存中与目标API对应的返回结果,再判断获取到的返回结果的存储时间是否满足有效时间条件,若是,则查找到相应的返回结果,若否,则可以删除该返回结果,以提高缓存的有效利用率。If there is a storage time corresponding to the return result corresponding to the target API, you can find the return result corresponding to the target API and the storage time meeting the valid time condition in the cache. Specifically, you can directly search for the return result corresponding to the target API and the storage time meets the valid time condition; you can also first obtain the return result corresponding to the target API in the cache, and then determine whether the storage time of the obtained return result is satisfactory The valid time condition, if it is, the corresponding return result is found, if not, the return result can be deleted to improve the effective utilization of the cache.
若在缓存中不存在与目标API对应的、且存储时间满足有效时间条件的返回结果,则认为没有查找到有效的返回结果,则可以调用目标API,以获得目标API对应的返回结果。If there is no return result corresponding to the target API in the cache and the storage time meets the valid time condition, it is considered that no valid return result is found, and the target API can be called to obtain the return result corresponding to the target API.
基于以上技术方案,S101也可以具体为:响应于对目标API的第一请求指令,若缓存中不存与目标API对应的返回结果,则调用目标API,获取目标API对应的返回结果。Based on the above technical solution, S101 may also be specifically: in response to the first request instruction to the target API, if there is no return result corresponding to the target API in the cache, the target API is called to obtain the return result corresponding to the target API.
在应用程序关闭后,可以删除缓存以及缓存中的返回结果,同时,可以产生BinderDied调用,服务线程删除该应用程序相关的数据,例如应用程序回调信息。After the application is closed, the cache and the return result in the cache can be deleted. At the same time, a BinderDied call can be generated, and the service thread deletes the data related to the application, such as application callback information.
基于以上技术方案,本申请进行了实际测试,在手机中预先安装安装天猫、抖音、微信、CNTV v6.5.2、刺激战场、唯品会、懂车帝、途牛旅游、腾讯视频、网易新闻10个应用,并启动5个应用程序:天猫、抖音、微信、CNTV v6.5.2、刺激战场,将getPackageInfoAsUser(用于获取应用程序的包信息)、getPackageUidAsUser(用于获取应用程序的包名)、getApplicationInfoAsUser(用于获取应用程序的应用信息)、getVolumeList(用于获取当前终端设备的存储信息)、getProcessMemoryInfo(用于获取应用程序所在的进程的内存)、getDisplayInfo(用于获取终端设备的屏幕显示信息)作为五个目标API,这五个目标API接口可以分别添加到如下接口类中:ApplicationPackageManager、ApplicationPackageManager、ApplicationPackageManager、StorageManager、ActivityManager、DisplayManagerGlobal。参考表1所示,为启动5个应用程序时,未使用本申请的结果获取方法(方式1)和使用了本申请的结果获取方法后(方式2),各个目标API的平均调用时间和调用次数。Based on the above technical solutions, the application has been tested in practice, and Tmall, Douyin, WeChat, CNTV v6.5.2 are pre-installed and installed on the mobile phone, stimulating the battlefield, Vipshop, Chedi, Tuniu Travel, Tencent Video, NetEase News 10 applications, and start 5 applications: Tmall, Douyin, WeChat, CNTV v6.5.2, stimulate the battlefield, will getPackageInfoAsUser (used to obtain the application package information), getPackageUidAsUser (used to obtain the application package Name), getApplicationInfoAsUser (for obtaining application information of the application), getVolumeList (for obtaining storage information of the current terminal device), getProcessMemoryInfo (for obtaining the memory of the process where the application is located), getDisplayInfo (for obtaining the terminal device's memory) Screen display information) As five target APIs, these five target API interfaces can be added to the following interface classes: ApplicationPackageManager, ApplicationPackageManager, ApplicationPackageManager, StorageManager, ActivityManager, DisplayManagerGlobal. As shown in Table 1, for the start of five applications, the average call time and call of each target API are not used (method 1) and after using the result acquisition method (method 2) of this application frequency.
表1实际测试结果Table 1 Actual test results
Figure PCTCN2019128240-appb-000001
Figure PCTCN2019128240-appb-000001
本申请实施例提供了一种结果获取方法,在响应于对目标API的第一请求指令时,调用目标API,获取目标API的返回结果,在缓存中对应存储目标API和对应的返回结果,因此,响应于对目标API的第二请求指令,可以在缓存中查找与目标API对应的返回结果。因为应用程序的缓存是在应用程序所在的线程中,这样,应用程序可以在线程内部获取返回结果,而无需再次调用目标API以得到目标API的返回结果,减少了目标API的调用次数,从而降低系统负载,提高系统性能。The embodiment of the present application provides a method for obtaining a result. In response to the first request instruction to the target API, the target API is called to obtain the return result of the target API, and the target API and the corresponding return result are stored in the cache correspondingly. In response to the second request instruction to the target API, the returned result corresponding to the target API can be searched in the cache. Because the application cache is in the thread where the application is located, the application can obtain the return result within the thread without calling the target API again to get the return result of the target API, which reduces the number of calls to the target API, thereby reducing System load, improve system performance.
下面结合具体场景对上述结果获取方法进行示例性的说明。请参阅图3,为本申请实施例中的一种场景实施例的示意图。The above method for obtaining the results is exemplarily described in conjunction with specific scenarios. Please refer to FIG. 3, which is a schematic diagram of a scenario embodiment in an embodiment of the present application.
1)应用程序启动。在绑定进程阶段(BindApplication),启动一个新线程,应用程序在该线程中运行,向服务进程发送注册信息,注册信息可以包括应用程序标识、用户标识和回调函数。1) The application starts. In the binding process phase (BindApplication), a new thread is started, the application program runs in the thread, and registration information is sent to the service process, and the registration information may include an application identification, a user identification, and a callback function.
2)服务线程根据线程标识和用户标识确定目标API,根据回调函数通知应用程序确定结果,并开始采集目标API对应的目标服务的服务信息。2) The service thread determines the target API according to the thread ID and the user ID, notifies the application of the determination result according to the callback function, and starts to collect the service information of the target service corresponding to the target API.
3)响应于对目标API的第一服务请求,应用程序调用目标API,获得目标API的返回结果。例如,应用程序可以调用getVolumeList接口,得到当前终端设备的存储信息。3) In response to the first service request to the target API, the application program calls the target API to obtain the return result of the target API. For example, the application program can call the getVolumeList interface to obtain the storage information of the current terminal device.
4)应用程序在缓存中对应存储目标API和返回结果。具体的,可以先在StorageManager.java中使能getVolumeList接口的缓存机制,然后存储getVolumeList接口的返回结果。4) The application program correspondingly stores the target API and the returned result in the cache. Specifically, you can first enable the caching mechanism of the getVolumeList interface in StorageManager.java, and then store the return result of the getVolumeList interface.
5)响应于对目标API的第二服务请求,应用程序从缓存中查找与目标API对应的返回结果。5) In response to the second service request to the target API, the application program looks up the return result corresponding to the target API from the cache.
6)服务线程采集到目标API对应的目标服务的服务信息发生变化,向应用程序发送更新通知。例如,在用户取出SD卡后,服务线程采集到存储信息发生了变化,则可以通过应用程序的回调信息,向应用程序所在的线程发送更新通知。6) The service thread collects that the service information of the target service corresponding to the target API changes, and sends an update notification to the application. For example, after the user removes the SD card and the service thread collects that the storage information has changed, it can send an update notification to the thread where the application is located through the callback information of the application.
7)应用程序根据更新通知删除目标API对应的返回结果。7) The application deletes the return result corresponding to the target API according to the update notification.
8)响应于第三服务请求,应用程序调用目标API,获得目标API的返回结果,并在缓存中对应存储目标API和返回结果。8) In response to the third service request, the application program calls the target API, obtains the return result of the target API, and stores the target API and the return result in the cache correspondingly.
9)退出应用程序,清除缓存,清除线程。同时,产生BinderDied调用,服务线程删除应用程序相关的数据,例如回调信息。9) Exit the application, clear the cache, and clear the thread. At the same time, a BinderDied call is generated, and the service thread deletes application-related data, such as callback information.
为了便于更好的实施本申请实施例的上述方案,下面还提供用于实施上述方案的相关装置。In order to facilitate better implementation of the above solutions of the embodiments of the present application, related devices for implementing the above solutions are also provided below.
请参考图4所示,本申请实施例提供的结果获取装置400,具体对应于上述提供的结果获取方法的功能。功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述功能相对应的单元,单元可以是软件和/或硬件。该装置400可以包括:Please refer to FIG. 4, the result obtaining apparatus 400 provided by the embodiment of the present application specifically corresponds to the function of the result obtaining method provided above. The function can be realized by hardware, and can also be realized by hardware executing corresponding software. The hardware or software includes one or more units corresponding to the above functions, and the unit may be software and/or hardware. The device 400 may include:
第一调用单元110,用于响应于对目标API的第一请求指令,调用所述目标API,获得所述目标API的返回结果;The first calling unit 110 is configured to call the target API and obtain a return result of the target API in response to the first request instruction to the target API;
存储单元120,用于在缓存中对应存储所述目标API和所述返回结果;The storage unit 120 is configured to store the target API and the returned result correspondingly in the cache;
查找单元130,用于响应于对所述目标API的第二请求指令,在所述缓存中查找与所述目标API对应的所述返回结果。The searching unit 130 is configured to search for the returned result corresponding to the target API in the cache in response to the second request instruction to the target API.
在一些可能的实施方式中,所述查找单元具体用于:In some possible implementations, the search unit is specifically used to:
响应于对所述目标API的第二请求指令,在所述缓存中查找与所述目标API对应的满足有效时间条件的所述返回结果。In response to the second request instruction to the target API, search the cache for the return result corresponding to the target API that satisfies the valid time condition.
在一些可能的实施方式中,所述装置还包括:In some possible implementations, the device further includes:
第二调用单元,用于若所述缓存中不存在与所述目标API对应的满足有效时间条件的所述返回结果,则调用所述目标API,获取所述目标API对应的返回结果。The second calling unit is configured to call the target API to obtain the return result corresponding to the target API if the return result corresponding to the target API that meets the valid time condition does not exist in the cache.
在一些可能的实施方式中,所述装置还包括:In some possible implementations, the device further includes:
第一删除单元,用于删除所述缓存中与所述目标API对应的不满足有效时间条件的所述返回结果。The first deleting unit is configured to delete the returned result corresponding to the target API in the cache that does not satisfy the valid time condition.
在一些可能的实施方式中,所述目标API的类型为第一预设类型。In some possible implementations, the type of the target API is the first preset type.
在一些可能的实施方式中,所述装置还包括:In some possible implementations, the device further includes:
第二删除单元,用于删除所述缓存中不满足有效时间条件的所述返回结果。The second deleting unit is configured to delete the returned result in the cache that does not meet the valid time condition.
在一些可能的实施方式中,所述装置还包括:In some possible implementations, the device further includes:
目标API确定单元,用于根据待处理API的类型,确定所述待处理API是否为目标API,所述目标API为第一预设类型或第二预设类型;所述第一预设类型表征所述目标API的多次返回结果不同,且多次返回结果的差值小于或等于预设差值,所述第二预设类型表征所述目标API的多次返回结果相同。A target API determining unit, configured to determine whether the API to be processed is a target API according to the type of the API to be processed, and the target API is a first preset type or a second preset type; the first preset type is characterized The multiple return results of the target API are different, and the difference between the multiple return results is less than or equal to a preset difference. The second preset type indicates that the multiple return results of the target API are the same.
在一些可能的实施方式中,所述装置还包括:In some possible implementations, the device further includes:
更新单元,用于在所述目标API对应的目标服务的服务信息有变化时,删除所述缓存中的所述目标API对应的返回结果,或,对所述缓存中的所述目标API对应的返回结果进行更新。The updating unit is configured to delete the return result corresponding to the target API in the cache when the service information of the target service corresponding to the target API changes, or, to the target API corresponding to the cache Return the result to update.
在一些可能的实施方式中,所述第一调用单元具体用于:In some possible implementation manners, the first calling unit is specifically configured to:
响应于对所述目标API的第一请求指令,若所述缓存中不存在与所述目标API对应的所述返回结果,则调用所述目标API,获取所述目标API对应的返回结果。In response to the first request instruction to the target API, if the return result corresponding to the target API does not exist in the cache, the target API is called to obtain the return result corresponding to the target API.
在本申请实施例提供的一种结果获取装置中,响应于对目标API的第一请求指令,调用目标API,从而获取目标API的返回结果,在缓存中对应存储目标API和返回结果,因此,响应于对目标API的第二请求指令,可以在缓存中查找与目标API对应的返回结果,而无需再次调用目标API以得到目标API的返回结果,减少了目标API的调用次数,从而降低系统负载,提高系统性能。In a result obtaining apparatus provided in an embodiment of the present application, in response to a first request instruction to a target API, the target API is called to obtain the return result of the target API, and the target API and the return result are stored in the cache correspondingly. Therefore, In response to the second request instruction to the target API, the return result corresponding to the target API can be found in the cache without having to call the target API again to obtain the return result of the target API, which reduces the number of calls to the target API, thereby reducing the system load To improve system performance.
接下来介绍本申请实施例中的结果获取设备。请参考图5所示,结果获取设备500包括:Next, the result acquisition device in the embodiment of the present application will be described. Please refer to FIG. 5, the result acquisition device 500 includes:
接收器501、发射器502、处理器503和存储器504(其中报文的生成的设备500中的处理器503的数量可以一个或多个,图5中以一个处理器为例)。在本申请的一些实施例中,接收器501、发射器502、处理器503和存储器504可通过总线或其它方式连接,其中,图5中以通过总线连接为例。The receiver 501, the transmitter 502, the processor 503, and the memory 504 (wherein the number of the processor 503 in the device 500 for generating a message may be one or more, and one processor is taken as an example in FIG. 5). In some embodiments of the present application, the receiver 501, the transmitter 502, the processor 503, and the memory 504 may be connected through a bus or in other ways. In FIG. 5, connection through a bus is used as an example.
存储器504可以包括只读存储器和随机存取存储器,并向处理器503提供指令和数据。存储器504的一部分还可以包括NVRAM。存储器504存储有操作系统和操作指令、可执行模块或者数据结构,或者它们的子集,或者它们的扩展集,其中,操作指令可包括各种操作指令,用于实现各种操作。操作系统可包括各种系统程序,用于实现各种基础业务以及处理基于硬件的任务。The memory 504 may include a read-only memory and a random access memory, and provide instructions and data to the processor 503. A portion of the memory 504 may also include NVRAM. The memory 504 stores an operating system and operation instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, where the operation instructions may include various operation instructions for implementing various operations. The operating system may include various system programs for implementing various basic services and processing hardware-based tasks.
处理器503控制终端设备的操作,处理器503还可以称为CPU。具体的应用中,报文的生成的设备的各个组件通过总线系统耦合在一起,其中总线系统除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都称为总线系统。The processor 503 controls the operation of the terminal device, and the processor 503 may also be referred to as a CPU. In a specific application, each component of the device for generating a message is coupled together through a bus system. In addition to the data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for the sake of clarity, various buses are called bus systems in the figure.
上述本申请实施例揭示的方法可以应用于处理器503中,或者由处理器503实现。处理器503可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器503中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器503可以是通用处理器、DSP、ASIC、FPGA或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储 器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器504,处理器503读取存储器504中的信息,结合其硬件完成上述方法的步骤。The method disclosed in the above embodiments of the present application may be applied to the processor 503 or implemented by the processor 503. The processor 503 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware in the processor 503 or instructions in the form of software. The foregoing processor 503 may be a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. The methods, steps, and logical block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied and executed by a hardware decoding processor, or may be executed and completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a random storage memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, and other mature storage media in the art. The storage medium is located in the memory 504, and the processor 503 reads the information in the memory 504, and completes the steps of the above method in combination with its hardware.
接收器501可用于接收输入的数字或字符信息,以及产生与用户面装置的相关设置以及功能控制有关的信号输入,发射器502可包括显示屏等显示设备,发射器502可用于通过外接接口输出数字或字符信息。The receiver 501 can be used to receive input digital or character information, and generate signal input related to user plane device related settings and function control. The transmitter 502 can include a display device such as a display screen, and the transmitter 502 can be used to output through an external interface Number or character information.
本申请实施例中,接收器501和发射器502用于实现数据收发。处理器503,用于通过接收器501和发射器502实现数据收发,完成前述结果获取设备所执行的结果获取过程。In the embodiment of the present application, the receiver 501 and the transmitter 502 are used to implement data transmission and reception. The processor 503 is configured to transmit and receive data through the receiver 501 and the transmitter 502, and complete the result acquisition process performed by the foregoing result acquisition device.
本申请实施例还提供一种计算机可读存储介质,用于存储程序代码,该程序代码用于执行前述各个实施例的一种结果获取方法中的任意一种实施方式。Embodiments of the present application also provide a computer-readable storage medium for storing program code, and the program code is used to perform any one of the implementation methods in a result acquisition method of the foregoing embodiments.
本申请实施例还提供一种包括指令的计算机程序产品,当其在计算机上运行时,使得计算机执行前述各个实施例的一种结果获取方法中的任意一种实施方式。Embodiments of the present application also provide a computer program product including instructions that, when run on a computer, cause the computer to execute any one of the method for obtaining a result of the foregoing embodiments.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and conciseness of the description, the specific working processes of the system, device and unit described above can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device, and method may be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical, or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or software function unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application essentially or part of the contribution to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , Including several instructions to enable a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code .
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照 前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present application, not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, persons of ordinary skill in the art should understand that they can still The technical solutions described in the embodiments are modified, or some of the technical features are equivalently replaced; and these modifications or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (21)

  1. 一种结果获取方法,其特征在于,所述方法包括:A method for obtaining results, characterized in that the method includes:
    响应于对目标API的第一请求指令,调用所述目标API,获得所述目标API的返回结果;In response to the first request instruction to the target API, call the target API to obtain a return result of the target API;
    在缓存中对应存储所述目标API和所述返回结果;Correspondingly storing the target API and the returned result in the cache;
    响应于对所述目标API的第二请求指令,在所述缓存中查找与所述目标API对应的所述返回结果。In response to the second request instruction to the target API, look up the returned result corresponding to the target API in the cache.
  2. 根据权利要求1所述的方法,其特征在于,所述在所述缓存中查找与所述目标API对应的所述返回结果,包括:The method according to claim 1, wherein the searching for the returned result corresponding to the target API in the cache includes:
    在所述缓存中查找与所述目标API对应的满足有效时间条件的所述返回结果。Searching in the cache for the returned result corresponding to the target API and satisfying the valid time condition.
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:The method according to claim 2, wherein the method further comprises:
    若所述缓存中不存在与所述目标API对应的满足有效时间条件的所述返回结果,则调用所述目标API,获取所述目标API对应的返回结果。If there is no return result corresponding to the target API satisfying the valid time condition in the cache, the target API is called to obtain the return result corresponding to the target API.
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:The method of claim 3, further comprising:
    删除所述缓存中与所述目标API对应的不满足有效时间条件的所述返回结果。Deleting the returned result corresponding to the target API in the cache that does not meet the valid time condition.
  5. 根据权利要求2-4任意一项所述的方法,其特征在于,所述目标API的类型为第一预设类型,所述第一预设类型表征所述目标API的多次返回结果不同,且多次返回结果的差值小于或等于预设差值。The method according to any one of claims 2-4, wherein the type of the target API is a first preset type, and the first preset type indicates that the target API returns different results multiple times, And the difference between the results returned multiple times is less than or equal to the preset difference.
  6. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    删除所述缓存中不满足有效时间条件的所述返回结果。Deleting the returned result in the cache that does not meet the valid time condition.
  7. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    根据待处理API的类型,确定所述待处理API是否为目标API,所述目标API为第一预设类型或第二预设类型;所述第一预设类型表征所述目标API的多次返回结果不同,且多次返回结果的差值小于或等于预设差值,所述第二预设类型表征所述目标API的多次返回结果相同。According to the type of the to-be-processed API, determine whether the to-be-processed API is a target API, and the target API is a first preset type or a second preset type; the first preset type represents multiple times of the target API The return results are different, and the difference between the multiple return results is less than or equal to a preset difference, and the second preset type indicates that the multiple return results of the target API are the same.
  8. 根据权利要求1-7任意一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-7, wherein the method further comprises:
    在所述目标API对应的目标服务的服务信息有变化时,删除所述缓存中的所述目标API对应的返回结果,或,对所述缓存中的所述目标API对应的返回结果进行更新。When the service information of the target service corresponding to the target API changes, delete the return result corresponding to the target API in the cache, or update the return result corresponding to the target API in the cache.
  9. 根据权利要求1-8任意一项所述的方法,其特征在于,所述响应于对目标API的第一请求指令,调用所述目标API,获得所述目标API的返回结果,包括:The method according to any one of claims 1-8, wherein, in response to the first request instruction to the target API, calling the target API to obtain a return result of the target API includes:
    响应于对所述目标API的第一请求指令,若所述缓存中不存在与所述目标API对应的所述返回结果,则调用所述目标API,获取所述目标API对应的返回结果。In response to the first request instruction to the target API, if the return result corresponding to the target API does not exist in the cache, the target API is called to obtain the return result corresponding to the target API.
  10. 一种结果获取装置,其特征在于,所述装置包括:An apparatus for obtaining results, characterized in that the apparatus includes:
    第一调用单元,用于响应于对目标API的第一请求指令,调用所述目标API,获得所述目标API的返回结果;A first calling unit, configured to call the target API in response to a first request instruction to the target API, and obtain a return result of the target API;
    存储单元,用于在缓存中对应存储所述目标API和所述返回结果;A storage unit, configured to store the target API and the returned result correspondingly in the cache;
    查找单元,用于响应于对所述目标API的第二请求指令,在所述缓存中查找与所述目 标API对应的所述返回结果。The searching unit is configured to search for the returned result corresponding to the target API in the cache in response to the second request instruction to the target API.
  11. 根据权利要求10所述的装置,其特征在于,所述查找单元具体用于:The device according to claim 10, wherein the search unit is specifically configured to:
    响应于对所述目标API的第二请求指令,在所述缓存中查找与所述目标API对应的满足有效时间条件的所述返回结果。In response to the second request instruction to the target API, search the cache for the return result corresponding to the target API that satisfies the valid time condition.
  12. 根据权利要求11所述的装置,其特征在于,所述装置还包括:The device according to claim 11, wherein the device further comprises:
    第二调用单元,用于若所述缓存中不存在与所述目标API对应的满足有效时间条件的所述返回结果,则调用所述目标API,获取所述目标API对应的返回结果。The second calling unit is configured to call the target API to obtain the return result corresponding to the target API if the return result corresponding to the target API that meets the valid time condition does not exist in the cache.
  13. 根据权利要求12所述的装置,其特征在于,所述装置还包括:The device of claim 12, wherein the device further comprises:
    第一删除单元,用于删除所述缓存中与所述目标API对应的不满足有效时间条件的所述返回结果。The first deleting unit is configured to delete the returned result corresponding to the target API in the cache that does not satisfy the valid time condition.
  14. 根据权利要求11-13任意一项所述的装置,其特征在于,所述目标API的类型为第一预设类型,所述第一预设类型表征所述目标API的多次返回结果不同,且多次返回结果的差值小于或等于预设差值。The device according to any one of claims 11 to 13, wherein the type of the target API is a first preset type, and the first preset type indicates that the target API returns different results multiple times, And the difference between the results returned multiple times is less than or equal to the preset difference.
  15. 根据权利要求10所述的装置,其特征在于,所述装置还包括:The device of claim 10, wherein the device further comprises:
    第二删除单元,用于删除所述缓存中不满足有效时间条件的所述返回结果。The second deleting unit is configured to delete the returned result in the cache that does not meet the valid time condition.
  16. 根据权利要求10所述的装置,其特征在于,所述装置还包括:The device of claim 10, wherein the device further comprises:
    目标API确定单元,用于根据待处理API的类型,确定所述待处理API是否为目标API,所述目标API为第一预设类型或第二预设类型;所述第一预设类型表征所述目标API的多次返回结果不同,且多次返回结果的差值小于或等于预设差值,所述第二预设类型表征所述目标API的多次返回结果相同。A target API determining unit, configured to determine whether the API to be processed is a target API according to the type of the API to be processed, and the target API is a first preset type or a second preset type; the first preset type is characterized The multiple return results of the target API are different, and the difference between the multiple return results is less than or equal to a preset difference. The second preset type indicates that the multiple return results of the target API are the same.
  17. 根据权利要求10-16任意一项所述的装置,其特征在于,所述装置还包括:The device according to any one of claims 10-16, wherein the device further comprises:
    更新单元,用于在所述目标API对应的目标服务的服务信息有变化时,删除所述缓存中的所述目标API对应的返回结果,或,对所述缓存中的所述目标API对应的返回结果进行更新。The updating unit is configured to delete the return result corresponding to the target API in the cache when the service information of the target service corresponding to the target API changes, or, to the target API corresponding to the cache Return the result to update.
  18. 根据权利要求10-17任意一项所述的装置,其特征在于,所述第一调用单元具体用于:The device according to any one of claims 10-17, wherein the first calling unit is specifically configured to:
    响应于对所述目标API的第一请求指令,若所述缓存中不存在与所述目标API对应的所述返回结果,则调用所述目标API,获取所述目标API对应的返回结果。In response to the first request instruction to the target API, if the return result corresponding to the target API does not exist in the cache, the target API is called to obtain the return result corresponding to the target API.
  19. 一种结果获取设备,其特征在于,所述设备包括:处理器和存储器;A result acquisition device, characterized in that the device includes: a processor and a memory;
    所述存储器,用于存储指令;The memory is used to store instructions;
    所述处理器,用于执行所述存储器中的所述指令,执行如权利要求1-9中任意一项所述的方法。The processor is configured to execute the instructions in the memory and execute the method according to any one of claims 1-9.
  20. 一种计算机可读存储介质,包括指令,当其在计算机上运行时,使得计算机执行以上权利要求1-9任意一项所述的方法。A computer-readable storage medium including instructions which, when run on a computer, cause the computer to perform the method of any one of claims 1-9 above.
  21. 一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行以上权利要求1-9任意一项所述的方法。A computer program product containing instructions that, when run on a computer, causes the computer to perform the method of any one of claims 1-9 above.
PCT/CN2019/128240 2018-12-25 2019-12-25 Result acquisition method, apparatus and device WO2020135485A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811592873.0A CN111367683A (en) 2018-12-25 2018-12-25 Result obtaining method, device and equipment
CN201811592873.0 2018-12-25

Publications (1)

Publication Number Publication Date
WO2020135485A1 true WO2020135485A1 (en) 2020-07-02

Family

ID=71126364

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/128240 WO2020135485A1 (en) 2018-12-25 2019-12-25 Result acquisition method, apparatus and device

Country Status (2)

Country Link
CN (1) CN111367683A (en)
WO (1) WO2020135485A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114785637A (en) * 2022-03-15 2022-07-22 浪潮云信息技术股份公司 Implementation method and system for caching response data by API gateway
CN115061743A (en) * 2022-06-08 2022-09-16 Oppo广东移动通信有限公司 Interface calling method and device, computer readable medium and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1869939A (en) * 2005-05-27 2006-11-29 华为技术有限公司 Method for access data base by multi-line program applied program
CN102193982A (en) * 2011-03-25 2011-09-21 北京世纪互联工程技术服务有限公司 Method for controlling search data in graphic database online transaction
CN103645904A (en) * 2013-12-20 2014-03-19 北京京东尚科信息技术有限公司 Cache realization method of interface calling
CN103971067A (en) * 2014-05-30 2014-08-06 中国人民解放军国防科学技术大学 Operating system nucleus universal access control method supporting entities inside and outside nucleus
CN104899106A (en) * 2014-03-07 2015-09-09 阿里巴巴集团控股有限公司 Processing method and processing device when interface service is abnormal
US20170097811A1 (en) * 2015-10-06 2017-04-06 International Business Machines Corporation Interface method resolution in object oriented programming models

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8914582B1 (en) * 2011-11-14 2014-12-16 Google Inc. Systems and methods for pinning content in cache
CN104423982B (en) * 2013-08-27 2018-03-06 阿里巴巴集团控股有限公司 The processing method and processing equipment of request
CN107707373B (en) * 2017-02-21 2018-08-17 贵州白山云科技有限公司 A kind of dynamic resource access accelerated method based on API request
CN108282405B (en) * 2017-12-27 2020-09-18 好活(昆山)网络科技有限公司 Application program interface cache management method, application server and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1869939A (en) * 2005-05-27 2006-11-29 华为技术有限公司 Method for access data base by multi-line program applied program
CN102193982A (en) * 2011-03-25 2011-09-21 北京世纪互联工程技术服务有限公司 Method for controlling search data in graphic database online transaction
CN103645904A (en) * 2013-12-20 2014-03-19 北京京东尚科信息技术有限公司 Cache realization method of interface calling
CN104899106A (en) * 2014-03-07 2015-09-09 阿里巴巴集团控股有限公司 Processing method and processing device when interface service is abnormal
CN103971067A (en) * 2014-05-30 2014-08-06 中国人民解放军国防科学技术大学 Operating system nucleus universal access control method supporting entities inside and outside nucleus
US20170097811A1 (en) * 2015-10-06 2017-04-06 International Business Machines Corporation Interface method resolution in object oriented programming models

Also Published As

Publication number Publication date
CN111367683A (en) 2020-07-03

Similar Documents

Publication Publication Date Title
US10972372B2 (en) Scheduling processing tasks based on predicted context
US10712915B2 (en) Information presentation using a client on a terminal
WO2018054195A1 (en) Resource allocating method and base station
US10769215B2 (en) Method, apparatus and computer program product providing an application integrated mobile device search solution using context information
US9807218B2 (en) Method for filtering spam in electronic device and the electronic device
US20220291929A1 (en) Method for multi-core communication, electronic device and storage medium
CN106776917B (en) Method and device for acquiring resource file
WO2018133297A1 (en) Advertisement display control method, terminal, and advertisement server
CN110765165B (en) Method, device and system for synchronously processing cross-system data
WO2020135485A1 (en) Result acquisition method, apparatus and device
US20160028832A1 (en) Methods and systems for efficient discovery of devices in a peer-to-peer network
US11196778B2 (en) NBMP workflow management in 5G flus
CN115309431B (en) Parameter updating method, readable medium and electronic equipment
US10187430B2 (en) Smart management of background network connections
CN112804160B (en) Application program-based current limiting method, device, equipment, medium and product
CN114328097A (en) File monitoring method and device, electronic equipment and storage medium
CN111596864A (en) Method, device, server and storage medium for data delayed deletion
CN110120963B (en) Data processing method, device, equipment and machine readable medium
CN112825072A (en) Communication terminal and data sharing method
CN112732457B (en) Image transmission method, image transmission device, electronic equipment and computer readable medium
CN109766501B (en) Crawler protocol management method and device and crawler system
CN104346228A (en) Application program sharing method and terminal
CN113360348A (en) Exception request processing method and device, electronic equipment and storage medium
CN113342837B (en) Data transmission method, device, electronic equipment and computer readable medium
US11405981B1 (en) Routing server communications through a nearby mobile device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19904554

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19904554

Country of ref document: EP

Kind code of ref document: A1