CN112035509A - Medical cache data query method, device, equipment and storage medium - Google Patents

Medical cache data query method, device, equipment and storage medium Download PDF

Info

Publication number
CN112035509A
CN112035509A CN202010884349.1A CN202010884349A CN112035509A CN 112035509 A CN112035509 A CN 112035509A CN 202010884349 A CN202010884349 A CN 202010884349A CN 112035509 A CN112035509 A CN 112035509A
Authority
CN
China
Prior art keywords
medical
data
cache data
preset
query
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
CN202010884349.1A
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.)
Kangjian Information Technology Shenzhen Co Ltd
Original Assignee
Kangjian Information 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 Kangjian Information Technology Shenzhen Co Ltd filed Critical Kangjian Information Technology Shenzhen Co Ltd
Priority to CN202010884349.1A priority Critical patent/CN112035509A/en
Publication of CN112035509A publication Critical patent/CN112035509A/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/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • 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

Landscapes

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

Abstract

The invention relates to the field of big data, is applied to the field of intelligent medical treatment, and discloses a method, a device, equipment and a storage medium for inquiring medical cache data, which are used for solving the problem of low safety of the medical cache data when the medical cache data is inquired in a medical system. The query method of the medical cache data comprises the following steps: determining the query position of the medical cache data in the computer room according to the query statement; judging whether medical cache data exist in the query position or not, and if not, judging whether the medical system allows to return null data or not; if the empty data are allowed to be returned, the empty data of the medical cache data are set and returned, and the distributed locks are set and released asynchronously on a preset bottom-layer database; if the empty data is not allowed to be returned, the medical cache data is inquired in a preset bottom-layer database through a preset blocking lock, and the target medical data is obtained and returned.

Description

