Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Data caching method and device and server

A data cache and server technology, applied in the computer field, can solve problems such as system crash and slow system response

Active Publication Date: 2019-05-21
成都宝瓜科技有限公司
View PDF17 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The purpose of the present invention is to overcome the deficiencies of the prior art, and provide a data caching method, device and server, which are used to solve the problem of slow system response or system crash in a high concurrency environment when calling an API to request data

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Data caching method and device and server
  • Data caching method and device and server
  • Data caching method and device and server

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0035] like figure 1 As shown, in order to solve the problem of slow system response or system crash in a high-concurrency environment when calling the API to request data, this embodiment proposes a data caching method, including the following steps:

[0036] receiving a data request from the client, obtaining a POST request or a non-POST request according to the data request, the POST request including at least one remote API address and its parameters, and the non-POST request including at least one remote API address;

[0037] Each API address and parameter of the POST request are combined and hashed to obtain each hash value, or each API address of the non-POST request is hashed to obtain each hash value, and each hash Value as an index into the data cache entry.

[0038] The data request in this step can be a commodity request, including one or more of commodity information, commodity inventory, or commodity discount; at least one remote API address request, such as com...

Embodiment 2

[0047] Corresponding to Embodiment 1, this embodiment provides a data cache device, such as figure 2 As shown, the device includes:

[0048] A receiving module, configured to receive a data request from a client, obtain a POST request or a non-POST request according to the data request, the POST request includes at least one remote API address and its parameters, and the non-POST request includes at least one remote API address;

[0049] The operation module is used to combine the API addresses and parameters of the POST request to perform hash operation to obtain each hash value, or to perform hash operation to each API address of the non-POST request to obtain each hash value , using each hash value as an index of the data cache item;

[0050] A query module, configured to query whether the data exists in the local database;

[0051] A request module, configured to send a normal request API to obtain data if the data does not exist;

[0052] The cache module is used to c...

Embodiment 3

[0063] A server such as image 3 As shown, it includes a processor and a machine-readable storage medium, the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and when the processor executes the machine-executable instructions, the following step:

[0064] receiving a data request from the client, obtaining a POST request or a non-POST request according to the data request, the POST request including at least one remote API address and its parameters, and the non-POST request including at least one remote API address;

[0065] The API addresses and parameters of the POST request are combined and hashed to obtain each hash value, or each API address of the non-POST request is hashed to obtain each hash value, and each hash value as an index into said data cache entry;

[0066] Query whether the data exists in the local database. If the data does not exist, send a normal request to the API to obtain the data. If the ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a data caching method and device and a server. The method is an asynchronous caching mechanism, when the server calls a plurality of other secondary remote APIs, a link addressand parameters of a request are hashed, so that successful remote API data can be mapped to a local high-speed database. When the server uses the remote API data, the data of the local high-speed database is directly used. When the server uses the API data next time, whether the data expires or not is judged, and the remote API data is asynchronously updated. The response speed of the server canbe increased. The reliability of the whole system is improved, and even if the secondary API has a fault, the device can continue to work by depending on local data.

Description

technical field [0001] The invention relates to the field of computers, in particular to a data caching method, device and server. Background technique [0002] In the Internet environment, mutual data calls between servers are very common. A website relies on remote server data, or a server needs to call data from multiple third-party servers. When the system calls multiple remote APIs in a chain, the call speed is slow. If one API call takes 1 to 2 seconds, 10 API calls will cause the current service response time to be greater than 10 seconds. [0003] However, the existing data caching methods can only cache GET request data according to the API address, but cannot cache POST request data. Usually the API request address is the only identifier of the API, but for a POST request with parameters, the same address will return different content, and the existing caching method cannot cache this kind of data, which will still lead to slow API calls when updating data , Gen...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F16/22G06F16/2455
CPCY02D10/00
Inventor 文浩
Owner 成都宝瓜科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products