Method and system for applying for external services based on redis web service
A service request and service response technology, applied in the computer field, can solve the problems of complex deployment of external services on the Web platform, achieve the effects of reducing communication overhead, reducing maintenance costs, and ensuring timeliness
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0047] Such as figure 1 As shown, it is an implementation scenario of the technical solution in the embodiment of the present invention, the front end (such as a browser) requests an external service through a backend server (Web server), and a Redis database is deployed between the backend server and the external service unit, the described The Redis database is used to establish and maintain a Redis cache queue, and a Redis cache queue corresponds to a service request and a service response between a backend server and an external service unit. The service request and service response are stored in the Redis cache queue, and the service request and service response are arranged in parity, so that the element in the queue can be judged whether it is a service request or a service response by the length of the queue.
Embodiment 2
[0049] Such as figure 2 As shown, the embodiment of the present invention provides a method for applying for an external service based on a Redis-based Web Service, including:
[0050] S1. The front-end sends an external service request to the back-end server, returns and sets the service response query time;
[0051] When a user needs to request the service of an external service unit, he can use Ajax to send a service request to the back-end server through the front-end (such as a web browser), and when the service request is sent, it can return (usually immediately return) and timed, that is, set the service Response query time, when the set service response query time is reached, the front-end uses Ajax to send a query request to the back-end server to drive the back-end server to query and return the service response result.
[0052] S2. The backend server receives the external service request sent by the front end, and judges whether the length of the corresponding Red...
Embodiment 3
[0065] Taking the odd elements in the queue representing service requests and the even elements representing service responses as an example, the process of request initiation and result response of the method of the present invention will be described below.
[0066] Such as image 3As shown, it is a schematic diagram of the process of initiating a service request in the embodiment of the present invention. The front-end sends a service request, returns and sets the timing; after the back-end server receives the service request, it adds a service request to the cache queue, and if the queue length is an even number, it adds. If it is an odd number it is not added. For example, the queue length in the figure is 2 (even number), at this time, the service request req can be added, and the queue length becomes 3 (odd number) after adding, at this time, the external service unit reads the service request req.
[0067] Such as Figure 4 As shown, it is a schematic diagram of the ...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com