Medical cache data query method, device, equipment and storage medium
Technical Field
The invention relates to the field of big data, in particular to a method, a device, equipment and a storage medium for querying medical cache data.
Background
With the continuous development of science and technology, computer technology has been widely applied to various industry fields, so that each industry is rapidly developed. In the medical field, there is a medical system for storing hospital-patient hospitalization data, generally, the patient information data of the patient who is hospitalized in a hospital are cached in the medical system, the current technical scheme for the medical system to query the cached data is the implementation of a classic cache mode (cache-side), after a query statement is obtained, a server directly queries the cached data at a corresponding query position in the medical system, if the query position does not have the medical cached data, the server directly obtains the data from a bottom database, puts the data searched in the bottom database into a cache, and returns the data to a display interface of the medical system.
However, when the medical system queries the medical cache data by using the prior art, when high concurrent flow flows, the medical cache data can be punctured, so that the medical cache data is damaged, and the safety of the medical cache data is low.
Disclosure of Invention
The invention mainly aims to solve the problem that when medical cache data is inquired in a medical system, the safety of the medical cache data is low.
The invention provides a method for querying medical cache data, which comprises the following steps: acquiring query statements of medical cache data to be queried of a medical system, and determining query positions of the medical cache data in a computer room according to the query statements; judging whether the medical cache data exist in the query position, and if the medical cache data do not exist in the query position, judging whether the medical system allows to return empty data; if the medical system allows to return the empty data, setting the empty data of the medical cache data, returning the empty data to the medical system, and asynchronously and sequentially setting and releasing the distributed locks on a preset bottom database; and if the medical system does not allow to return empty data, inquiring the medical cache data in a preset bottom-layer database through a preset blocking lock to obtain target medical data, and returning the target medical data to the medical system.
Optionally, in a first implementation manner of the first aspect of the present invention, the obtaining a query statement that the medical system needs to query the medical cache data, and determining a query location of the medical cache data in the computer room according to the query statement includes: acquiring a query statement of a medical system needing to query medical cache data, and extracting storage variables of the medical cache data from the query statement; comparing the basic similarity between the storage variable and a preset address variable of a local computer room; and when the numerical value of the basic similarity is not equal to the standard threshold value, determining that the inquiry position is the preset local computer room.
Optionally, in a second implementation manner of the first aspect of the present invention, the determining whether the medical cache data exists in the query location, and if the medical cache data does not exist in the query location, determining whether the medical system allows to return empty data includes: inquiring the medical cache data at the inquiry position according to the inquiry statement, and judging whether the medical cache data exists at the inquiry position; if the medical cache data does not exist in the query position, acquiring a basic flow value of the medical cache data to be queried, and judging whether the basic flow value is greater than a flow threshold value; if the basic flow value is not larger than the flow threshold value, inquiring medical cache data in a preset bottom database to obtain target medical data, and returning the target medical data to a medical system; and if the numerical value of the basic flow is larger than the flow threshold, judging whether the medical system allows to return empty data.
Optionally, in a third implementation manner of the first aspect of the present invention, if the medical system allows to return empty data, the setting of the empty data of the medical cache data, the returning of the empty data to the medical system, and the asynchronous setting and releasing of the distributed locks in sequence on the preset bottom database includes: if the medical system allows to return the empty data, setting the survival time period of the empty data and returning the empty data to the medical system; and when the survival time period of the null data is set, asynchronously executing the operation of setting the distributed lock on a preset bottom-layer database, and releasing the distributed lock after determining that the operation of adding the distributed lock is completed.
Optionally, in a fourth implementation manner of the first aspect of the present invention, when the lifetime of the null data is set, asynchronously executing an operation of setting a distributed lock on a preset underlying database, and after determining that the operation of adding the distributed lock is completed, releasing the distributed lock includes: when the life time of the null data is set, asynchronously executing the operation of setting the distributed lock on a preset bottom-layer database; after the operation of setting the distributed lock is asynchronously executed on the preset bottom database, whether a preset write-back cache signal fed back by the preset bottom database is received or not is judged; and if a preset write-back cache signal fed back by the preset bottom-layer database is received, determining to finish the operation of adding the distributed lock on the preset bottom-layer database, and releasing the distributed lock.
Optionally, in a fifth implementation manner of the first aspect of the present invention, if the medical system does not allow to return empty data, querying the medical cache data in a preset bottom database through a preset block lock to obtain target medical data, and returning the target medical data to the medical system includes: if the medical system does not allow to return empty data, judging whether a preset blocking lock exists on a preset bottom database; if the preset blocking lock exists on the preset bottom database, inquiring medical cache data in the preset bottom database to obtain target medical data, and releasing the preset blocking lock after inquiring the target medical data; and when the preset blocking lock is released, returning the target medical data to the medical system.
The second aspect of the present invention provides an apparatus for querying medical cache data, including: the acquisition module is used for acquiring query statements of medical cache data to be queried by a medical system and determining the query position of the medical cache data in a computer room according to the query statements; the judging module is used for judging whether the medical cache data exist in the inquiring position or not, and if the medical cache data do not exist in the inquiring position, judging whether the medical system allows to return empty data or not; the first returning module is used for setting the empty data of the medical cache data if the medical system allows the empty data to be returned, returning the empty data to the medical system, and asynchronously and sequentially setting and releasing the distributed locks on a preset bottom database; and the second returning module is used for inquiring the medical cache data in a preset bottom-layer database through a preset blocking lock to obtain target medical data and returning the target medical data to the medical system if the medical system does not allow to return empty data.
Optionally, in a first implementation manner of the second aspect of the present invention, the obtaining module is specifically configured to: acquiring a query statement of a medical system needing to query medical cache data, and extracting storage variables of the medical cache data from the query statement; comparing the basic similarity between the storage variable and a preset address variable of a local computer room; and when the numerical value of the basic similarity is not equal to the standard threshold value, determining that the inquiry position is the preset local computer room.
Optionally, in a second implementation manner of the second aspect of the present invention, the determining module is specifically configured to: inquiring the medical cache data at the inquiry position according to the inquiry statement, and judging whether the medical cache data exists at the inquiry position; if the medical cache data does not exist in the query position, acquiring a basic flow value of the medical cache data to be queried, and judging whether the basic flow value is greater than a flow threshold value; if the basic flow value is not larger than the flow threshold value, inquiring medical cache data in a preset bottom database to obtain target medical data, and returning the target medical data to a medical system; and if the numerical value of the basic flow is larger than the flow threshold, judging whether the medical system allows to return empty data.
Optionally, in a third implementation manner of the second aspect of the present invention, the first returning module includes: the setting unit is used for setting the survival time period of the empty data and returning the empty data to the medical system if the medical system allows the empty data to be returned; and the adding unit is used for asynchronously executing the operation of setting the distributed lock on a preset bottom-layer database when the living time period of the null data is set, and releasing the distributed lock after the operation of adding the distributed lock is determined to be completed.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the adding unit is specifically configured to: when the life time of the null data is set, asynchronously executing the operation of setting the distributed lock on a preset bottom-layer database; after the operation of setting the distributed lock is asynchronously executed on the preset bottom database, whether a preset write-back cache signal fed back by the preset bottom database is received or not is judged; and if a preset write-back cache signal fed back by the preset bottom-layer database is received, determining to finish the operation of adding the distributed lock on the preset bottom-layer database, and releasing the distributed lock.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the second returning module is specifically configured to: if the medical system does not allow to return empty data, judging whether a preset blocking lock exists on a preset bottom database; if the preset blocking lock exists on the preset bottom database, inquiring medical cache data in the preset bottom database to obtain target medical data, and releasing the preset blocking lock after inquiring the target medical data; and when the preset blocking lock is released, returning the target medical data to the medical system.
The third aspect of the present invention provides a medical cache data query device, including: a memory and at least one processor, the memory having instructions stored therein; the at least one processor calls the instructions in the memory to enable the medical cache data query device to execute the medical cache data query method.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the above-mentioned method for querying medical cache data.
According to the technical scheme provided by the invention, query sentences of medical cache data to be queried of a medical system are obtained, and the query positions of the medical cache data in a computer room are determined according to the query sentences; judging whether the medical cache data exist in the query position, and if the medical cache data do not exist in the query position, judging whether the medical system allows to return empty data; if the medical system allows to return the empty data, setting the empty data of the medical cache data, returning the empty data to the medical system, and asynchronously and sequentially setting and releasing the distributed locks on a preset bottom database; and if the medical system does not allow to return empty data, inquiring the medical cache data in a preset bottom-layer database through a preset blocking lock to obtain target medical data, and returning the target medical data to the medical system.
In the embodiment of the invention, the data returned to the medical system is determined by judging whether the medical cache data exists in the query position of the medical cache data, and when the returned data is empty data, the distributed locks are asynchronously and sequentially arranged and released on a preset bottom-layer database while the empty data is returned; and when the returned data is not null data, inquiring medical cache data in a preset bottom-layer database through a preset blocking lock to obtain and return the target medical data. The purpose of inquiring the medical cache data under the scene of concurrent different flows in the medical system is achieved, the safety of the medical cache data is guaranteed, and in addition, the scheme can be applied to the field of intelligent medical treatment, so that the construction of a smart city is promoted.
Drawings
Fig. 1 is a schematic diagram of an embodiment of a method for querying medical cache data according to an embodiment of the present invention;
fig. 2 is a schematic diagram of another embodiment of a method for querying medical cache data according to an embodiment of the present invention;
fig. 3 is a schematic diagram of an embodiment of a query device for medical cache data according to an embodiment of the present invention;
fig. 4 is a schematic diagram of another embodiment of a query device for medical cache data according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an embodiment of a query device for medical cache data in an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method, a device, equipment and a storage medium for inquiring medical cache data, wherein the data returned to a medical system is determined by judging whether the medical cache data exists at the inquiry position of the medical cache data, and when the returned data is empty data, distributed locks are asynchronously and sequentially arranged and released on a preset bottom-layer database while the empty data is returned; and when the returned data is not null data, inquiring medical cache data in a preset bottom-layer database through a preset blocking lock to obtain and return the target medical data. The purpose of inquiring the medical cache data under the scene of concurrent different flows in the medical system is achieved, and the safety of the medical cache data is guaranteed.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, 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.
For convenience of understanding, a detailed flow of an embodiment of the present invention is described below, and referring to fig. 1, an embodiment of a method for querying medical cache data in an embodiment of the present invention includes:
101. acquiring query statements of medical cache data to be queried by a medical system, and determining query positions of the medical cache data in a computer room according to the query statements;
it is to be understood that the executing subject of the present invention may be a query device for medical cache data, and may also be a terminal or a server, which is not limited herein. The embodiment of the present invention is described by taking a server as an execution subject.
In the medical background, the medical system can record, store and query a large amount of diagnosis data of patients, thereby not only freeing manpower, but also facilitating the query of patients on the state of illness. The server needs to obtain a query statement input by a patient or a family member of the patient in the medical query system, where the query statement is used to indicate that the patient information cached in the medical system needs to be queried, it should be noted that the query statement carries a location storage variable of medical cache data, the location storage variable is used to record a storage location of the medical cache data, and the server can query the medical cache data after determining the storage location of the medical cache data. In addition, in order to ensure the safety of the medical cache data, the medical cache data can also be stored in the nodes of a block chain.
102. Judging whether medical cache data exist in the query position, and if the medical cache data do not exist in the query position, judging whether the medical system allows to return null data;
after the server acquires the storage variable of the medical cache data, whether the medical cache data exists at the query position corresponding to the storage variable needs to be judged, the server can return the medical cache data to the medical system for displaying only when the medical cache data exists at the query position, when the medical cache data does not exist at the query position and only low flow passes through the medical system, the server can directly query the medical cache data in a preset bottom database, once high flow passes through the medical system, the medical cache data in the medical system is easy to break down under the high-flow concurrent scene, and therefore the server needs to judge whether the medical system allows to return empty data, and further determines the data content returned to the medical system.
103. If the medical system allows to return the empty data, the empty data of the medical cache data is set, the empty data is returned to the medical system, and the distributed locks are asynchronously and sequentially set and released on a preset bottom-layer database;
when the server determines that the medical system allows to return null data, the server first needs to set a survival time period of some data related to the null data, namely the survival time period of the null data refers to the existence time of the null data in the medical system, namely, the null data does not exist after the survival time period, and meanwhile, the server asynchronously sets a release distributed lock on a preset bottom-layer database to prevent the preset bottom-layer database from returning other query statements to request to query other medical cache data, so that the problem of query confusion is solved.
104. And if the medical system does not allow to return empty data, inquiring medical cache data in a preset bottom-layer database through a preset blocking lock to obtain target medical data, and returning the target medical data to the medical system.
When the server determines that the medical system does not allow to return empty data, the server can only inquire medical cache data in a preset bottom-layer database, a blocking lock exists in the inquiring process, the preset blocking lock comprises a local lock or a distributed lock, the local lock only exists in a local computer room, the distributed lock can appear in the local computer room or a host computer room, when the server encounters the blocking lock, the blocking lock needs to be unlocked, then the inquiry of the medical cache data is carried out in the preset bottom-layer database, the target medical data is obtained, and finally the target medical data is returned to the medical system to realize the inquiry of the medical cache data.
In the embodiment of the invention, the data returned to the medical system is determined by judging whether the medical cache data exists in the query position of the medical cache data, and when the returned data is empty data, the distributed locks are asynchronously and sequentially arranged and released on a preset bottom-layer database while the empty data is returned; and when the returned data is not null data, inquiring medical cache data in a preset bottom-layer database through a preset blocking lock to obtain and return the target medical data. The purpose of inquiring the medical cache data under the scene of concurrent different flows in the medical system is achieved, the safety of the medical cache data is guaranteed, and in addition, the scheme can be applied to the field of intelligent medical treatment, so that the construction of a smart city is promoted.
Referring to fig. 2, another embodiment of the method for querying medical cache data according to the embodiment of the present invention includes:
201. acquiring query statements of medical cache data to be queried by a medical system, and determining query positions of the medical cache data in a computer room according to the query statements;
specifically, the server firstly acquires a query statement of the medical system needing to query the medical cache data, and extracts a storage variable of the medical cache data from the query statement; then the server compares the basic similarity between the storage variable and the preset address variable of the local computer room; and finally, when the numerical value of the basic similarity is equal to the standard threshold, the server determines that the query position is a preset local computer room, and when the numerical value of the basic similarity is not equal to the standard threshold, the server determines that the query position is a preset computer host room.
After the server acquires an inquiry statement that needs to inquire medical cache data in the medical system, a storage variable for storing the medical cache data is extracted from the inquiry statement, where the storage variable refers to a storage position path of the cache data in the medical system, and taking the medical data of a patient X who is treated in a gynecological hospital in a first hospital as an example, the hospital number of the patient X is known as: 123456, the storage variables needed to query the medical cache data for patient X are: c, Diyiyiyuan, FuKe, DiyiZHenShi, bh 123456. After the server obtains the storage variable, the storage variable is compared with the address variable of the local computer room, the basic similarity between the storage variable and the address variable of the local computer room is calculated, when the numerical value of the basic similarity is equal to a standard threshold, the storage position of the cache data is determined to be the preset local computer room, it needs to be noted that the standard threshold is 100%, that is, only when the basic similarity between the storage variable and the preset address variable of the local computer room is 100%, the storage position of the medical cache data can be proved to be the preset local computer room, otherwise, the medical cache data in the preset computer host room is inquired. In addition, in order to ensure the safety of the medical cache data, the medical cache data can also be stored in the nodes of a block chain.
202. Judging whether medical cache data exist in the query position, and if the medical cache data do not exist in the query position, judging whether the medical system allows to return null data;
specifically, the server firstly queries medical cache data at a query position according to a query statement, and judges whether the medical cache data exists at the query position; if the medical cache data does not exist in the query position, the server acquires a basic flow value of the medical cache data to be queried and judges whether the basic flow value is greater than a flow threshold value or not; if the basic flow value is not larger than the flow threshold value, the server inquires medical cache data in a preset bottom database to obtain target medical data, and returns the target medical data to the medical system; if the value of the basic flow is larger than the flow threshold value, the server judges whether the medical system allows to return empty data.
After the server determines the query position of the medical cache data (a local computer room or a preset computer main room), judging whether the medical cache data exists in the query position, if the medical cache data needing to be queried exists in the query position, directly returning the medical cache data to the medical system by the server, and displaying the medical cache data in the medical system to complete the query of the medical cache data; if the medical cache data does not exist in the query position, the server continuously judges whether the basic flow value of the medical cache data to be queried is larger than a flow threshold value, wherein the basic flow value of the medical cache data refers to the flow of an operation request in the medical system, and the larger the flow of the operation request is, the lower the breakdown or the breakdown of the data is directly caused when the resources of the server in the medical system are fully occupied or even serious. When the basic flow value of the medical cache data is not greater than the flow threshold value, namely, the medical cache data is queried under a low-flow scene, the server can directly query the medical cache data in a preset bottom database to obtain target medical data, and then the target medical data is returned to the medical system, that is, whether the server can directly penetrate through a preset database layer to query the medical cache data needs to be judged so as to ensure the safety of the medical cache data; when the value of the basic flow of the medical cache data is greater than the flow threshold, which is equivalent to performing query on the medical cache data in a high concurrency scenario, the server needs to further determine whether the medical system allows to return null data. It should be noted that the null data is used to indicate an unknown value in the database, i.e. to indicate that no medical cache data exists at the query location.
203. If the medical system allows to return the empty data, setting the survival time period of the empty data and returning the empty data to the medical system;
if the medical system allows to return null data to the medical system, the server first needs to set a time-to-live (TTL) of the null data, where the TTL refers to a life cycle of the null data, and generally, the life cycle of the null data is 5 minutes. And after the survival time period is set, the server can return empty data to the medical system to finish the query of the medical cache data.
204. When the existence time period of the null data is set, asynchronously executing the operation of setting the distributed lock on a preset bottom-layer database, and releasing the distributed lock after determining that the operation of adding the distributed lock is completed;
specifically, the server firstly asynchronously executes the operation of setting the distributed lock on a preset bottom-layer database when setting the life time period of null data; then after the server asynchronously executes the operation of setting the distributed lock on the preset bottom database, judging whether a preset write-back cache signal fed back by the preset bottom database is received or not; and finally, the server determines to finish the operation of adding the distributed lock on the preset bottom-layer database and releases the distributed lock if receiving a preset write-back cache signal fed back by the preset bottom-layer database.
When the server sets the survival time period of the returned null data, the server asynchronously sets a distributed lock on a preset bottom-layer database, wherein asynchronous execution refers to that the execution ending sequence of each operation instruction is not necessarily the same as the execution starting sequence of the operation instruction in an asynchronous execution mode of the operation instruction. For example, after the application program on the client sends the instruction of the query operation to the server, the next statement of the instruction of the query statement is executed immediately, and the next statement does not need to be executed after the server returns the query result to the client. The asynchronous execution mode enables an application program or a system to get rid of the constraint of a single task, and improves the flexibility of instruction execution and the execution efficiency of the application program.
It should be further noted that the distributed lock refers to a procedural lock for preventing mutual interference between multiple processes in the medical system, and it should be noted that the distributed lock is a Redis distributed lock; when the server sets the distributed lock, the following steps are required to be executed:
(1) the method comprises the steps that a server obtains setting time of a distributed lock to be set, wherein the setting time of the distributed lock takes milliseconds as a unit;
(2) the server in turn attempts to acquire a distributed lock from distributed nodes in the medical system, where the number of distributed nodes is at least one, using the same preset key.
It will be appreciated that when requesting acquisition of a distributed lock from a distributed node, the client of the medical system should set a network connection and response timeout period in advance, which should be less than the failure period of the distributed lock. For example: the distributed lock auto-disable period is 10 seconds and the timeout period set in advance should be between 5-50 milliseconds. The setting of the timeout period may avoid that the client of the medical system still waits for the response result of the distributed lock in case the server has hung up the distributed node. If the server does not respond within the timeout period, the client of the medical system needs to acquire the distributed lock on the next distributed node.
It should be noted that the server subtracts the set time from the current time to obtain the usage time period of the distributed lock; if the server successfully acquires the distributed lock, the real available time period of the preset key is equal to the effective time period minus the use time period of the distributed lock; if the distributed lock cannot be acquired successfully for some reasons, the server needs to unlock all the distributed nodes, so that some distributed nodes are prevented from acquiring the distributed lock but not responding, and the distributed lock cannot be acquired again.
The server sets the operation instruction of the distributed lock as a setnx instruction, and adds pseudo codes of the distributed lock as follows: setnx (lock _ safe _ medical cache data ID, 1). After the server sets the distributed lock, it needs to judge that a write-back cache signal fed back by a preset underlying database is received, where the write-back cache refers to a signal that a write request is completed when data is written into the cache in the write-back cache technology, and an actual operation of writing the data onto the nonvolatile storage medium will be delayed, and the write-back cache signal refers to a signal that a write request sent to the server is completed.
205. And if the medical system does not allow to return empty data, inquiring medical cache data in a preset bottom-layer database through a preset blocking lock to obtain target medical data, and returning the target medical data to the medical system.
If the medical system does not allow to return empty data, the server judges whether a preset blocking lock exists on a preset bottom database; if the preset blocking lock exists on the preset bottom database, the server inquires medical cache data in the preset bottom database to obtain target medical data, and releases the preset blocking lock after inquiring the target medical data; and when the preset blocking lock is released, the server returns the target medical data to the medical system.
When the server determines that the medical system does not allow the empty data to be returned, the server can only inquire the medical cache data in the preset bottom-layer database, in the process of inquiring, a blocking lock exists, the preset blocking lock comprises a local lock or a distributed lock, the local lock exists only in a local computer room, the distributed lock can exist in a local computer room or a host computer room, when the server encounters a blocking lock, the server directly detects the blocking lock in the case of existence of the blocking lock, inquiring medical cache data in a preset bottom-layer database to obtain target medical data, releasing a blocking lock after the server inquires the target medical data, so that other operation threads can enter a preset bottom-layer database to query other cache data, and the operation instruction for releasing the blocking lock is a del instruction, wherein the pseudo code for releasing the blocking lock is as follows: del (lock _ safe _ medical cache data ID). And after the server releases the blocking lock, the server returns the target medical data to the medical system to realize the query of the medical cache data.
It should be noted that setting the blocking lock is the same as setting the distributed lock in step 204, and besides, releasing the distributed lock is also the same, and therefore, the detailed description is omitted here.
In the embodiment of the invention, the data returned to the medical system is determined by judging whether the medical cache data exists in the query position of the medical cache data, and when the returned data is empty data, the distributed locks are asynchronously and sequentially arranged and released on a preset bottom-layer database while the empty data is returned; and when the returned data is not null data, inquiring medical cache data in a preset bottom-layer database through a preset blocking lock to obtain and return the target medical data. The purpose of inquiring the medical cache data under the scene of concurrent different flows in the medical system is achieved, the safety of the medical cache data is guaranteed, and in addition, the scheme can be applied to the field of intelligent medical treatment, so that the construction of a smart city is promoted.
The above description is provided for the query method of medical cache data in the embodiment of the present invention, and referring to fig. 3, the following description is provided for a query device of medical cache data in the embodiment of the present invention, where an embodiment of the query device of medical cache data in the embodiment of the present invention includes:
the acquiring module 301 is configured to acquire a query statement of medical cache data to be queried by a medical system, and determine a query position of the medical cache data in a computer room according to the query statement;
a determining module 302, configured to determine whether the medical cache data exists in the query location, and if the medical cache data does not exist in the query location, determine whether the medical system allows to return empty data;
a first returning module 303, configured to set null data of the medical cache data if the medical system allows the null data to be returned, return the null data to the medical system, and asynchronously set and release the distributed locks in sequence on a preset bottom-layer database;
the second returning module 304, if the medical system does not allow to return empty data, is configured to query the medical cache data in a preset bottom-layer database through a preset blocking lock, obtain target medical data, and return the target medical data to the medical system.
In the embodiment of the invention, the data returned to the medical system is determined by judging whether the medical cache data exists in the query position of the medical cache data, and when the returned data is empty data, the distributed locks are asynchronously and sequentially arranged and released on a preset bottom-layer database while the empty data is returned; and when the returned data is not null data, inquiring medical cache data in a preset bottom-layer database through a preset blocking lock to obtain and return the target medical data. The purpose of inquiring the medical cache data under the scene of concurrent different flows in the medical system is achieved, the safety of the medical cache data is guaranteed, and in addition, the scheme can be applied to the field of intelligent medical treatment, so that the construction of a smart city is promoted.
Referring to fig. 4, another embodiment of the device for querying medical cache data according to the embodiment of the present invention includes:
the acquiring module 301 is configured to acquire a query statement of medical cache data to be queried by a medical system, and determine a query position of the medical cache data in a computer room according to the query statement;
a determining module 302, configured to determine whether the medical cache data exists in the query location, and if the medical cache data does not exist in the query location, determine whether the medical system allows to return empty data;
a first returning module 303, configured to set null data of the medical cache data if the medical system allows the null data to be returned, return the null data to the medical system, and asynchronously set and release the distributed locks in sequence on a preset bottom-layer database;
the second returning module 304, if the medical system does not allow to return empty data, is configured to query the medical cache data in a preset bottom-layer database through a preset blocking lock, obtain target medical data, and return the target medical data to the medical system.
Optionally, the obtaining module 301 may be further specifically configured to:
acquiring a query statement of a medical system needing to query medical cache data, and extracting storage variables of the medical cache data from the query statement;
comparing the basic similarity between the storage variable and a preset address variable of a local computer room;
and when the numerical value of the basic similarity is not equal to the standard threshold value, determining that the inquiry position is the preset local computer room.
Optionally, the determining module 302 may be further specifically configured to:
inquiring the medical cache data at the inquiry position according to the inquiry statement, and judging whether the medical cache data exists at the inquiry position;
if the medical cache data does not exist in the query position, acquiring a basic flow value of the medical cache data to be queried, and judging whether the basic flow value is greater than a flow threshold value;
if the basic flow value is not larger than the flow threshold value, inquiring medical cache data in a preset bottom database to obtain target medical data, and returning the target medical data to a medical system;
and if the numerical value of the basic flow is larger than the flow threshold, judging whether the medical system allows to return empty data.
Optionally, the first returning module 303 includes:
a setting unit 3031, configured to set a lifetime of the null data and return the null data to the medical system if the medical system allows the null data to be returned;
an adding unit 3032, configured to asynchronously execute an operation of setting a distributed lock on a preset underlying database when a lifetime of the null data is set, and release the distributed lock after determining that the operation of adding the distributed lock is completed.
Optionally, the adding unit 3032 may further specifically be configured to:
when the life time of the null data is set, asynchronously executing the operation of setting the distributed lock on a preset bottom-layer database;
after the operation of setting the distributed lock is asynchronously executed on the preset bottom database, whether a preset write-back cache signal fed back by the preset bottom database is received or not is judged;
and if a preset write-back cache signal fed back by the preset bottom-layer database is received, determining to finish the operation of adding the distributed lock on the preset bottom-layer database, and releasing the distributed lock.
Optionally, the second returning module 304 may be further specifically configured to:
if the medical system does not allow to return empty data, judging whether a preset blocking lock exists on a preset bottom database;
if the preset blocking lock exists on the preset bottom database, inquiring medical cache data in the preset bottom database to obtain target medical data, and releasing the preset blocking lock after inquiring the target medical data;
and when the preset blocking lock is released, returning the target medical data to the medical system.
In the embodiment of the invention, the data returned to the medical system is determined by judging whether the medical cache data exists in the query position of the medical cache data, and when the returned data is empty data, the distributed locks are asynchronously and sequentially arranged and released on a preset bottom-layer database while the empty data is returned; and when the returned data is not null data, inquiring medical cache data in a preset bottom-layer database through a preset blocking lock to obtain and return the target medical data. The purpose of inquiring the medical cache data under the scene of concurrent different flows in the medical system is achieved, the safety of the medical cache data is guaranteed, and in addition, the scheme can be applied to the field of intelligent medical treatment, so that the construction of a smart city is promoted.
Fig. 3 and fig. 4 describe the query apparatus of medical cache data in the embodiment of the present invention in detail from the perspective of a modular functional entity, and the query apparatus of medical cache data in the embodiment of the present invention is described in detail from the perspective of hardware processing.
Fig. 5 is a schematic structural diagram of a medical cache data query device according to an embodiment of the present invention, where the medical cache data query device 500 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 510 (e.g., one or more processors) and a memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) for storing applications 533 or data 532. Memory 520 and storage media 530 may be, among other things, transient or persistent storage. The program stored on the storage medium 530 may include one or more modules (not shown), each of which may include a series of instruction operations in the querying device 500 for medical cache data. Still further, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the querying device 500 for medical cache data.
The querying device 500 for medical cached data may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input-output interfaces 560, and/or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, and the like. Those skilled in the art will appreciate that the configuration of the querying device for medical cached data illustrated in fig. 5 does not constitute a limitation on the querying device for medical cached data, and may include more or fewer components than illustrated, or some components in combination, or a different arrangement of components.
The invention further provides a medical cache data query device, which includes a memory and a processor, where the memory stores computer readable instructions, and the computer readable instructions, when executed by the processor, cause the processor to execute the steps of the medical cache data query method in the above embodiments.
Further, the computer usable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and which may also be a volatile computer-readable storage medium, having stored therein instructions, which, when run on a computer, cause the computer to perform the steps of the method for querying medical cache data.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
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 invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, 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 above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for querying medical cache data is characterized by comprising the following steps:
acquiring query statements of medical cache data to be queried of a medical system, and determining query positions of the medical cache data in a computer room according to the query statements;
judging whether the medical cache data exist in the query position, and if the medical cache data do not exist in the query position, judging whether the medical system allows to return empty data;
if the medical system allows to return the empty data, setting the empty data of the medical cache data, returning the empty data to the medical system, and asynchronously and sequentially setting and releasing the distributed locks on a preset bottom database;
and if the medical system does not allow to return empty data, inquiring the medical cache data in a preset bottom-layer database through a preset blocking lock to obtain target medical data, and returning the target medical data to the medical system.
2. The method for querying medical cache data according to claim 1, wherein the acquiring a query statement that a medical system needs to query the medical cache data, and determining the query location of the medical cache data in a computer room according to the query statement comprises:
acquiring a query statement of a medical system needing to query medical cache data, and extracting storage variables of the medical cache data from the query statement;
comparing the basic similarity between the storage variable and a preset address variable of a local computer room;
and when the numerical value of the basic similarity is not equal to the standard threshold value, determining that the inquiry position is the preset local computer room.
3. The method for querying medical cache data according to claim 1, wherein the determining whether the medical cache data exists at the query location, and if the medical cache data does not exist at the query location, determining whether the medical system allows to return null data comprises:
inquiring the medical cache data at the inquiry position according to the inquiry statement, and judging whether the medical cache data exists at the inquiry position;
if the medical cache data does not exist in the query position, acquiring a basic flow value of the medical cache data to be queried, and judging whether the basic flow value is greater than a flow threshold value;
if the basic flow value is not larger than the flow threshold value, inquiring medical cache data in a preset bottom database to obtain target medical data, and returning the target medical data to a medical system;
and if the numerical value of the basic flow is larger than the flow threshold, judging whether the medical system allows to return empty data.
4. The method for querying medical cache data according to claim 1, wherein the setting of the empty data of the medical cache data and the returning of the empty data to the medical system if the medical system allows the returning of the empty data, and the asynchronous setting and releasing of the distributed locks in sequence on the preset underlying database comprises:
if the medical system allows to return the empty data, setting the survival time period of the empty data and returning the empty data to the medical system;
and when the survival time period of the null data is set, asynchronously executing the operation of setting the distributed lock on a preset bottom-layer database, and releasing the distributed lock after determining that the operation of adding the distributed lock is completed.
5. The method for querying medical cache data according to claim 4, wherein the asynchronously performing an operation of setting a distributed lock on a preset underlying database when setting the lifetime of the null data, and releasing the distributed lock after determining that the operation of adding the distributed lock is completed comprises:
when the life time of the null data is set, asynchronously executing the operation of setting the distributed lock on a preset bottom-layer database;
after the operation of setting the distributed lock is asynchronously executed on the preset bottom database, whether a preset write-back cache signal fed back by the preset bottom database is received or not is judged;
and if a preset write-back cache signal fed back by the preset bottom-layer database is received, determining to finish the operation of adding the distributed lock on the preset bottom-layer database, and releasing the distributed lock.
6. The method for querying medical cache data according to any one of claims 1 to 5, wherein if the medical system does not allow to return null data, querying the medical cache data in a preset underlying database through a preset blocking lock to obtain target medical data, and returning the target medical data to the medical system comprises:
if the medical system does not allow to return empty data, judging whether a preset blocking lock exists on a preset bottom database;
if the preset blocking lock exists on the preset bottom database, inquiring medical cache data in the preset bottom database to obtain target medical data, and releasing the preset blocking lock after inquiring the target medical data;
and when the preset blocking lock is released, returning the target medical data to the medical system.
7. An apparatus for querying medical cache data, comprising:
the acquisition module is used for acquiring query statements of medical cache data to be queried by a medical system and determining the query position of the medical cache data in a computer room according to the query statements;
the judging module is used for judging whether the medical cache data exist in the inquiring position or not, and if the medical cache data do not exist in the inquiring position, judging whether the medical system allows to return empty data or not;
the first returning module is used for setting the empty data of the medical cache data if the medical system allows the empty data to be returned, returning the empty data to the medical system, and asynchronously and sequentially setting and releasing the distributed locks on a preset bottom database;
and the second returning module is used for inquiring the medical cache data in a preset bottom-layer database through a preset blocking lock to obtain target medical data and returning the target medical data to the medical system if the medical system does not allow to return empty data.
8. The apparatus for querying medical cache data according to claim 7, wherein the obtaining module is specifically configured to:
acquiring a query statement of a medical system needing to query medical cache data, and extracting storage variables of the medical cache data from the query statement;
comparing the basic similarity between the storage variable and a preset address variable of a local computer room;
and when the numerical value of the basic similarity is equal to a standard threshold value, determining that the query position is the preset local computer room, otherwise, determining that the query position is the preset computer host room.
9. An inquiry device for medical cache data, characterized in that the inquiry device for medical cache data comprises: a memory and at least one processor, the memory having instructions stored therein;
the at least one processor invokes the instructions in the memory to cause the medical cache data querying device to perform the medical cache data querying method of any one of claims 1-6.
10. A computer-readable storage medium having instructions stored thereon, wherein the instructions, when executed by a processor, implement a method for querying medical cache data according to any one of claims 1-6.
CN202010884349.1A 2020-08-28 2020-08-28 Medical cache data query method, device, equipment and storage medium Pending CN112035509A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010884349.1A CN112035509A (en) 2020-08-28 2020-08-28 Medical cache data query method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010884349.1A CN112035509A (en) 2020-08-28 2020-08-28 Medical cache data query method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112035509A true CN112035509A (en) 2020-12-04

