CN117914942A - Data request caching method and device, intelligent terminal and storage medium - Google Patents

Data request caching method and device, intelligent terminal and storage medium Download PDF

Info

Publication number
CN117914942A
CN117914942A CN202410316146.0A CN202410316146A CN117914942A CN 117914942 A CN117914942 A CN 117914942A CN 202410316146 A CN202410316146 A CN 202410316146A CN 117914942 A CN117914942 A CN 117914942A
Authority
CN
China
Prior art keywords
data
parameter
cache
data request
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202410316146.0A
Other languages
Chinese (zh)
Other versions
CN117914942B (en
Inventor
谭光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Yinji Information Security Technology Co ltd
Original Assignee
Guangdong Yinji Information Security Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Yinji Information Security Technology Co ltd filed Critical Guangdong Yinji Information Security Technology Co ltd
Priority to CN202410316146.0A priority Critical patent/CN117914942B/en
Priority claimed from CN202410316146.0A external-priority patent/CN117914942B/en
Publication of CN117914942A publication Critical patent/CN117914942A/en
Application granted granted Critical
Publication of CN117914942B publication Critical patent/CN117914942B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention relates to the technical field of communication, and discloses a data request caching method and device, an intelligent terminal and a storage medium. The method comprises the following steps: calculating according to the data request to obtain a unique cache identifier of response data of the server side aiming at the data request; when the network state of the intelligent terminal is available, acquiring response data of the server side to the data request, and caching the response data according to the unique cache identification; and when the network state of the intelligent terminal is unavailable, searching the cache data corresponding to the data request according to the unique cache identification, verifying the searched cache data according to a preset verification rule, and providing the cache data for the target application after the verification is passed. According to the embodiment of the invention, the response data of the data request is cached by the server when the network state is available, the data request is skipped when the network is unavailable, the cached response data is adopted to meet the service requirement, the data safety and effectiveness are ensured, and the use of the vehicle by a user is ensured.

Description

Data request caching method and device, intelligent terminal and storage medium
Technical Field
The embodiment of the invention relates to the technical field of secure communication, in particular to a data request caching method and device, an intelligent terminal and a storage medium.
Background
With the rapid development of digital keys for automobiles, digital key functions have become a standard configuration for vehicles. The digital car key generally uses short-distance Communication technologies such as bluetooth/NFC (NEAR FIELD Communication) to directly interact with the car, and in many cases, the digital car key needs to rely on real-time data request from a server, such as user role verification/key status inquiry, so as to complete the digital key authentication function and realize the car control. If the user network enters a weak network mode at these stages and even no network is available, the digital car key will not be available, resulting in the user not being able to use the vehicle.
Disclosure of Invention
The embodiment of the invention provides a data request caching method and device, an intelligent terminal and a storage medium, wherein response data of a server side to a data request is cached when a network state is available, the data request of the server side is skipped when the network is unavailable, the cached response data is temporarily adopted to meet service requirements, the safety and the effectiveness of the data are ensured, and the use of a vehicle by a user is flexibly ensured.
In a first aspect, an embodiment of the present invention provides a data request caching method, which is applied to an intelligent terminal, where the method includes:
Acquiring a data request initiated by a target application to a server;
calculating and obtaining a unique cache identification of response data of the server side aiming at the data request according to the data request;
determining whether the network state of the intelligent terminal is available, if so, acquiring response data of the server to the data request, and caching the response data according to the unique cache identifier;
If the network state of the intelligent terminal is unavailable, searching the cache data corresponding to the data request according to the unique cache identifier, verifying the searched cache data according to a preset verification rule, and providing the cache data for the target application after verification.
As an embodiment, the calculating, according to the data request, a unique cache identifier of response data of the server for the data request includes:
acquiring a parameter path of a request parameter of the data request to be spliced;
acquiring a parameter object of a request parameter of the data request to be spliced, and splicing the parameter object into a parameter character string after sequencing the parameter object according to a preset rule;
splicing the parameter character string and the parameter path of the request parameter;
And carrying out hash calculation on the spliced parameter character strings and parameter paths to obtain hash values, and taking the hash values as unique cache identifications of response data of the request parameters.
As an embodiment, the obtaining the parameter path of the request parameter of the data request to be spliced includes:
analyzing a parameter path of the request parameter from the data request;
And matching the analyzed parameter path with a preset parameter path, and taking the matched parameter path as the parameter path to be spliced.
As one embodiment, the parameter object of the request parameter is a key value pair; the step of splicing the parameter objects into parameter character strings after sequencing the parameter objects according to a preset rule comprises the following steps:
The key value pairs are spliced into the parameter character string after being sequenced according to ASCII codes;
the hash calculation is carried out on the spliced parameter character strings and parameter paths to obtain hash values, and the hash values comprise the following steps:
and carrying out hash calculation on the spliced parameter character strings and the parameter paths by adopting an SHA-1 hash algorithm to obtain hash values.
As an embodiment, the method further comprises:
Detecting whether the storage time length of the cache data is longer than a preset time length, and if the storage time length of the cache data is longer than the preset time length and the network state of the intelligent terminal is available, informing the target application to send a simulated data request for updating the cache data to the server.
As an embodiment, the determining whether the network state of the intelligent terminal is available includes:
and acquiring the network state of the intelligent terminal through an application program interface provided by a preset application.
Optionally, the caching the response data according to the unique cache identifier includes:
newly creating or updating cache data corresponding to the unique cache identifier according to the response data of the server; or alternatively
And creating or updating the cache data corresponding to the unique cache identifier according to the response data of the server, and deleting the cache data when the target application authenticates with the vehicle end according to the cache data and the authentication fails.
In a second aspect, an embodiment of the present invention provides a data request caching apparatus configured in an intelligent terminal, where the apparatus includes:
the data request acquisition module is used for acquiring a data request initiated by the target application to the server;
The cache identification calculation module is used for calculating and obtaining a unique cache identification of response data of the server side aiming at the data request according to the data request;
the data caching module is used for determining whether the network state of the intelligent terminal is available, if so, acquiring response data of the server to the data request, and caching the response data according to the unique caching identification;
And the cache reading module is used for searching cache data corresponding to the data request according to the unique cache identifier if the network state of the intelligent terminal is unavailable, verifying the searched cache data according to a preset verification rule, and providing the cache data for the target application after verification.
In a third aspect, an embodiment of the present invention provides an intelligent terminal, including a memory and a processor;
A memory for storing a computer program; the processor is configured to read a computer program in the memory and implement the data request caching method according to the first aspect when the program is executed.
In a fourth aspect, an embodiment of the present invention provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the data request caching method according to the first aspect.
Compared with the prior art, the technical scheme provided by the embodiment of the invention has at least the following positive effects:
According to the technical scheme, the data request initiated by the target application to the server is obtained, the unique cache identification of the response data of the server for the data request is calculated according to the data request, when the network state of the intelligent terminal is available, the response data of the server for the data request is obtained, the response data is cached according to the unique cache identification, when the network state of the intelligent terminal is unavailable, the cache data corresponding to the data request is searched according to the unique cache identification, the searched cache data is verified according to the preset verification rule, and after verification, the cache data is provided for the target application, so that the target application can use the cache data of the data request to perform service processing, normal use of the target application under the condition of weak network or offline can be ensured, for example, the digital key terminal can still continue to be used when the network is unavailable, meanwhile, the cached historical response data has higher safety, and the safety of the application is facilitated to be ensured.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a data request caching method according to a first embodiment of the present invention;
FIG. 2 is a flow chart of unique cache identification calculation for the data request caching method shown in FIG. 1;
FIG. 3 is a flowchart illustrating an example application of the data request caching method shown in FIG. 1;
Fig. 4 is a schematic structural diagram of a data request buffer device according to a second embodiment of the present invention;
Fig. 5 is a schematic structural diagram of an intelligent terminal according to a third embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
The following describes a data request caching method and device, an intelligent terminal and a storage medium according to embodiments of the present application with reference to the accompanying drawings. Aiming at the problems that a digital car key generated by the fact that the digital car key cannot acquire data of a service end in real time under the condition of weak network or offline is unavailable, so that a user cannot use a vehicle, the inventor finds that the service end data which is depended on by the digital application cannot be changed frequently under many conditions, even if the change considers the urgency of the user using the vehicle, the user can use part of old data in a short time on the premise of ensuring the accuracy and safety of the data, based on the consideration of the user using the data in the first priority, the inventor proposes that the service end can buffer the response data of the data request applied by the digital key when the network is available, and can directly use the buffered response data when the network is unavailable, and skip the service end data request which is actually needed to be interacted with the vehicle, so as to complete the function of the digital key, the user can be ensured to use the vehicle preferentially, and meanwhile, the data safety can be ensured by using the buffered response data.
The application provides a data request caching method, in the method, a data request initiated by a target application to a server is acquired, a unique cache identification of response data of the server for the data request is calculated according to the data request, whether the network state of an intelligent terminal is available or not is determined, if the network state is available, the response data of the server for the data request is acquired, the response data is cached according to the unique cache identification, if the network state of the intelligent terminal is unavailable, the cache data corresponding to the data request is searched according to the unique cache identification, verification is carried out on the searched cache data according to a preset verification rule, after verification is passed, the cache data is provided for the target application, so that the target application can finish an application function according to the cache data, for example, the digital key application can realize a digital key function according to the interaction of the cache data and the vehicle terminal, and meanwhile the safety of the application can be ensured by using the cache data with high safety.
Specifically, fig. 1 is a flow chart of a data request caching method provided in the first embodiment of the present application, where the method can be applied to an intelligent terminal, and the intelligent terminal includes, but is not limited to, a smart phone, smart watch smart glasses, and other portable intelligent devices. The target application may be a digital key application, or any other application that depends on the server data, but the server data is not changed frequently or the target application may use some old data to ensure that the application is normally used, which is not particularly limited herein. The method can be executed by the data request caching device provided by the embodiment of the application, the device can be realized in a software and/or hardware mode and is configured in the intelligent terminal, the intelligent terminal is also configured with a preset application, for example, a WeChat application, the caching device can be an applet parasitic on WeChat, and the caching device and the target application are independent.
As shown in fig. 1, the data request caching method of the present application includes the following steps:
Step 101: and acquiring a data request initiated by the target application to the server.
The target application takes a digital key application as an example, when the digital key application unlocks a vehicle, the digital key application needs to send a data request to a server in real time, interact with the vehicle end according to response data returned by the server, so as to verify a user role, inquire a key state and the like, wherein the user role verifies, for example, the user is a vehicle owner user or a shared digital key user, and the key state inquires, for example, whether the key state is valid or not. And when the target application is executed, a data request is carried out between the target application and the server, and the data request between the target application and the server can be obtained by monitoring the target application.
Step 102: and calculating according to the data request to obtain the unique cache identification of the response data of the server side aiming at the data request.
The data request of the target application to the server side comprises an uplink interface request and a downlink interface request. The uplink interface refers to an interface that a client (i.e., an intelligent terminal) sends a request to a server, and is used to send data from the client to the server, for example, to submit the data to the server through an HTTPS request. The downstream interface refers to an interface that the server returns a response to the client, and is used to return data from the server to the client, for example, through an HTTPS response. When the network is available, after the target application finishes the data request (namely the uplink interface request and the downlink interface request) of the server, the data returned by the server is used as response data to be cached.
In order to accurately identify response data of different data requests, unique cache identification is generated aiming at single data request granularity, and when data request addresses are the same, data isolation is realized through parameters, namely, the response data corresponding to each parameter of each data request is ensured to have the unique cache identification, so that the cache hit rate is improved, the cache failure probability is reduced, and the response data of the historical data requests can be conveniently and accurately searched later.
Referring to fig. 2, step 102 of calculating a unique cache identifier of response data of a server for a data request according to the data request may include the following steps:
step 1021: and acquiring a parameter path of a request parameter of the data request to be spliced.
Specifically, step 1021 obtaining the parameter path of the request parameter of the data request to be spliced may include: analyzing a parameter path of a request parameter from a data request, matching the analyzed parameter path with a preset parameter path, and taking the matched parameter path as the parameter path to be spliced.
The preset parameter paths include parameter paths of data requests to be cached, and each parameter path includes, for example, a request parameter path corresponding to an uplink interface request and a request parameter path corresponding to a downlink interface request respectively. Matching the analyzed parameter paths with preset parameter paths, wherein the matching of the parameter paths supports regular expressions, and the parameter paths passing through the matching are used as parameter paths to be spliced. By pre-matching the parameter paths, the unique cache identification can be rapidly and accurately calculated. The data request to be cached may be a data request necessary for assisting the target application to complete the application function when the network is unavailable, and may be configured according to the specific application.
Step 1022: and acquiring a parameter object of the request parameter of the data request to be spliced, and splicing the parameter object into a parameter character string after sequencing the parameter object according to a preset rule.
The parameter object of the request parameter is a key value pair, and the parameter object is spliced into the parameter character string after being sequenced according to a preset rule, specifically, the key value pair is spliced into the parameter character string after being sequenced according to ASCII codes. The parameter strings may be spliced after being sequenced in any feasible sequencing manner, which is not particularly limited herein.
Step 1023: and splicing the parameter character string and the parameter path of the request parameter.
Step 1024: and carrying out hash calculation on the spliced parameter character strings and the parameter paths to obtain hash values, and taking the hash values as unique cache identifiers of response data of the request parameters.
For example, the hash value obtained by hashing the spliced parameter string and the parameter path in step 1024 may specifically be obtained by hashing the spliced parameter string and the parameter path by using a SHA-1 hash algorithm, and of course, may be obtained by using any feasible hash algorithm.
The following examples of steps 1021 through 1024 are described as follows:
In step 1021, the parameter path of the request parameters of the data request to be spliced is exemplified as follows:
/xxx/vehicle/v1/keys
/https:\/\/(?:.*)/ig
In step 1022, the key value pairs are sorted and spliced according to ASCII codes, and the parameter string STR is returned.
In step 1023, the parameter path and the parameter STR are spliced.
In step 1024, the result returned by SHA-1 hash calculation is used as the unique cache ID for the spliced parameter paths and the parameter STR. An example of a unique cache identification ID is shown below.
Step 103: it is determined whether the network status of the intelligent terminal is available, if so, step 104 is performed, and if not, step 105 is performed.
Step 103 determines whether the network state of the intelligent terminal is available, and specifically, the network state of the intelligent terminal can be obtained through an application program interface provided by a preset application. The preset application can be WeChat, namely the caching device acquires the network state of the intelligent terminal through WeChat, and the target application does not need to acquire the network state by itself, so that the intelligent terminal is realized without invasion.
Step 104: and acquiring response data of the server side to the data request, and caching the response data according to the unique cache identification.
The caching of the response data according to the unique cache identifier may specifically include: and (3) newly establishing or updating the cache data corresponding to the unique cache identifier according to the response data of the server.
Unique cache ID example: addf120b430021c36c232c99ef8d926aea2acd6b. It is appreciated that cache isolation of data requests may be achieved using different ID namespaces.
Cached data example: { addf120b430021c36c232c99ef8d926aea acd6 b: { keyUUID: "xxx" }
KeyUUID "xxx" is the buffered response data.
Therefore, the real-time data request coverage updating cache when the network is available can ensure the authenticity and timeliness of the data, the accuracy and timeliness of the downlink data request can be ensured through the cache configuration, the real-time cache of the uplink data request can also ensure that the use of the digital key is not blocked when the subsequent network is unavailable, and the user can safely and smoothly use the vehicle.
As an alternative to directly caching the response data, caching the response data according to the unique cache identification may specifically include: and the cache data corresponding to the unique cache identifier is newly built or updated according to the response data of the server, and when the target application authenticates with the vehicle end according to the cache data and the authentication fails, the cache data is deleted, so that the wrong cache data is not required to be stored.
Step 105: searching the cache data corresponding to the data request according to the unique cache identification, verifying the searched cache data according to a preset verification rule, and providing the cache data for the target application after verification.
Verification of the cached data may include verification of the integrity and validity of the cached data. Finding the cached data indicates that it has integrity. The validity verification of the cache data can determine whether the storage time length of the cache data is longer than a preset time length which is preset, if the storage time length is longer than or equal to the preset time length, the cache data is indicated to be invalid after the time length is longer than the preset time length, and if the storage time length is shorter than the preset time length, the cache data is indicated to be valid and available. The preset duration may be, for example, 7 days, and may specifically be set according to actual service requirements, which is not limited herein.
It should be noted that, in some examples, the data request caching method may further include the following steps: detecting whether the storage time length of the cache data is longer than a preset time length, and if the storage time length of the cache data is longer than the preset time length and the network state of the intelligent terminal is available, notifying a target application to send a simulated data request for updating the cache data to a server. When the target application receives the simulated data request, the function of the target application can be simulated to initiate the data request so as to trigger the updating of the cache data, so that the cache data is kept effective, and the availability of the digital car key is further improved.
Referring to fig. 3, taking an example of a digital key application a initiating a data request to a server B, an application of the data request caching method according to an embodiment of the present application is illustrated as follows:
Step 301: and calculating the unique cache identification according to the data request.
The digital key application A initiates a data request to the service B, and calculates a cache ID;
examples:
Request address and parameters:/key/a/bid=1
Calculating unique cache ID (and using different ID namespaces to achieve cache isolation) f48990062ce7098fde c2dc55024b0815a7a7d4b
Cache data { f48990062ce7098fde c2dc55024b0815a7a7d4 b: { … data }
Step 302: if a network is available, step 303) is performed, otherwise step 304 is performed.
Step 303: the data is cached.
Update/newly built cache (e.g., { f48990062ce7098fde c2dc55024b0815a7a7d4b { … data });
Step 304: if there is the cached data corresponding to the data request, step 305 is executed, otherwise step 307 is executed.
When the response data corresponding to the ID f48990062ce7098fde c2dc55024b0815a7a7d4b is found, step 305 is executed, and if the ID is not found, step 307 is executed.
Step 305: verifying whether the buffered data is valid, if so, executing step 306, otherwise executing step 307.
Step 306: and returning the cache data to the digital key application.
The digital key application interacts with the vehicle after receiving the cached data to facilitate use of the vehicle when the network is not available.
Step 307: the user is prompted for errors.
Compared with the prior art, the method and the device have the advantages that the unique cache identification of the response data of the server side for the data request is obtained through calculation according to the data request, when the network state of the intelligent terminal is available, the response data of the server side for the data request is obtained, the response data are cached according to the unique cache identification, when the network state of the intelligent terminal is unavailable, the cache data corresponding to the data request are searched according to the unique cache identification, verification is carried out on the searched cache data according to the preset verification rule, and after the verification is passed, the cache data are provided for the target application, so that the target application can use the cache data of the data request for business processing, normal use of the target application under the condition of weak network or offline can be ensured, for example, the digital key side can still be used when the network is unavailable, meanwhile, the cached historical response data have higher safety, and the safety of the application can be guaranteed.
The second embodiment of the invention provides a data request caching device configured in an intelligent terminal. As shown in fig. 4, the data request caching apparatus 400 includes: a data request acquisition module 401, a cache identification calculation module 402, a data cache module 403, and a cache reading module 404.
The data request acquisition module 401 is configured to acquire a data request initiated by a target application to a server.
The cache identifier calculation module 402 is configured to calculate, according to a data request, a unique cache identifier of response data of the server for the data request.
The data caching module 403 is configured to determine whether a network state of the intelligent terminal is available, and if so, acquire response data of the server to the data request, and cache the response data according to the unique cache identifier.
The cache reading module 404 is configured to search, if the network state of the intelligent terminal is unavailable, for cache data corresponding to the data request according to the unique cache identifier, verify the searched cache data according to a preset verification rule, and provide the cache data to the target application after the verification is passed.
Optionally, the cache identification calculation module 402 may include:
the parameter path acquisition sub-module is used for acquiring a parameter path of a request parameter of a data request to be spliced;
The parameter object ordering sub-module is used for acquiring parameter objects of request parameters of the data request to be spliced, and splicing the parameter objects into parameter character strings after ordering the parameter objects according to a preset rule;
the path and parameter splicing sub-module is used for splicing parameter character strings and parameter paths of the request parameters; and
And the hash value calculation sub-module is used for carrying out hash calculation on the spliced parameter character strings and the parameter paths to obtain hash values, and taking the hash values as unique cache identifications of response data of the request parameters.
Optionally, the parameter path obtaining submodule is specifically configured to parse a parameter path of the request parameter from the data request; matching the analyzed parameter path with a preset parameter path, and taking the matched parameter path as the parameter path to be spliced.
Optionally, the parameter object of the request parameter is a key value pair, and the parameter object ordering submodule is specifically configured to splice the key value pair after ordering according to the ASCII code into a parameter character string.
The hash value calculation submodule is specifically used for carrying out hash calculation on the spliced parameter character strings and the parameter paths by adopting an SHA-1 hash algorithm to obtain hash values.
The data request caching apparatus 400 may further include a cache update module, configured to detect whether a storage time period of the cache data is longer than a preset time period, and if the storage time period of the cache data is longer than the preset time period and the network state of the intelligent terminal is available, notify the target application to send a simulated data request for updating the cache data to the server.
Optionally, the data caching module 403 is specifically configured to obtain the network state of the intelligent terminal through an application program interface provided by a preset application.
Optionally, the data caching module 403 is specifically configured to newly build or update the cached data corresponding to the unique cache identifier according to the response data of the server.
As an alternative example of data caching, the data caching module 403 may be further configured to newly build or update the cached data corresponding to the unique cache identifier according to the response data of the server, and delete the cached data when the target application authenticates with the vehicle terminal according to the cached data and fails to authenticate.
Compared with the prior art, the data request caching device provided by the embodiment of the invention has the advantages that the unique caching identification of the response data of the server side for the data request is obtained through calculation according to the data request, when the network state of the intelligent terminal is available, the response data of the server side for the data request is obtained, the response data is cached according to the unique caching identification, when the network state of the intelligent terminal is unavailable, the corresponding caching data of the data request is searched according to the unique caching identification, the searched caching data is verified according to the preset verification rule, and the caching data is provided for the target application after the verification is passed, so that the target application can use the caching data of the data request for business processing, normal use of the target application under the condition of weak network or offline can be ensured, for example, the data key side can still be used when the network is unavailable, and meanwhile, the cached historical response data has higher safety, and is favorable for ensuring the safety of the application.
An intelligent terminal is provided in a third embodiment of the present invention, and fig. 5 is a schematic structural diagram of the intelligent terminal provided in the embodiment of the present invention. The intelligent terminal 50 comprises a memory 51 and a processor 52;
A memory 51 for storing a computer program; the processor 52 is configured to read a computer program in the memory 51 and to implement the data request caching method described in the previous embodiment when executing the program.
Embodiments of the present invention provide a computer readable storage medium having stored thereon a computer program for performing the technical solutions of any of the method embodiments when executed by a computer processor.
From the above description of embodiments, it will be clear to a person skilled in the art that the present invention may be implemented by means of software and necessary general purpose hardware, but of course also by means of hardware, although in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as a floppy disk, a read-only memory (ROM), a random access memory (Random Access Memory, RAM), a FLASH memory (FLASH), a hard disk, or an optical disk of a computer, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a grid device, etc.) to execute the method according to the embodiments of the present invention.
It should be noted that, in the embodiment of the apparatus, each unit and module included are only divided according to the functional logic, but not limited to the above-mentioned division, so long as the corresponding function can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the present invention.
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (10)

1. The data request caching method is characterized by being applied to an intelligent terminal, and comprises the following steps:
Acquiring a data request initiated by a target application to a server;
calculating and obtaining a unique cache identification of response data of the server side aiming at the data request according to the data request;
determining whether the network state of the intelligent terminal is available, if so, acquiring response data of the server to the data request, and caching the response data according to the unique cache identifier;
If the network state of the intelligent terminal is unavailable, searching the cache data corresponding to the data request according to the unique cache identifier, verifying the searched cache data according to a preset verification rule, and providing the cache data for the target application after verification.
2. The method of claim 1, wherein the calculating, according to the data request, the unique cache identifier of the response data of the server for the data request includes:
acquiring a parameter path of a request parameter of the data request to be spliced;
acquiring a parameter object of a request parameter of the data request to be spliced, and splicing the parameter object into a parameter character string after sequencing the parameter object according to a preset rule;
splicing the parameter character string and the parameter path of the request parameter;
And carrying out hash calculation on the spliced parameter character strings and parameter paths to obtain hash values, and taking the hash values as unique cache identifications of response data of the request parameters.
3. The method according to claim 2, wherein the obtaining the parameter path of the request parameter of the data request to be spliced includes:
analyzing a parameter path of the request parameter from the data request;
And matching the analyzed parameter path with a preset parameter path, and taking the matched parameter path as the parameter path to be spliced.
4. The data request caching method according to claim 2, wherein the parameter object of the request parameter is a key value pair; the step of splicing the parameter objects into parameter character strings after sequencing the parameter objects according to a preset rule comprises the following steps:
The key value pairs are spliced into the parameter character string after being sequenced according to ASCII codes;
the hash calculation is carried out on the spliced parameter character strings and parameter paths to obtain hash values, and the hash values comprise the following steps:
and carrying out hash calculation on the spliced parameter character strings and the parameter paths by adopting an SHA-1 hash algorithm to obtain hash values.
5. The data request caching method of claim 1, further comprising:
Detecting whether the storage time length of the cache data is longer than a preset time length, and if the storage time length of the cache data is longer than the preset time length and the network state of the intelligent terminal is available, informing the target application to send a simulated data request for updating the cache data to the server.
6. The method of claim 1, wherein the determining whether the network state of the intelligent terminal is available comprises:
and acquiring the network state of the intelligent terminal through an application program interface provided by a preset application.
7. The data request caching method according to claim 1, wherein the caching the response data according to the unique cache identification includes:
newly creating or updating cache data corresponding to the unique cache identifier according to the response data of the server; or alternatively
And creating or updating the cache data corresponding to the unique cache identifier according to the response data of the server, and deleting the cache data when the target application authenticates with the vehicle end according to the cache data and the authentication fails.
8. A data request caching apparatus, configured in an intelligent terminal, the apparatus comprising:
the data request acquisition module is used for acquiring a data request initiated by the target application to the server;
The cache identification calculation module is used for calculating and obtaining a unique cache identification of response data of the server side aiming at the data request according to the data request;
the data caching module is used for determining whether the network state of the intelligent terminal is available, if so, acquiring response data of the server to the data request, and caching the response data according to the unique caching identification;
And the cache reading module is used for searching cache data corresponding to the data request according to the unique cache identifier if the network state of the intelligent terminal is unavailable, verifying the searched cache data according to a preset verification rule, and providing the cache data for the target application after verification.
9. An intelligent terminal is characterized by comprising a memory and a processor;
a memory for storing a computer program; the processor is configured to read a computer program in the memory and to implement the data request caching method according to any one of claims 1-7 when the program is executed.
10. A computer readable storage medium having stored thereon a computer program, which when executed by a processor implements a data request caching method as claimed in any one of claims 1-7.
CN202410316146.0A 2024-03-20 Data request caching method and device, intelligent terminal and storage medium Active CN117914942B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410316146.0A CN117914942B (en) 2024-03-20 Data request caching method and device, intelligent terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410316146.0A CN117914942B (en) 2024-03-20 Data request caching method and device, intelligent terminal and storage medium

Publications (2)

Publication Number Publication Date
CN117914942A true CN117914942A (en) 2024-04-19
CN117914942B CN117914942B (en) 2024-06-21

Family

ID=

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170177695A1 (en) * 2015-12-21 2017-06-22 Sap Se Synchronization of offline data
CN109361718A (en) * 2018-12-26 2019-02-19 上海银基信息安全技术股份有限公司 Identity identifying method, device and medium
CN113066209A (en) * 2021-03-23 2021-07-02 上海银基信息安全技术股份有限公司 Method and device for safe off-line use of digital key and storage medium
WO2021169540A1 (en) * 2020-02-27 2021-09-02 郑州阿帕斯数云信息科技有限公司 Data caching method and device, and cloud server
CN116226200A (en) * 2023-03-07 2023-06-06 智慧星光(安徽)科技有限公司 BFF architecture-based service interface data caching method, device and equipment
CN117009693A (en) * 2023-07-28 2023-11-07 浪潮通信信息系统有限公司 http request front-end caching method and device, electronic equipment and readable medium
CN117421499A (en) * 2023-10-18 2024-01-19 中移动信息技术有限公司 Front-end processing method, front-end processing device, terminal equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170177695A1 (en) * 2015-12-21 2017-06-22 Sap Se Synchronization of offline data
CN109361718A (en) * 2018-12-26 2019-02-19 上海银基信息安全技术股份有限公司 Identity identifying method, device and medium
WO2021169540A1 (en) * 2020-02-27 2021-09-02 郑州阿帕斯数云信息科技有限公司 Data caching method and device, and cloud server
CN113066209A (en) * 2021-03-23 2021-07-02 上海银基信息安全技术股份有限公司 Method and device for safe off-line use of digital key and storage medium
CN116226200A (en) * 2023-03-07 2023-06-06 智慧星光(安徽)科技有限公司 BFF architecture-based service interface data caching method, device and equipment
CN117009693A (en) * 2023-07-28 2023-11-07 浪潮通信信息系统有限公司 http request front-end caching method and device, electronic equipment and readable medium
CN117421499A (en) * 2023-10-18 2024-01-19 中移动信息技术有限公司 Front-end processing method, front-end processing device, terminal equipment and storage medium

Similar Documents

Publication Publication Date Title
KR102242766B1 (en) Identity registration method and device
US10460309B2 (en) Payment verification method, apparatus and system
KR102204733B1 (en) Method, device, and server for account login
US9697511B2 (en) Method for securing transactions, transaction device, bank server, mobile terminal, and corresponding computer programs
CN105337997B (en) Login method of application client and related equipment
CN107256387B (en) Fingerprint authentication method, system and computer readable storage medium
CN107862526B (en) Resource numerical value transferring method and device, storage medium and server
CN106162805B (en) WIFI hotspot service access control method and device
US11641356B2 (en) Authorization apparatus, data server and communication system
CN115457668B (en) Quick ticket checking method, device and system
CN111461223B (en) Training method of abnormal transaction identification model and abnormal transaction identification method
CN112506570A (en) Equipment instruction issuing method, system and server
CN112068854B (en) Intelligent device algorithm updating system, intelligent device and platform server
CN117914942B (en) Data request caching method and device, intelligent terminal and storage medium
CN107708064B (en) Method and system for positioning mobile phone by vehicle-mounted equipment
CN107644265B (en) Reservation method, device and system for shared object and server
CN111310145B (en) User right verification method and device and electronic equipment
CN117914942A (en) Data request caching method and device, intelligent terminal and storage medium
CN113709136B (en) Access request verification method and device
CN110597843A (en) Waybill query method and device, computer equipment and storage medium
CN111835504A (en) Identification code generation method and server
CN115604340A (en) Session control method and device, electronic equipment and storage medium
CN110830556A (en) Service processing method and device
CN110636494B (en) Network connection method and device of virtual SIM card and computer readable storage medium
CN108769080B (en) Method and system for logging in website by mobile terminal and website server

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant