CN114942959A - Data calling method, data calling device, electronic equipment and storage medium - Google Patents

Data calling method, data calling device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114942959A
CN114942959A CN202210636408.2A CN202210636408A CN114942959A CN 114942959 A CN114942959 A CN 114942959A CN 202210636408 A CN202210636408 A CN 202210636408A CN 114942959 A CN114942959 A CN 114942959A
Authority
CN
China
Prior art keywords
data
target
cache
layer
interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210636408.2A
Other languages
Chinese (zh)
Inventor
温秋明
钟加武
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202210636408.2A priority Critical patent/CN114942959A/en
Publication of CN114942959A publication Critical patent/CN114942959A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a data calling method, a data calling device, electronic equipment and a storage medium, and belongs to the field of data calling. The method comprises the following steps: acquiring and analyzing the data call request from the service layer to obtain target interface information so as to obtain a target cache interface of a target cache layer; performing data query on a target cache layer according to a target cache interface to obtain a query result; the query result comprises a first result that the target cache layer has cache data or a second result that the target cache layer does not have cache data; extracting initial cache data from a target cache layer according to a first result, or extracting initial storage data from a preset data access layer according to a second result; the target cache layer is positioned between the service layer and the data access layer; generating target data according to the initial cache data or the initial storage data; the target data is invoked. The embodiment can simplify the data calling process and improve the data calling efficiency.

Description

Data calling method, data calling device, electronic equipment and storage medium
Technical Field
The present application relates to the field of data processing, and in particular, to a data calling method and apparatus, an electronic device, and a storage medium.
Background
At present, when the same data needs to be called for many times, repeated calling instructions are often submitted for many times to obtain corresponding data, the execution process is complicated, the load of a system is often increased, and the response performance of the whole system is influenced. Therefore, how to reduce the system load caused by the data calling process becomes a problem to be solved urgently.
Disclosure of Invention
The embodiment of the application mainly aims to provide a data calling method and device, an electronic device and a storage medium, and the application can reduce system load caused by a data calling process and realize efficient calling of data.
In order to achieve the above object, a first aspect of the embodiments of the present application provides a data calling method, where the method includes:
acquiring a data calling request from a service layer;
analyzing the data calling request to obtain target interface information, and screening the interface of a pre-constructed target cache layer according to the target interface information to obtain a target cache interface;
performing data query on the target cache layer according to the target cache interface to obtain a query result; the query result comprises a first result that the target cache layer has cache data or a second result that the target cache layer does not have cache data;
extracting initial cache data from the target cache layer according to the first result, or extracting initial storage data from a preset data access layer according to a second result; wherein the target cache layer is located between the service layer and the data access layer;
generating target data according to the initial cache data or the initial storage data;
and calling the target data.
Analyzing the data call request to obtain target interface information, and screening the interface of the pre-constructed target cache layer according to the target interface information to obtain a target cache interface, wherein the method comprises the following steps:
acquiring a target data table field of the target cache layer;
acquiring a reference field according to the target interface information;
and screening the candidate buffer interfaces of the target cache layer according to the data table field and the reference field to obtain the target cache interface.
In some embodiments, before the performing the data query on the target cache layer according to the target cache interface to obtain the query result, the method further includes constructing the target cache layer, including:
traversing the data access layer, and performing query processing on an initial cache layer to obtain a first mapping relation between the data access layer and the initial cache layer;
acquiring a first dependency relationship between a service layer and the data access layer;
and converting the first dependency relationship according to the first mapping relationship to obtain a second dependency relationship between the service layer and the initial cache layer, and generating the target cache layer according to the second dependency relationship.
In some embodiments, the extracting initial cache data from the target cache layer according to the first result or extracting initial storage data from a preset data access layer according to a second result includes:
if the target data table field corresponding to the target cache interface is in a complete non-empty state, constructing a first cache key according to the target data table field;
performing data query according to the first cache key to obtain a first query result, and extracting the initial cache data from the target cache layer according to the first query result; or, performing data query according to the first cache key to obtain a second query result, and extracting the initial storage data from a preset data access layer according to the second query result.
In some embodiments, the extracting initial cache data from the target cache layer according to the first result or extracting initial storage data from a preset data access layer according to a second result includes:
if the target data table field corresponding to the target cache interface is in a complete non-empty state, constructing a second cache key according to the interface information of the data access layer;
performing data query according to the second cache key to obtain a third query result, and extracting the initial cache data from the target cache layer according to the third query result; or, performing data query according to the second cache key to obtain a fourth query result, and extracting the initial storage data from a preset data access layer according to the fourth query result.
In some embodiments, the interface information includes first entry parameter information and second entry parameter information, and if a target data table field corresponding to the target cache interface is in a complete non-empty state, constructing a second cache key according to the interface information of the data access layer includes:
if the target data table field corresponding to the target cache interface is in a complete non-empty state, acquiring first access information and second access information between the data access layers;
encrypting the first parameter entering information to obtain a first parameter entering ciphertext;
encrypting the second parameter entering information to obtain a second parameter entering ciphertext;
and constructing the second cache key according to the first parameter-entering ciphertext and the second parameter-entering ciphertext.
In some embodiments, after the get data call instruction data call request gets a data call request from the service layer, the method further comprises:
monitoring the working state of the target cache layer according to the data call instruction data call request to obtain initial monitoring data;
and carrying out format conversion on the initial monitoring data to obtain a target monitoring file, wherein the target monitoring file is used for optimizing the target cache layer.
In order to achieve the above object, a second aspect of the embodiments of the present application provides a data calling apparatus, where the method includes:
the request acquisition module is used for acquiring a data calling request from a service layer;
the interface screening module is used for screening the interface of the pre-constructed target cache layer according to the data calling instruction data calling request to obtain a target cache interface;
the data query module is used for carrying out data query according to the target cache interface to obtain a query result; the query result comprises a first result that the target cache layer has cache data or a second result that the target cache layer does not have cache data;
the data extraction module is used for extracting initial cache data from the target cache layer according to the first result or extracting initial storage data from a preset data access layer according to a second result; wherein the target cache layer is located between the service layer and the data access layer;
the data screening module is used for generating target data according to the initial cache data or the initial storage data;
and the data calling module is used for calling the target storage data.
In order to achieve the above object, a third aspect of the embodiments of the present application provides an electronic device, which includes a memory, a processor, a program stored on the memory and executable on the processor, and a data bus for implementing connection communication between the processor and the memory, wherein the program, when executed by the processor, implements the method of the first aspect.
To achieve the above object, a fourth aspect of the embodiments of the present application proposes a storage medium, which is a computer-readable storage medium for computer-readable storage, and stores one or more programs, which are executable by one or more processors to implement the method of the first aspect.
The data calling method, the data calling device, the electronic equipment and the storage medium aim to obtain a storage position corresponding to storage data corresponding to a data calling request by analyzing the data calling request, and obtain a target cache interface corresponding to the storage position by screening; through the target cache interface, the method can extract initial cache data from a target cache layer corresponding to the target cache interface, or extract initial storage data from a data access layer corresponding to the target cache interface; by screening the obtained initial cache data, the cache data corresponding to the initial cache data calling request in the target cache layer can be obtained, and corresponding first results and second results are obtained according to the storage state of the cache data; according to the first result, the initial cache data is directly extracted from the target cache layer, or according to the second result, the initial storage data is indirectly extracted from a preset data access layer through the target cache layer; therefore, the initial cache data or the initial storage data are screened to obtain target data to be called, and then the target data are called. The cache layer provided by the application calls the data file corresponding to the request, so that the data access times between the cache layer and the database can be effectively reduced, and the integral stability of the system is ensured; in addition, for multiple data calling requests, the method and the device can call the corresponding data of the calling requests by calling the corresponding data from the cache layer for the parts of the same data in the calling requests, so that the calling process is simplified, and the data calling efficiency is effectively improved.
Drawings
Fig. 1 is a flowchart of a data call method provided in an embodiment of the present application;
fig. 2 is a flowchart of S200 in fig. 1.
Fig. 3 is another flowchart of a data calling method according to an embodiment of the present application.
Fig. 4 is a flowchart of S400 in fig. 1.
Fig. 5 is another flowchart of S400 in fig. 1.
Fig. 6 is a flowchart of S440 in fig. 5.
Fig. 7 is another flowchart of a data call method according to an embodiment of the present application.
Fig. 8 is a functional block diagram of a data call apparatus according to an embodiment of the present application.
Fig. 9 is a functional block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
It should be noted that although functional blocks are partitioned in a schematic diagram of an apparatus and a logical order is shown in a flowchart, in some cases, the steps shown or described may be performed in a different order than the partitioning of blocks in the apparatus or the order in the flowchart. The terms first, second and the like in the description and in the claims, and the drawings described above, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the application.
First, several terms referred to in the present application are resolved:
structured Query Language (SQL): is a standard computer language for accessing and processing databases and is used for managing a relational database management system, including data insertion, query, update and deletion, database schema creation and modification, data access control and the like. The same structured query language can be used as an interface for data entry and management, even for database systems of different underlying structures.
SSM framework layering (Spring + SpringMVC + MyBatis): including a Dao layer, a Service layer, a Controller layer (Handler layer), and a View layer. The data processing method comprises the following steps that a Dao layer is used for processing data services according to a calling interface, wherein parameters related to database connection are all configured and realized in a data source of the Dao layer; and the Service layer is used for carrying out corresponding logic application design according to the Service requirement. The Dao layer and the Service layer are independent from each other and can be designed in a split mode, and the Controller layer (Handler layer) and the View layer are mainly responsible for controlling specific business processes and displaying effects of foreground pages and generally need to be designed in a combined mode.
Redis caching: the remote Dictionary service (Redis) is an open source, written by using ANSI C language, supporting network, a log-type and Key-Value database which can be based on memory and can also be persistent, and provides API Redis of multiple languages as a Key-Value storage system, and the Value types supported for storage comprise string, list, set, zset and hash. These data types all support push/pop, add/remove, and intersect union and difference, and richer operations, and these operations are all atomic. On this basis, Redis supports various different ways of ordering. As with memcached, data is cached in memory to ensure efficiency. The difference is that Redis periodically writes updated data to a disk or writes a modification operation to an additional recording file, and a master-slave synchronization is realized on the basis of the updated data or the modification operation.
Jvm cache: JVM is an abbreviation for Java Virtual Machine, which is essentially a piece of software. The JVM is a specification for a computing device, which is an imaginary computer implemented by emulating and simulating various computer functions on an actual computer.
MD 5: a widely used cryptographic hash function generates a 128-bit (16-byte) hash value to ensure the integrity of the message transmission. The method has the characteristics of universality, stability and quickness, and is applied to the field of encryption protection of common data.
AOP: AOP is an abbreviation for Aspect organized Programming, meaning: the method is a technique for realizing the unified maintenance of the program functions by a precompilation mode and a dynamic proxy during the running process in the aspect-oriented programming. The AOP is a continuation of the OOP, is a hot spot in software development, is also an important content in a Spring framework, and is a derivative paradigm of functional programming. By utilizing the AOP, all parts of the business logic can be isolated, so that the coupling degree between all parts of the business logic is reduced, the reusability of a program is improved, and the development efficiency is improved.
Spring: the Spring framework is an open source J2EE application framework, and is a lightweight container (light container) for managing the lifecycle of beans. The Spring framework mainly comprises seven parts, namely Spring Core, Spring AOP, Spring ORM, Spring DAO, Spring context Spring Web and Spring Web MVC. Spring provides functions such as powerful IOC, AOP, Web MVC and the like, can be independently applied to construction of application programs, can be combined with a plurality of Web frameworks such as Struts, Webwork, Tapestry and the like, and can be combined with desktop application programs such as Swing and the like, namely AP. Therefore, Spring can be applied not only to the J2EE application, but also to desktop applications and applets.
At present, when the same data needs to be called for many times, repeated calling instructions are often submitted for many times to obtain corresponding data, the execution process is complicated, the load of a system is often increased, and the response performance of the whole system is influenced. Therefore, how to reduce the system load caused by the data calling process becomes a problem to be solved urgently.
Based on this, the embodiment of the application provides a data calling method, a data calling device, an electronic device and a storage medium, which can reduce system load caused by a data calling process.
The embodiments of the present application provide a data calling method, a data calling apparatus, an electronic device, and a storage medium, and are specifically described with reference to the following embodiments, where first, the data calling method in the embodiments of the present application is described.
The embodiment of the application provides a data calling method, and relates to the technical field of software development and testing. The data calling method provided by the embodiment of the application can be applied to a terminal, a server side and software running in the terminal or the server side. In some embodiments, the terminal may be a smartphone, tablet, laptop, desktop computer, smart watch, or the like; the server can be an independent server, and can also be a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, Network service, cloud communication, middleware service, domain name service, security service, Content Delivery Network (CDN), big data and artificial intelligence platform and the like; the software may be an application or the like implementing a data call method, but is not limited to the above form.
The application is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
Embodiments of the present application are further described below with reference to the accompanying drawings.
Fig. 1 is an optional flowchart of a data call method provided in an embodiment of the present application, where the method in fig. 1 may include, but is not limited to, steps S100 to S600.
Step S100, obtaining a data calling request from a service layer;
step S200, analyzing the data call request to obtain target interface information, and screening the interface of a pre-constructed target cache layer according to the target interface information to obtain a target cache interface;
step S300, performing data query on the target cache layer according to a target cache interface to obtain a query result; the query result comprises a first result that the target cache layer has cache data or a second result that the target cache layer does not have cache data;
step S400, extracting initial cache data from a target cache layer according to a first result, or extracting initial storage data from a preset data access layer according to a second result; the target cache layer is positioned between the service layer and the data access layer;
step S500, generating target data according to the initial cache data or the initial storage data;
in step S600, target data is called.
In steps S100 to S600 illustrated in the embodiment of the present application, the data call request is obtained through the acquisition service layer. Specifically, the method and the device can obtain query requests corresponding to all data required to be queried by a user through a service layer, and summarize all the requests to obtain a data call request corresponding to call of each data; the target cache interface is obtained by analyzing the data calling request, and the interface of the pre-constructed target cache layer is screened according to the target interface information, so that the target cache interface is obtained; the method comprises the steps that data query is carried out on a target cache layer according to a target cache interface to obtain a query result, communication connection is established between the target cache interface and the target cache layer, so that traversal query is carried out on data stored in the target cache layer, and a corresponding query result is obtained, wherein the query result comprises a first result that cache data exist in the target cache layer or a second result that cache data do not exist in the target cache layer, and initial data are called from different storage areas according to different obtained query results; the initial data may be initial cache data or initial storage data. Specifically, according to a first result, extracting initial cache data from a target cache layer, or according to a second result, extracting initial storage data from a preset data access layer; the target cache layer is positioned between the service layer and the data access layer; finally, target data are generated according to the initial cache data or the initial storage data; specifically, when the application acquires initial cache data, the initial cache data is used as target data, or when the application acquires initial storage data, the initial storage data is used as target data. It should be noted that the method can only obtain one of the initial storage data or the initial cache data. When the initial cache data or the initial storage data is acquired at the same time, the method re-executes step S300 to determine the storage state of the cache data in the target cache layer, so as to acquire the initial cache data or the initial storage data. By the method, the application provides a new query mechanism, namely, the data in the target cache layer is queried by acquiring a data call request from a service layer and communicating with the target cache layer through an interface, a first result is output when the cache data is stored in the target cache layer, and initial cache data is directly called from the target cache layer according to the first result to obtain the target data; or when the cache data is not stored in the query target cache layer, the data access layer is accessed through the target cache layer to realize the calling of the initial storage data so as to obtain the target data. The method and the device have the advantages that the access process can be more concise, frequent reading and calling of the data access layer are avoided, and the method and the device can effectively improve the stability of the system.
Referring to fig. 2, in some embodiments, step S200 may include, but is not limited to including, step S210 and step S230:
step S210, acquiring a target data table field of a target cache layer;
step S220, acquiring a reference field according to the target interface information;
and step S220, screening the candidate buffer interfaces of the target buffer layer according to the data table field and the reference field to obtain the target buffer interface.
In step S210 of some embodiments, a preset target cache layer is provided with a corresponding target data table field, and the target data table field depends on a tangent plane added by an AOP mechanism, and is matched with a preset reference field according to the target data table field of the preset target cache layer, so as to achieve acquisition of a target cache interface.
In step S230 of some embodiments, the target interface information includes a reference field of the target cache interface in communication connection with the target cache layer. The reference field can be used as an identity of the target cache interface, so that all available interfaces of the target cache layer are screened through the reference field to obtain the target cache interface.
In step S230 of some embodiments, the method provided by the present application performs matching analysis on the acquired data table field and a preset reference field to obtain association degree data of the data table field and the reference field, and filters all association degree data obtained through the matching analysis according to a preset association degree matching threshold to obtain a target cache interface corresponding to the association degree data meeting the matching requirement limited by the association degree matching threshold. In some specific embodiments, the method can also capture the data table fields of the target cache interfaces obtained through screening, and summarize the captured data table fields into the interface information directory to simplify the subsequent repeated calling process of the data.
Referring to fig. 3, in some embodiments, before step S300, the method further includes: constructing a target cache layer, specifically including but not limited to including steps S310 to S330:
step S310, traversing the data access layer, and inquiring the initial cache layer to obtain a first mapping relation between the data access layer and the initial cache layer;
step S320, acquiring a first dependency relationship between the service layer and the data access layer;
and step S330, converting the first dependency relationship according to the first mapping relationship to obtain a second dependency relationship between the service layer and the initial cache layer, and generating a target cache layer according to the second dependency relationship.
In step S310 of some embodiments, the present application traverses the data access layer in advance, and correspondingly queries a communication connection relationship between the initial cache layer and the data access layer according to a traversal result, so as to obtain a first mapping relationship including a communication connection line between the data access layer and the initial cache layer;
in step S320 in some embodiments, the application may obtain a communication relationship between the service layer and the data access layer, and obtain a corresponding first dependency relationship; through the first dependency relationship, the service layer can directly call the data stored in the data access layer according to the query request, but the service layer does not screen the data required to be queried by each query request. For the same query request, the service layer will perform repeated query actions, so as to make repeated calls for the same data.
In step S330 of some embodiments, the present application readjusts the dependency relationship among the service layer, the initial cache layer, and the data access layer, so that the method changes the dependency relationship among the service layer, the initial cache layer, and the data access layer into a second dependency relationship according to the first dependency relationship and the first mapping relationship, and redefines the attribute of the initial cache layer according to the second dependency relationship, thereby generating a target cache layer; through the second dependency relationship, the method realizes the access paths from the service layer to the target cache layer and from the target cache layer to the data access layer, and further realizes the caching of the call data through the target cache layer and the communication path for accessing the data access layer through the target cache layer.
In some specific embodiments, the method first scans an initial cache layer appointed for use to obtain an initial cache interface file of the initial cache layer, and records an association relation corresponding to a data access layer which is in communication connection with the initial cache interface file; the method also comprises the steps of traversing an available initial cache layer of the data access layer, resetting the initial dependency relationship from the service layer to the data access layer through a reflection mechanism, updating the dependency relationship of the data access layer, converting the initial cache layer to the target cache layer according to the updated dependency relationship, changing the dependency relationship of the service layer from the initial service layer to the data access layer into the dependency relationship from the service layer to the target cache layer to the data access layer, and calling the data through the target cache layer.
In some other embodiments, the conversion of the initial cache layer into the target cache layer according to the dependency relationship needs to be completed before the service layer dependency relationship is changed, so as to ensure that the service layer dependency relationship can be stably changed.
Referring to fig. 4, in some embodiments, step S400 includes, but is not limited to, steps S410 to S420:
step S410, if the target data table field corresponding to the target cache interface is in a complete non-empty state, a first cache key is constructed according to the target data table field;
step S420, performing data query according to the first cache key to obtain a first query result, and extracting initial cache data from the target cache layer according to the first query result; or, performing data query according to the first cache key to obtain a second query result, and extracting initial storage data from a preset data access layer according to the second query result.
In step S410 of some embodiments, the present application provides a method for establishing a target cache interface corresponding to a target cache layer to be accessed according to a target data table field, and generates a first cache key between the target cache layers to be accessed by detecting whether the target data table field is in a complete non-empty state.
In step S420 of some embodiments, the present application performs data query on a data storage state in the target cache layer according to the first cache key, and outputs a first query result when the data corresponding to the data call request is stored in the target cache layer, so as to extract initial cache data corresponding to the data call request from the target cache layer according to the first query result. Or after the data calling method provided by the application realizes the communication connection with the target cache layer through the first cache key, the method can inquire the storage state of the initial cache data corresponding to the data calling request in the target cache layer, and output the second inquiry result when detecting that the initial cache data is not stored in the target cache layer, so as to perform communication interaction with the data access layer according to the second inquiry result, and realize calling the initial storage data stored in the data access layer.
In some specific embodiments, the data call method provided by the present application may construct the access key according to the data state of the target data table field, and specifically, the method may read the data state of the target data table field corresponding to the target cache interface when communicating with any available target cache interface of the target cache layer. When the parameter information in the field of the target data table meets the complete non-empty state, the method can extract the parameter information in the field of the target data table and directly generate a corresponding first cache key according to the parameter information. Through the first cache key, the method can be connected with the specified target cache interface in a matching mode, and therefore data access and call of the target cache interface are achieved. When detecting that the initial cache data are stored in the target cache layer, generating a first query result representing that the calling data corresponding to the data calling request are stored in the target cache layer, and calling the target cache data by the control system according to the first query result, thereby realizing the calling of the data; or when detecting that the initial cache data is not stored in the target cache layer, generating a second query result representing that the target cache layer does not store the call data corresponding to the data call request, and controlling the system to access the data access layer according to the second query result, so as to query the target storage data and call the target storage data in the data access layer, thereby realizing the call of the data.
In some other embodiments, the data calling method provided by the application may further start a data capture process after the second query result is obtained. Specifically, when the second query result is detected, the called target storage data is captured, and a target data table field corresponding to the first cache key is obtained. According to the field of the target data table, the method can position the target cache interface used in the data calling process, and the captured target storage data is transferred to the target cache layer as the target cache data corresponding to the data calling request. By the method, SQL IO requests between the target cache layer and the data access layer can be avoided in the next data calling process, the target cache data transferred into the target cache layer can be directly called, the data query frequency is reduced, and the system load during data calling is effectively reduced.
Referring to fig. 5, in some embodiments, step S400 further includes, but is not limited to, steps S430 to S440:
step S430, if the target data table field corresponding to the target cache interface is in a complete non-empty state, constructing a second cache key according to the interface information of the data access layer;
step S440, performing data query according to the second cache key to obtain a third query result, and extracting initial cache data from the target cache layer according to the third query result; or, performing data query according to the second cache key to obtain a fourth query result, and extracting initial storage data from a preset data access layer according to the fourth query result.
In step S430 of some embodiments, the data state of the target data table field corresponding to the target cache interface is detected, and when the parameter information in the target data table field is in a complete non-empty state, the method may further construct a second cache key according to the target data table field and according to a preset construction rule.
In step S440 of some embodiments, the present application may make a call to data in the target cache layer according to the second cache key. When detecting that initial cache data corresponding to the data calling request is stored in the target cache layer, obtaining a third query result; and extracting initial cache data stored in the target cache layer according to the third query result. Or when detecting that the initial cache data corresponding to the data calling request is not stored in the target cache layer, obtaining a fourth query result; and accessing the data access layer through the target cache layer according to the fourth query result, and calling the initial village coarse data stored in the data access layer to obtain initial storage data.
In some specific embodiments, the application intercepts the interface information of the data access layer by using the Spring AOP technology, so as to prevent the target cache layer from directly calling the data access layer, thereby improving the security of the data calling process. Specifically, after intercepting the interface reference of the target cache layer to the data access layer, the method performs encryption processing according to the target data table field corresponding to the target cache interface and the limited name of the interface to obtain a second cache key, and queries the initial cache data in the target cache layer through the second cache key. When the initial cache data stored in the target cache layer is queried, the method can output a third query result and call the initial cache data; or, when it is queried that the initial cache data is not stored in the target cache layer, the method may output a fourth query result, and access the data access layer through the target cache layer according to the fourth query result, thereby invoking the target storage data stored in the data access layer.
In some other embodiments, the target cache layer provided by the present application provides different cache designs according to different cache media. The data calling method provided by the application can be applied to Redis cache. When the method is applied to Redis cache, each object in the table is designed to be a Hash structure object of Redis, and keys of target storage data corresponding to each Hash structure object are stored one by one. That is, the key corresponding to each hash object corresponds to one piece of target cache data. When the target cache data needs to be called, the method accesses by acquiring the key in the field of the target data table to obtain the corresponding target cache data.
In some other embodiments, the target cache layer provided by the present application provides different cache designs according to different cache media. The data calling method provided by the application can also be applied to Jvm caching. When the method is applied to Jvm cache, the method designs a Map object for each table correspondingly, and stores the target storage data in one-to-one correspondence with the Map object. And accessing the corresponding Map object in each table according to the corresponding key, and further querying the target cache data corresponding to the Map object so as to realize the calling of the target cache data.
Referring to fig. 6, in some embodiments, step S430 includes, but is not limited to, steps S431 to S434:
step S431, if the target data table field corresponding to the target cache interface is in a complete non-empty state, acquiring first parameter entering information and second parameter entering information between data access layers;
step S432, encrypting the first parameter entering information to obtain a first parameter entering ciphertext;
step S433, encrypting the second parameter entering information to obtain a second parameter entering ciphertext;
step S434, constructing a second cache key according to the first parameter-entering ciphertext and the second parameter-entering ciphertext.
In steps S431 to S434 of some embodiments, the present application extracts parameter information of a target cache interface in which a target data table field is in a non-empty state, obtains first entry information and second entry information, encrypts the first entry information to obtain a first entry ciphertext, and encrypts the second entry information to obtain a second entry ciphertext; through the first parameter-entering ciphertext and the second parameter-entering ciphertext, the method can construct a second cache key, and further query and call the storage state of the target cache data in the target cache layer through the second cache key, or access the data access layer through the target cache layer through the second cache key, and call the target storage data stored in the data access layer. By the method, the access security of accessing the target cache layer through the second cache key is effectively guaranteed, and the security of the data calling method provided by the application is improved.
In some specific embodiments, the data calling method provided by the present application uses a Spring AOP technology to intercept an interface of a data access layer, and instead, realizes communication connection between a target cache layer and the data access layer through a second key. Specifically, the method can obtain the full qualified name of the target cache interface, and encrypt the full qualified name of the target cache interface as the first parameter entering information to obtain the first parameter entering ciphertext. The method can also acquire the actual parameter entering information of the target cache interface, and splice the acquiring sequence of the actual parameter entering information into a character string file as second parameter entering information, so as to obtain a second parameter entering ciphertext by encrypting the second parameter entering information. In some embodiments, the encryption method employs MD5 as an encryption means to achieve encryption of the incoming reference information. And a second cache key generated by encrypting with an MD5 encryption method is obtained by splicing the obtained first parameter-entering ciphertext and the second parameter-entering ciphertext, so that target cache data stored in cache media such as Redis and Jvm are queried and called through the second cache key, and the security of the data calling method provided by the application is improved.
In some other embodiments, when the cache medium corresponding to the target cache layer is queried through the second key and the corresponding target cache file is stored therein, the method may directly call and return the queried target cache file to the service layer to output the call file; and the service layer is prevented from carrying out SQL IO request on the data access layer through the target cache layer, so that the system load is reduced, and the calling efficiency of the data calling method is improved.
Referring to fig. 7, in some embodiments, after step S100 and before step S200, the data calling method includes, but is not limited to, steps S700 to S800:
step S700, monitoring the working state of a target cache layer according to a data calling request to obtain initial monitoring data;
step S800, format conversion is carried out on the initial monitoring data to obtain a target monitoring file, and the target monitoring file is used for optimizing a target cache layer.
In step S700 of some embodiments, the present application may establish a monitoring mechanism according to the data call request. Specifically, the method monitors real-time information such as interface calling start time, end time, interface cache use condition, interface name, access parameter information, actual access parameter information, dynamic information and the like of a data access layer by taking an interface as a unit aiming at statistics of an SQL (structured query language) level to obtain initial monitoring data. The initial monitoring data is stored in the memory by taking the interface as a unit so as to provide a calling basis of the initial monitoring data.
In step S800 in some embodiments, the method and the device may analyze the system characteristics represented by the initial monitoring data to be called, perform format conversion on the data representing the working state of the data access layer included in the system characteristics to obtain a target monitoring file, feed back the target monitoring file to the current data calling system, and optimize the calling accuracy and calling efficiency of the target cache layer in the data caching and data calling processes.
In some specific embodiments, the data calling method provided by the application uses a Spring AOP mechanism to monitor an interface of a data access layer accessed through a target cache layer, and encapsulates real-time information such as interface calling start time, end time, interface cache use condition, interface name, access information, actual access information, dynamic information and the like obtained in the monitoring process into counter objects uniformly according to the obtained interface units as units, so that each interface corresponds to a counter object corresponding to initial monitoring data. The method also provides an additional interface for triggering the initial monitoring data in the counter object format corresponding to each interface in the monitoring process, and outputting the triggered initial monitoring data in the Json format to form a target monitoring file. Therefore, the current working state between the target cache layer and the data access layer is fed back in real time, and the design optimization of the target cache layer is further realized.
Referring to fig. 8, an embodiment of the present application further provides a data call device, which can implement the data call method, where the data call device includes:
a request obtaining module 100, configured to obtain a data call request from a service layer;
the interface screening module 200 is configured to screen an interface of a pre-constructed target cache layer according to the data call instruction data call request to obtain a target cache interface;
the data query module 300 is configured to perform data query according to the target cache interface to obtain a query result; the query result comprises a first result that the target cache layer has cache data or a second result that the target cache layer does not have cache data;
a data extraction module 400, configured to extract initial cache data from a target cache layer according to a first result, or extract initial storage data from a preset data access layer according to a second result; the target cache layer is positioned between the service layer and the data access layer;
a data screening module 500, configured to generate target data according to the initial cache data or the initial storage data;
and a data calling module 600, configured to call the target storage data.
The specific implementation of the data calling device is basically the same as the specific implementation of the data calling method, and is not described herein again.
Referring to fig. 9, fig. 9 illustrates a hardware structure of an electronic device according to another embodiment, where the electronic device includes:
the processor 901 may be implemented by a general-purpose CPU (central processing unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits, and is configured to execute a relevant program to implement the technical solution provided in the embodiment of the present application;
the memory 902 may be implemented in the form of a Read Only Memory (ROM), a static storage device, a dynamic storage device, or a Random Access Memory (RAM). The memory 902 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present disclosure is implemented by software or firmware, the relevant program codes are stored in the memory 902 and called by the processor 901 to execute the data calling method of the embodiments of the present disclosure;
an input/output interface 903 for implementing information input and output;
a communication interface 904, configured to implement communication interaction between the device and another device, where communication may be implemented in a wired manner (e.g., USB, network cable, etc.), or in a wireless manner (e.g., mobile network, WIFI, bluetooth, etc.);
a bus 905 that transfers information between various components of the device (e.g., the processor 901, the memory 902, the input/output interface 903, and the communication interface 904);
wherein the processor 901, the memory 902, the input/output interface 903 and the communication interface 904 enable a communication connection within the device with each other through a bus 905.
The embodiment of the present application further provides a storage medium, which is a computer-readable storage medium for computer-readable storage, and the storage medium stores one or more programs, and the one or more programs are executable by one or more processors to implement the data call method.
The memory, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs as well as non-transitory computer executable programs. Further, the memory may include high speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory optionally includes memory located remotely from the processor, and these remote memories may be connected to the processor through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The data calling method, the data calling device, the electronic equipment and the storage medium aim to obtain a storage position corresponding to storage data corresponding to a data calling request by analyzing the data calling request, and obtain a target cache interface corresponding to the storage position by screening; through the target cache interface, the method can extract initial cache data from a target cache layer corresponding to the target cache interface, or extract initial storage data from a data access layer corresponding to the target cache interface; by screening the obtained initial cache data, the cache data corresponding to the initial cache data calling request in the target cache layer can be obtained, and a corresponding first result and a corresponding second result are obtained according to the storage state of the cache data; according to the first result, the initial cache data is directly extracted from the target cache layer, or according to the second result, the initial storage data is indirectly extracted from a preset data access layer through the target cache layer; therefore, the initial cache data or the initial storage data are screened to obtain target data to be called, and then the target data are called. The cache layer provided by the application calls the data file corresponding to the request, so that the data access times between the cache layer and the database can be effectively reduced, and the integral stability of the system is ensured; in addition, for multiple data call requests, the method and the device can call the corresponding data of the call request by calling the corresponding data from the cache layer for the part with the same data in the call request, simplify the call process and effectively improve the call efficiency of the data call method.
The embodiments described in the embodiments of the present application are for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation to the technical solutions provided in the embodiments of the present application, and it is obvious to those skilled in the art that the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems with the evolution of technology and the emergence of new application scenarios.
It will be appreciated by those skilled in the art that the solutions shown in fig. 1-9 are not intended to limit the embodiments of the present application and may include more or fewer steps than those shown, or some of the steps may be combined, or different steps may be included.
The above-described embodiments of the apparatus are merely illustrative, wherein the units illustrated as separate components may or may not be physically separate, i.e. may be located in one place, or may also be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
One of ordinary skill in the art will appreciate that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof.
The terms "first," "second," "third," "fourth," and the like in the description of the application and the above-described figures, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that, in this application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b and c may be single or plural.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the above-described division of units is only one type of division of logical functions, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes multiple instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform all or part of the steps of the method of the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing programs, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The preferred embodiments of the present application have been described above with reference to the accompanying drawings, and the scope of the claims of the embodiments of the present application is not limited thereto. Any modifications, equivalents and improvements that may occur to those skilled in the art without departing from the scope and spirit of the embodiments of the present application are intended to be within the scope of the claims of the embodiments of the present application.

Claims (10)

1. The data calling method is characterized by comprising the following steps:
acquiring a data calling request from a service layer;
analyzing the data calling request to obtain target interface information, and screening the interface of a pre-constructed target cache layer according to the target interface information to obtain a target cache interface;
performing data query on the target cache layer according to the target cache interface to obtain a query result; the query result comprises a first result that the target cache layer has cache data or a second result that the target cache layer does not have cache data;
extracting initial cache data from the target cache layer according to the first result, or extracting initial storage data from a preset data access layer according to a second result; wherein the target cache layer is located between the service layer and the data access layer;
generating target data according to the initial cache data or the initial storage data;
and calling the target data.
2. The data calling method according to claim 1, wherein the parsing the data calling request to obtain target interface information, and performing a screening process on a pre-constructed interface of a target cache layer according to the target interface information to obtain a target cache interface comprises:
acquiring a target data table field of the target cache layer;
acquiring a reference field according to the target interface information;
and screening the candidate buffer interfaces of the target cache layer according to the data table field and the reference field to obtain the target cache interface.
3. The data call method according to claim 1, wherein before the data query is performed on the target cache layer according to the target cache interface to obtain the query result, the method further includes constructing the target cache layer, including:
traversing the data access layer, and performing query processing on an initial cache layer to obtain a first mapping relation between the data access layer and the initial cache layer;
acquiring a first dependency relationship between a service layer and the data access layer;
and converting the first dependency relationship according to the first mapping relationship to obtain a second dependency relationship between the service layer and the initial cache layer, and generating the target cache layer according to the second dependency relationship.
4. The data call method according to claim 1, wherein the extracting initial cache data from the target cache layer according to the first result or extracting initial storage data from a preset data access layer according to a second result comprises:
if the target data table field corresponding to the target cache interface is in a complete non-empty state, constructing a first cache key according to the target data table field;
performing data query according to the first cache key to obtain a first query result, and extracting the initial cache data from the target cache layer according to the first query result; or, performing data query according to the first cache key to obtain a second query result, and extracting the initial storage data from a preset data access layer according to the second query result.
5. The data call method according to claim 1, wherein the extracting initial cache data from the target cache layer according to the first result or extracting initial storage data from a preset data access layer according to a second result comprises:
if the target data table field corresponding to the target cache interface is in a complete non-empty state, constructing a second cache key according to the interface information of the data access layer;
performing data query according to the second cache key to obtain a third query result, and extracting the initial cache data from the target cache layer according to the third query result; or, performing data query according to the second cache key to obtain a fourth query result, and extracting the initial storage data from a preset data access layer according to the fourth query result.
6. The data call method according to claim 5, wherein the interface information includes first entry parameter information and second entry parameter information, and the constructing a second cache key according to the interface information of the data access layer if the target data table field corresponding to the target cache interface is in a complete non-empty state includes:
if the target data table field corresponding to the target cache interface is in a complete non-empty state, acquiring first access information and second access information between the data access layers;
encrypting the first parameter entering information to obtain a first parameter entering ciphertext;
encrypting the second parameter entering information to obtain a second parameter entering ciphertext;
and constructing the second cache key according to the first parameter-entering ciphertext and the second parameter-entering ciphertext.
7. The data invocation method according to any one of claims 1 to 6, wherein after the data invocation request obtains the data invocation request from the service layer, the method further comprises:
monitoring the working state of the target cache layer according to the data calling request to obtain initial monitoring data;
and carrying out format conversion on the initial monitoring data to obtain a target monitoring file, wherein the target monitoring file is used for optimizing the target cache layer.
8. A data call apparatus, comprising:
the request acquisition module is used for acquiring a data calling request from a service layer;
the interface screening module is used for analyzing the data calling request to obtain target interface information and screening the interface of a pre-constructed target cache layer according to the target interface information to obtain a target cache interface;
the data query module is used for performing data query on the target cache layer according to the target cache interface to obtain a query result; the query result comprises a first result that the target cache layer has cache data or a second result that the target cache layer does not have cache data;
the data extraction module is used for extracting initial cache data from the target cache layer according to the first result or extracting initial storage data from a preset data access layer according to a second result; wherein the target cache layer is located between the service layer and the data access layer;
the data screening module is used for generating target data according to the initial cache data or the initial storage data;
and the data calling module is used for calling the target storage data.
9. An electronic device, characterized in that the electronic device comprises a memory, a processor, a computer program stored on the memory and executable on the processor, and a data bus for enabling a connection communication between the processor and the memory, the computer program, when executed by the processor, implementing the steps of the data call method according to any one of claims 1 to 7.
10. A storage medium, which is a computer-readable storage medium, for computer-readable storage, characterized in that the storage medium stores one or more computer programs, which are executable by one or more processors to implement the steps of the data call method of any one of claims 1 to 7.
CN202210636408.2A 2022-06-07 2022-06-07 Data calling method, data calling device, electronic equipment and storage medium Pending CN114942959A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210636408.2A CN114942959A (en) 2022-06-07 2022-06-07 Data calling method, data calling device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210636408.2A CN114942959A (en) 2022-06-07 2022-06-07 Data calling method, data calling device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114942959A true CN114942959A (en) 2022-08-26

Family

ID=82909857

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210636408.2A Pending CN114942959A (en) 2022-06-07 2022-06-07 Data calling method, data calling device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114942959A (en)

Similar Documents

Publication Publication Date Title
US11775435B2 (en) Invalidation and refresh of multi-tier distributed caches
Li et al. EtherQL: a query layer for blockchain system
US11106816B2 (en) Database public interface
US11036754B2 (en) Database table conversion
US10291704B2 (en) Networked solutions integration using a cloud business object broker
US10747670B2 (en) Reducing latency by caching derived data at an edge server
US11423041B2 (en) Maintaining data lineage to detect data events
US20170161291A1 (en) Database table conversion
US20170161511A1 (en) Database public interface
US11436066B2 (en) System for offline object based storage and mocking of rest responses
CN110334297A (en) Loading method, terminal, server and the storage medium of terminal page
US10725799B2 (en) Big data pipeline management within spreadsheet applications
US20230118838A1 (en) Advanced agent instrumentation for opentelemetry implementations
EP3462341B1 (en) Local identifiers for database objects
CN114942959A (en) Data calling method, data calling device, electronic equipment and storage medium
CN115455006A (en) Data processing method, data processing device, electronic device, and storage medium
US11816090B2 (en) Selectively processing an event published responsive to an operation on a database record that relates to consent
CN105610908B (en) A kind of samba service implementing method and system based on Android device
CN113495747B (en) Gray scale release method and device
US20230247111A1 (en) Runtime module conversion
US20230319054A1 (en) Tenant-specific solution subscriptions for an extensibility platform
US20230315428A1 (en) Extensibility platform
US20230315418A1 (en) Flexible meta model (fmm) for an extensibility platform
CN117234899A (en) Regression testing method, device, equipment and computer medium
CN115495781A (en) Method and device for generating function page for demonstration, electronic equipment and storage medium

Legal Events

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