Family

ID=73587321

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010884349.1A Pending CN112035509A (en) 2020-08-28 2020-08-28 Medical cache data query method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112035509A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109491928A (en) * 2018-11-05 2019-03-19 深圳乐信软件技术有限公司 Buffer control method, device, terminal and storage medium
CN110764920A (en) * 2019-10-10 2020-02-07 北京美鲜科技有限公司 Cache breakdown prevention method and annotation component thereof
CN111026771A (en) * 2019-11-19 2020-04-17 拉货宝网络科技有限责任公司 Method for ensuring consistency of cache and database data
CN111339148A (en) * 2020-03-13 2020-06-26 深圳前海环融联易信息科技服务有限公司 Method and device for preventing cache breakdown service, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109491928A (en) * 2018-11-05 2019-03-19 深圳乐信软件技术有限公司 Buffer control method, device, terminal and storage medium
CN110764920A (en) * 2019-10-10 2020-02-07 北京美鲜科技有限公司 Cache breakdown prevention method and annotation component thereof
CN111026771A (en) * 2019-11-19 2020-04-17 拉货宝网络科技有限责任公司 Method for ensuring consistency of cache and database data
CN111339148A (en) * 2020-03-13 2020-06-26 深圳前海环融联易信息科技服务有限公司 Method and device for preventing cache breakdown service, computer equipment and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
JAVA_SMALL_ANT: "解决Redis分布式锁业务代码超时致使锁失效问题", 《HTTPS://SEGMENTFAULT.COM/A/1190000022077372》 *
成为一名架构师: "干货|如何用Redis实现分布式锁", 《HTTPS://BAIJIAHAO.BAIDU.COM/S?ID=1647286984364313783&WFR=SPIDER&FOR=PC》 *
无: "解决Redis分布式锁业务代码超时致使锁失效问题", 《HTTP://WWW.JAVASHUO.COM/ARTICLE/P-WOGUASON-CM.HTML》 *

Similar Documents

Publication Publication Date Title
JP6724039B2 (en) Processing database transactions in distributed computing systems
Pfaff et al. The open vswitch database management protocol
US6879981B2 (en) Sharing live data with a non cooperative DBMS
US9953050B2 (en) Garbage collection of versions driving the garbage collection of multi-version concurrency control timestamps
Sturgis et al. Issues in the design and use of a distributed file system
KR101099152B1 (en) Automatic task generator method and system
KR100243717B1 (en) Method and apparatus for enabling a persistent metastate for objects in an object-oriented environment
US9207997B2 (en) Multithreaded lock management
TWI267782B (en) Deallocation of computer data in a multithreaded computer
US7774568B2 (en) Clustered snapshots in networks
CN109491928B (en) Cache control method, device, terminal and storage medium
US20060206901A1 (en) Method and system for deadlock detection in a distributed environment
US20110029498A1 (en) System and Method for Subunit Operations in a Database
KR20070031209A (en) System and method for a snapshot query during database recovery
JP3611295B2 (en) Computer system, memory management method, and storage medium
US10114731B2 (en) Including kernel object information in a user dump
CN110866011B (en) Data table synchronization method and device, computer equipment and storage medium
US7752399B2 (en) Exclusion control method and information processing apparatus
CN112035509A (en) Medical cache data query method, device, equipment and storage medium
CN111752715A (en) System optimization method, device, equipment and storage medium under large quantity of requests
CN114035970B (en) Data concurrent competition conflict detection analysis method and system
US20080082533A1 (en) Persistent locks/resources for concurrency control
CN115878336A (en) Information processing method and device in lock operation and computing equipment
Weikum Pros and cons of operating system transactions for data base systems
BR102015030217A2 (en) method for monitoring independent processes allocated in database access from a java virtual machine

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20201204

RJ01 Rejection of invention patent application after publication