CN109213604B - Data source management method and device - Google Patents

Data source management method and device Download PDF

Info

Publication number
CN109213604B
CN109213604B CN201811197830.2A CN201811197830A CN109213604B CN 109213604 B CN109213604 B CN 109213604B CN 201811197830 A CN201811197830 A CN 201811197830A CN 109213604 B CN109213604 B CN 109213604B
Authority
CN
China
Prior art keywords
data source
information table
access
deleted
time
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.)
Active
Application number
CN201811197830.2A
Other languages
Chinese (zh)
Other versions
CN109213604A (en
Inventor
赵鸿楠
艾国信
周志成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201811197830.2A priority Critical patent/CN109213604B/en
Publication of CN109213604A publication Critical patent/CN109213604A/en
Application granted granted Critical
Publication of CN109213604B publication Critical patent/CN109213604B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources

Abstract

The embodiment of the invention provides a method and a device for managing a data source, wherein the method comprises the following steps: judging whether the current non-access time length of the data source is greater than the preset time length or not according to the last access time of each data source in the stored data source information table, if the current non-access time length of the data source is greater than the preset time length, determining the data source as a data source to be deleted, deleting the data source to be deleted from the memory, and deleting the table entry corresponding to the data source to be deleted from the data source information table. Based on the processing, the data source which is not accessed for a long time in the memory can be deleted according to the data source information table, so that the memory occupancy can be reduced, and the system performance can be improved.

Description

Data source management method and device
Technical Field
The present invention relates to the field of database technologies, and in particular, to a method and an apparatus for managing a data source.
Background
With the rapid development of cloud computing and internet technologies, many platforms are faced with massive amounts of data, which can often be stored in different databases. The server typically stores a data source in which information for establishing a database connection is recorded. After receiving the data access request of the terminal, the server can return the corresponding data source to the terminal, and the terminal can establish connection with the corresponding database according to the data source to access the database.
In the prior art, a server may dynamically generate a data source according to a received data access request, and write the generated data source into a memory. When the server receives the data access request next time, the corresponding data source can be directly read from the memory and returned to the terminal, so that the terminal establishes connection with the corresponding database according to the data source.
However, the inventor finds that the prior art has at least the following problems in the process of implementing the invention:
in the process of service processing, the server generates a large amount of data sources to be written into the memory, which causes the memory occupancy to be high and reduces the system performance.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for managing a data source so as to improve the system performance. The specific technical scheme is as follows:
in a first aspect, to achieve the above object, an embodiment of the present invention discloses a method for managing a data source, where the method includes:
judging whether the current non-access time of each data source is longer than a preset time according to the last access time of each data source in a stored data source information table, wherein the data source information table is generated according to a received data access request;
if the current non-access time length of the data source is greater than the preset time length, determining the data source as a data source to be deleted;
and deleting the data source to be deleted from the memory, and deleting the table entry corresponding to the data source to be deleted from the data source information table.
Optionally, the data source information table further records initialization time and access times of the data source;
before determining the data source as the data source to be deleted, the method further includes:
calculating the access frequency of the data source according to the current time, the initialization time and the access times of the data source;
if the access frequency of the data source is greater than the preset access frequency, updating the last access time of the data source to be the current moment;
and if the access frequency of the data source is not greater than the preset access frequency, the step of determining the data source as the data source to be deleted is executed.
Optionally, the data source information table further records a deletion permission status of the data source, where the deletion permission status is permission to delete or disallowance to delete;
before the calculating the access frequency of the data source according to the current time, the initialization time of the data source and the access times, the method further comprises:
acquiring the deletion permission state of the data source in the data source information table;
and if the deletion permission state of the data source is permission to delete, executing the step of calculating the access frequency of the data source according to the current time, the initialization time and the access times of the data source.
Optionally, the data source information table further records a data source uniform resource locator URL and a user name corresponding to the data source;
the method further comprises the following steps:
when a data access request sent by a terminal is received, judging whether a target data source corresponding to a data source URL and a user name carried in the data access request exists or not according to the data source information table;
if the target data source does not exist, generating the target data source according to the data access request, and adding a table entry corresponding to the target data source in the data source information table;
and if the target data source exists, sending the target data source to the terminal, and updating the table entry corresponding to the target data source.
Optionally, the method further includes:
and when a data source query instruction is received, sending the data source information table to a user terminal so that the user terminal displays the information recorded in the data source information table.
In a second aspect, to achieve the above object, an embodiment of the present invention discloses a device for managing a data source, where the device includes:
the judging module is used for judging whether the current non-access time length of each data source is greater than the preset time length or not according to the last access time of each data source in the stored data source information table, wherein the data source information table is generated according to the received data access request;
the determining module is used for determining the data source as a data source to be deleted if the current non-access time length of the data source is greater than the preset time length;
and the deleting module is used for deleting the data source to be deleted from the memory and deleting the table entry corresponding to the data source to be deleted from the data source information table.
Optionally, the data source information table further records initialization time and access times of the data source;
the device further comprises:
the first processing module is used for calculating the access frequency of the data source according to the current time, the initialization time and the access times of the data source;
if the access frequency of the data source is greater than the preset access frequency, updating the last access time of the data source to be the current moment;
and if the access frequency of the data source is not greater than the preset access frequency, the step of determining the data source as the data source to be deleted is executed.
Optionally, the data source information table further records a deletion permission status of the data source, where the deletion permission status is permission to delete or disallowance to delete;
the device further comprises:
the second processing module is used for acquiring the deletion permission state of the data source in the data source information table;
and if the deletion permission state of the data source is permission to delete, executing the step of calculating the access frequency of the data source according to the current time, the initialization time and the access times of the data source.
Optionally, the data source information table further records a data source uniform resource locator URL and a user name corresponding to the data source;
the device further comprises:
the third processing module is used for judging whether a target data source corresponding to a data source URL and a user name carried in the data access request exists or not according to the data source information table when the data access request sent by the terminal is received;
if the target data source does not exist, generating the target data source according to the data access request, and adding a table entry corresponding to the target data source in the data source information table;
and if the target data source exists, sending the target data source to the terminal, and updating the table entry corresponding to the target data source.
Optionally, the apparatus further comprises:
and the sending module is used for sending the data source information table to a user terminal when a data source query instruction is received, so that the user terminal displays the information recorded in the data source information table.
In another aspect of the present invention, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, where the processor, the communication interface and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and a processor for implementing any of the above-described data source management methods when executing the program stored in the memory.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute any one of the above-mentioned methods for managing data sources.
In another aspect of the present invention, the present invention also provides a computer program product containing instructions, which when run on a computer, causes the computer to execute any of the above-mentioned data source management methods.
According to the method and the device for managing the data sources, provided by the embodiment of the invention, whether the current non-access time length of each data source is greater than the preset time length or not can be judged according to the last access time of each data source in the stored data source information table, if the current non-access time length of the data source is greater than the preset time length, the data source is determined as the data source to be deleted, the data source to be deleted is deleted from the memory, and the table entry corresponding to the data source to be deleted is deleted from the data source information table. Based on the processing, the data source which is not accessed for a long time in the memory can be deleted according to the data source information table, so that the memory occupancy can be reduced, and the system performance can be improved.
Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart of a method for managing a data source according to an embodiment of the present invention;
fig. 2 is a flowchart of an example of a method for managing a data source according to an embodiment of the present invention;
fig. 3 is a structural diagram of a data source management apparatus according to an embodiment of the present invention;
fig. 4 is a structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
In the prior art, a server may generate a corresponding data source according to a data access request. Specifically, the data access request may generally carry a data source URL (Uniform Resource Locator), a user name, and an identifier of a data source driver, where the data source URL may include a protocol name, a sub-protocol name, and a data source name.
For example, for a data access request of an oracle database, the data source URL may be: and the jdbc, oracle, thin, machine _ name, port, dbname, the identification of a data source driver can be as follows: oracle.jdbc.driver.oracledriver, where JDBC (Java DataBase Connectivity ) represents a protocol name; the oracle represents a subprotocol name, which is determined by a writer driven by a data source, and the machine _ name represents the name of a machine where the database is located; port represents a port number, and is 1521 by default; dbname denotes the name of the data source. The server can generate a corresponding data source according to the information in the data source URL and the data source drive, and write the generated data source into the memory. However, in the process of service processing, the server generates a large amount of data sources to be written into the memory, which results in a high memory occupancy rate and a reduced system performance.
In order to solve the above problem, embodiments of the present invention provide a method and an apparatus for managing a data source, which may be applied to a server, where the server may receive a data access request sent by a terminal, and return a corresponding data source to the terminal, and the terminal may establish a connection with a database according to the data source, so as to access the database.
Based on the method, the server can judge whether the current non-access time length of the data source is greater than the preset time length or not according to the last access time of each data source in the stored data source information table, if the current non-access time length of the data source is greater than the preset time length, namely the data source is not accessed for a long time, the server can determine the data source as the data source to be deleted, then the server can delete the data source to be deleted from the memory, and delete the table entry corresponding to the data source to be deleted from the data source information table. Based on the processing, the server can delete the data source which is not accessed for a long time in the memory according to the data source information table, so that the memory occupancy rate can be reduced, and the system performance of the server can be improved.
Referring to fig. 1, fig. 1 is a flowchart of a method for managing a data source according to an embodiment of the present invention, where the method may include the following steps:
s101: and judging whether the current unaccessed time length of the data source is greater than the preset time length or not according to the last access time of each data source in the stored data source information table.
Wherein the preset duration can be set by a technician according to experience. The data source information table can be generated for the server according to the received data access request and stored locally. The last access time of the data source generated by the server can be recorded in the data source information table. The current unaccessed duration of the data source may be a duration from the last access time of the data source to the current time.
In implementation, the server may read the locally stored data source information table at a preset update time, obtain the last access time of each data source recorded in the data source information table, and further determine whether the current unaccessed duration of each data source is greater than a preset duration according to the current time and the last access time of each data source.
In this step, the preset update time may be set by a technician according to experience, for example, the preset update time may be a fixed cycle time, or may be a time corresponding to the data access request sent by the terminal received by the server.
When the preset updating time is reached, the server may sequentially obtain the last access time of each data source recorded in the local data source information table according to a preset query sequence. For each data source, the server may calculate a time length between the last access time of the data source and the current time as a current non-access time length of the data source, and then, the server may determine whether the current non-access time length of the data source is greater than a preset time length. The preset query sequence may be set by a technician according to experience, for example, the preset query sequence may be a sequence of times (which may be referred to as initialization times) when the server generates each data source.
S102: and if the current non-access time length of the data source is greater than the preset time length, determining the data source as a data source to be deleted.
In an implementation, for each data source, when the server determines that the current non-access duration of the data source is greater than the preset duration, the server may determine the data source as a data source to be deleted.
Optionally, for a certain data source, when the server determines that the current unaccessed duration of the data source is less than or equal to the preset duration, the server may not perform any processing on the data source, and then, the server may continue to determine whether the current unaccessed duration of the next data source is greater than the preset duration according to the preset query sequence until the server finishes determining all the data sources recorded in the data source information table.
S103: and deleting the data source to be deleted from the memory, and deleting the table entry corresponding to the data source to be deleted from the data source information table.
In implementation, for each data source recorded in the data source information table, the number of the data sources to be deleted determined by the server may be one or multiple. Then, the server may delete the determined data source to be deleted from the memory, and delete the entry corresponding to the data source to be deleted from the data source information table.
In this step, for each data source, the server may delete the data source from the memory when determining that the data source is the data source to be deleted, and delete the entry corresponding to the data source from the data source information table, and then the server may continue to determine whether the next data source is the data source to be deleted according to the preset query sequence. Or, the server may first determine all the data sources to be deleted recorded in the data source information table, then delete each determined data source to be deleted from the memory, and delete the entry corresponding to each data source to be deleted from the data source information table. The embodiment is not limited to the time when the server deletes the data source to be deleted from the memory and deletes the entry corresponding to the data source to be deleted from the data source information table.
Therefore, based on the method of the embodiment, the server can delete the data source which is not accessed for a long time in the memory, and reduce the initialization frequency of the data source to the greatest extent, thereby reducing the calculation pressure of the system.
Optionally, the server may further filter the data source with the length of time that is not accessed greater than the preset length of time to determine the data source to be deleted. Specifically, the data source information table may further record initialization time and access times of the data source. If the current non-access duration of a certain data source is greater than the preset duration, before the data source is determined as the data source to be deleted, the method can further comprise the following steps:
step one, calculating the access frequency of the data source according to the current time, the initialization time and the access times of the data source.
For each data source, the data source information table may further record initialization time and access times of the data source, where the initialization time of the data source is the time when the server generates the data source, and the access times of the data source are the times when the data source is accessed from the time when the data source is generated to the current time.
In implementation, for a certain data source, when the server determines that the current access duration of the data source is greater than the preset duration, the server may obtain the initialization time and the access times of the data source recorded in the data source information table. Then, the server can calculate the current access frequency of the data source according to the current time, the initialization time of the data source and the access times of the data source. For example, the server may calculate a time length between the current time and the initialization time of the data source (which may be referred to as a presence time length), and then the server may calculate a quotient of the number of accesses of the data source and the presence time length of the data source as the current access frequency of the data source.
And step two, if the access frequency of the data source is greater than the preset access frequency, updating the last access time of the data source to the current time.
Wherein the preset access frequency can be set by a technician according to experience.
In implementation, when the server determines that the current non-access duration of a certain data source is greater than the preset duration and the current access frequency of the data source is greater than the preset access frequency, the server may update the last access time of the data source recorded in the data source information table to the current time, so that the server may determine whether the non-access duration of the data source is greater than the preset duration next time according to the updated last access time of the data source.
And step three, if the access frequency of the data source is not greater than the preset access frequency, determining the data source as a data source to be deleted.
In implementation, when the server determines that the current non-access duration of a certain data source is greater than the preset duration and the current access frequency of the data source is less than or equal to the preset access frequency, the server may determine the data source as a data source to be deleted, and may further delete the data source from the memory, thereby improving the performance of the system.
Optionally, the server may also determine whether to delete a data source according to the deletion permission status of the data source. Specifically, the data source information table may further record a deletion permission status of the data source, where the deletion permission status may be permission for deletion or non-permission for deletion.
For a certain data source, before the server calculates the access frequency of the data source according to the current time, the initialization time of the data source and the access times, the method may further include the following steps: acquiring a deletion permission state of the data source in a data source information table; and if the deletion permission state of the data source is permission to delete, judging whether the current unaccessed time length of the data source is greater than the preset time length.
Wherein the deletion permission status of the data source can be set by a technician based on experience. The deletion permission status may be permission of deletion or non-permission of deletion. If the deletion permission state of a certain data source is permission to delete, the server can delete the data source, and if the deletion permission state of the data source is non-permission to delete, the server cannot delete the data source.
In implementation, for a certain data source, the server may first obtain a deletion permission state of the data source recorded in the data source information table, if the deletion permission state of the data source is deletion permission, the server may further determine whether the current unaccessed duration of the data source is greater than a preset duration, and if the current unaccessed duration of the data source is greater than the preset duration, the server may calculate the access frequency of the data source according to the current time, the initialization time of the data source, and the number of accesses, and perform corresponding processing.
Or, the server may first determine whether the current unaccessed duration of the data source is greater than a preset duration, if the current unaccessed duration of the data source is greater than the preset duration, the server may further determine whether the deletion permission state of the data source is allowed to be deleted, and if the deletion permission state of the data source is allowed to be deleted, the server may calculate the access frequency of the data source according to the current time, the initialization time and the access times of the data source, and perform corresponding processing. The above determination procedure is not limited in this embodiment.
In addition, if the deletion permission status of the data source is not to allow deletion, the server may not perform any processing on the data source. Then, the server may obtain the deletion permission status of the next data source according to a preset query sequence, and perform corresponding processing.
Optionally, the server may further update the data source information table according to the data access request of the terminal. Specifically, the data source information table may further record a data source URL and a user name corresponding to the data source, and the method may further include the following steps:
step one, when a data access request sent by a terminal is received, judging whether a target data source corresponding to a data source URL and a user name carried in the data access request exists or not according to a data source information table.
When a server generates a certain data source, the server can also record a data source URL and a user name corresponding to the data source in a data source information table, and the server can determine whether the terminal has corresponding data access authority according to the user name.
In implementation, the terminal may send a data access request to the server to access the corresponding database, where the data access request may carry a user name and a data source URL. Correspondingly, the server can receive the data access request sent by the terminal, and analyze the data access request to obtain the user name and the data source URL.
Then, the server may perform a query in the data source information table, and determine whether the data source information table has an identifier of a data source corresponding to the user name and the data source URL carried in the data access request, that is, whether a data source (i.e., a target data source) corresponding to the user name and the data source URL carried in the data access request exists in the memory.
And step two, if the target data source does not exist, generating the target data source according to the data access request, and adding a table entry corresponding to the target data source in the data source information table.
In implementation, when the server determines that the target data source does not exist in the memory, the server may generate the target data source according to the data access request, and a method for generating the target data source by the server is the same as that in the prior art, and is not described herein again. Meanwhile, the server can also add the table entry corresponding to the target data source in the data source information table. For example, the server may record the initialization time (i.e., the current time), the number of accesses (i.e., 1), the user name, the URL of the data source, and the last access time (i.e., the current time) of the target data source in the data source information table.
In addition, after the server generates the target data source, the server can send the target data source to the terminal, so that the terminal can access the corresponding database.
And step three, if the target data source exists, sending the target data source to the terminal, and updating the table entry corresponding to the target data source.
In implementation, when the server determines that the target data source exists in the memory, the server may send the target data source to the terminal. Meanwhile, the server can also update the table entry corresponding to the target data source.
In this step, the server may update the last access time of the target data source to the current time, and update the access times of the target data source. For example, the server may obtain the current access times of the target data source, and add 1 to the current access times to update the access times of the target data source. Optionally, the server may also provide information query of the data source. Specifically, the method may further include the steps of: and when a data query instruction is received, sending the data source information table to the user terminal so that the user terminal displays the information recorded in the data source information table.
In implementation, a user may send a data query instruction to the server through the user terminal to query information of a current data source, and correspondingly, when the server receives the data query instruction, the server may send the data source information table to the user terminal, and the user terminal may display information recorded in the data source information table.
In addition, a data source drive corresponding to the data source can be recorded in the data source information table so as to be browsed by a user.
Therefore, the method based on the embodiment can realize the monitoring of the data source, so that the user can directly and effectively know the cleaning state of the data source through the user terminal.
Referring to fig. 2, fig. 2 is a flowchart of an example of a method for managing a data source according to an embodiment of the present invention, where the method may include the following steps:
s201: and receiving a data access request sent by the terminal.
The data access request carries a data source URL and a user name.
S202: and judging whether a target data source corresponding to the data source URL and the user name carried in the data access request exists in the memory or not according to the stored data source information table, if so, executing S203, and if not, executing S204.
The data source information table records the identifier of the data source, initialization time, data source URL, user name, last access time, deletion permission state and access times.
S203: and sending the target data source to the terminal, and updating the table entry corresponding to the target data source.
S204: and generating a target data source according to the data access request, and adding a table entry corresponding to the target data source in the data source information table.
S205: for each data source recorded in the data source information table, it is determined whether the deletion permission status of the data source is permission to delete, and if the deletion permission status of the data source is permission to delete, S206 is performed.
S206: and judging whether the current unaccessed time length of the data source is greater than the preset time length or not, and if the current unaccessed time length of the data source is greater than the preset time length, executing S207.
S207: and judging whether the current access frequency of the data source is greater than the preset access frequency, if so, executing S208, and if not, executing S209.
S208: and updating the last access time of the data source to the current time.
S209: and determining the data source as a data source to be deleted.
S2010: and deleting the data source to be deleted from the memory, and deleting the table entry corresponding to the data source to be deleted from the data source information table.
As can be seen from the above, according to the management method for data sources of the embodiments of the present invention, according to the last access time of each data source in the stored data source information table, it is determined whether the current unaccessed duration of the data source is greater than the preset duration, if the current unaccessed duration of the data source is greater than the preset duration, the data source is determined as a data source to be deleted, the data source to be deleted is deleted from the memory, and the entry corresponding to the data source to be deleted is deleted from the data source information table. Based on the processing, the data source which is not accessed for a long time in the memory can be deleted according to the data source information table, so that the memory occupancy can be reduced, and the system performance can be improved.
Corresponding to the management method of the data source in fig. 1, an embodiment of the present invention further provides a management apparatus of the data source.
Referring to fig. 3, fig. 3 is a block diagram of a management apparatus for a data source according to an embodiment of the present invention, where the apparatus may include:
the determining module 301 is configured to determine whether a current non-access time of each data source is greater than a preset time according to a last access time of each data source in a stored data source information table, where the data source information table is generated according to a received data access request;
a determining module 302, configured to determine the data source as a data source to be deleted if the current unaccessed time of the data source is greater than the preset time;
a deleting module 303, configured to delete the data source to be deleted from the memory, and delete the entry corresponding to the data source to be deleted from the data source information table.
Optionally, the data source information table further records initialization time and access times of the data source;
the device further comprises:
the first processing module is used for calculating the access frequency of the data source according to the current time, the initialization time and the access times of the data source;
if the access frequency of the data source is greater than the preset access frequency, updating the last access time of the data source to be the current moment;
and if the access frequency of the data source is not greater than the preset access frequency, the step of determining the data source as the data source to be deleted is executed.
Optionally, the data source information table further records a deletion permission status of the data source, where the deletion permission status is permission to delete or disallowance to delete;
the device further comprises:
the second processing module is used for acquiring the deletion permission state of the data source in the data source information table;
and if the deletion permission state of the data source is permission to delete, executing the step of calculating the access frequency of the data source according to the current time, the initialization time and the access times of the data source.
Optionally, the data source information table further records a data source uniform resource locator URL and a user name corresponding to the data source;
the device further comprises:
the third processing module is used for judging whether a target data source corresponding to a data source URL and a user name carried in the data access request exists or not according to the data source information table when the data access request sent by the terminal is received;
if the target data source does not exist, generating the target data source according to the data access request, and adding a table entry corresponding to the target data source in the data source information table;
and if the target data source exists, sending the target data source to the terminal, and updating the table entry corresponding to the target data source.
Optionally, the apparatus further comprises:
and the sending module is used for sending the data source information table to a user terminal when a data source query instruction is received, so that the user terminal displays the information recorded in the data source information table.
As can be seen from the above, according to the management device for data sources in the embodiment of the present invention, whether the current unaccessed duration of each data source is greater than the preset duration is determined according to the last access time of each data source in the stored data source information table, if the current unaccessed duration of the data source is greater than the preset duration, the data source is determined as a data source to be deleted, the data source to be deleted is deleted from the memory, and the entry corresponding to the data source to be deleted is deleted from the data source information table. Based on the processing, the data source which is not accessed for a long time in the memory can be deleted according to the data source information table, so that the memory occupancy can be reduced, and the system performance can be improved.
An embodiment of the present invention further provides an electronic device, as shown in fig. 4, including a processor 401, a communication interface 402, a memory 403, and a communication bus 404, where the processor 401, the communication interface 402, and the memory 403 complete mutual communication through the communication bus 404,
a memory 403 for storing a computer program;
the processor 401 is configured to implement the method for managing a data source according to the embodiment of the present invention when executing the program stored in the memory 403.
Specifically, the method for managing the data source includes:
judging whether the current non-access time of each data source is longer than a preset time according to the last access time of each data source in a stored data source information table, wherein the data source information table is generated according to a received data access request;
if the current non-access time length of the data source is greater than the preset time length, determining the data source as a data source to be deleted;
and deleting the data source to be deleted from the memory, and deleting the table entry corresponding to the data source to be deleted from the data source information table.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
The electronic device provided by the embodiment of the invention can delete the data source which is not accessed for a long time in the memory according to the data source information table, thereby reducing the memory occupancy rate and improving the system performance.
The embodiment of the present invention further provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are run on a computer, the computer is enabled to execute the method for managing a data source provided by the embodiment of the present invention.
Specifically, the method for managing the data source includes:
judging whether the current non-access time of each data source is longer than a preset time according to the last access time of each data source in a stored data source information table, wherein the data source information table is generated according to a received data access request;
if the current non-access time length of the data source is greater than the preset time length, determining the data source as a data source to be deleted;
and deleting the data source to be deleted from the memory, and deleting the table entry corresponding to the data source to be deleted from the data source information table.
It should be noted that other implementation manners of the management method of the data source are the same as those of the foregoing method embodiment, and are not described herein again.
By operating the instructions stored in the computer-readable storage medium provided by the embodiment of the invention, the data source which is not accessed for a long time in the memory can be deleted according to the data source information table, so that the occupation rate of the memory can be reduced, and the system performance can be improved.
Embodiments of the present invention further provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the method for managing a data source provided by an embodiment of the present invention.
Specifically, the method for managing the data source includes:
judging whether the current non-access time of each data source is longer than a preset time according to the last access time of each data source in a stored data source information table, wherein the data source information table is generated according to a received data access request;
if the current non-access time length of the data source is greater than the preset time length, determining the data source as a data source to be deleted;
and deleting the data source to be deleted from the memory, and deleting the table entry corresponding to the data source to be deleted from the data source information table.
It should be noted that other implementation manners of the management method of the data source are the same as those of the foregoing method embodiment, and are not described herein again.
By operating the computer program product provided by the embodiment of the invention, the data source which is not accessed for a long time in the memory can be deleted according to the data source information table, so that the memory occupancy can be reduced, and the system performance can be improved.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, the electronic device, the computer-readable storage medium, and the computer program product embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (7)

1. A method for managing data sources, the method comprising:
judging whether the current non-access time of each data source is longer than a preset time according to the last access time of each data source in a stored data source information table, wherein the data source information table is generated according to a received data access request;
if the current non-access time length of the data source is greater than the preset time length, determining the data source as a data source to be deleted;
deleting the data source to be deleted from the memory, and deleting the table entry corresponding to the data source to be deleted from the data source information table;
the data source information table also records the initialization time and the access times of the data source;
before determining the data source as the data source to be deleted, the method further includes:
calculating the access frequency of the data source according to the current time, the initialization time and the access times of the data source;
if the access frequency of the data source is greater than the preset access frequency, updating the last access time of the data source to be the current moment;
if the access frequency of the data source is not more than the preset access frequency, the step of determining the data source as the data source to be deleted is executed;
the data source information table also records the deletion permission state of the data source, and the deletion permission state is permission deletion or non-permission deletion;
before the calculating the access frequency of the data source according to the current time, the initialization time of the data source and the access times, the method further comprises:
acquiring the deletion permission state of the data source in the data source information table;
and if the deletion permission state of the data source is permission to delete, executing the step of calculating the access frequency of the data source according to the current time, the initialization time and the access times of the data source.
2. The method according to claim 1, wherein the data source information table further records a data source uniform resource locator URL and a user name corresponding to the data source;
the method further comprises the following steps:
when a data access request sent by a terminal is received, judging whether a target data source corresponding to a data source URL and a user name carried in the data access request exists or not according to the data source information table;
if the target data source does not exist, generating the target data source according to the data access request, and adding a table entry corresponding to the target data source in the data source information table;
and if the target data source exists, sending the target data source to the terminal, and updating the table entry corresponding to the target data source.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
and when a data source query instruction is received, sending the data source information table to a user terminal so that the user terminal displays the information recorded in the data source information table.
4. An apparatus for managing data sources, the apparatus comprising:
the judging module is used for judging whether the current non-access time length of each data source is greater than the preset time length or not according to the last access time of each data source in the stored data source information table, wherein the data source information table is generated according to the received data access request;
the determining module is used for determining the data source as a data source to be deleted if the current non-access time length of the data source is greater than the preset time length;
the deleting module is used for deleting the data source to be deleted from the memory and deleting the table entry corresponding to the data source to be deleted from the data source information table;
the data source information table also records the initialization time and the access times of the data source;
the device further comprises:
the first processing module is used for calculating the access frequency of the data source according to the current time, the initialization time and the access times of the data source;
if the access frequency of the data source is greater than the preset access frequency, updating the last access time of the data source to be the current moment;
if the access frequency of the data source is not more than the preset access frequency, the step of determining the data source as the data source to be deleted is executed;
the data source information table also records the deletion permission state of the data source, and the deletion permission state is permission deletion or non-permission deletion;
the device further comprises:
the second processing module is used for acquiring the deletion permission state of the data source in the data source information table;
and if the deletion permission state of the data source is permission to delete, executing the step of calculating the access frequency of the data source according to the current time, the initialization time and the access times of the data source.
5. The apparatus according to claim 4, wherein the data source information table further records a data source uniform resource locator URL and a user name corresponding to the data source;
the device further comprises:
the third processing module is used for judging whether a target data source corresponding to a data source URL and a user name carried in the data access request exists or not according to the data source information table when the data access request sent by the terminal is received;
if the target data source does not exist, generating the target data source according to the data access request, and adding a table entry corresponding to the target data source in the data source information table;
and if the target data source exists, sending the target data source to the terminal, and updating the table entry corresponding to the target data source.
6. The apparatus of claim 4 or 5, further comprising:
and the sending module is used for sending the data source information table to a user terminal when a data source query instruction is received, so that the user terminal displays the information recorded in the data source information table.
7. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
the memory is used for storing a computer program;
the processor, when executing the program stored in the memory, implementing the method steps of any of claims 1-3.
CN201811197830.2A 2018-10-15 2018-10-15 Data source management method and device Active CN109213604B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811197830.2A CN109213604B (en) 2018-10-15 2018-10-15 Data source management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811197830.2A CN109213604B (en) 2018-10-15 2018-10-15 Data source management method and device

Publications (2)

Publication Number Publication Date
CN109213604A CN109213604A (en) 2019-01-15
CN109213604B true CN109213604B (en) 2021-08-20

Family

ID=64980157

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811197830.2A Active CN109213604B (en) 2018-10-15 2018-10-15 Data source management method and device

Country Status (1)

Country Link
CN (1) CN109213604B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110032667A (en) * 2019-04-17 2019-07-19 成都市审计局 A kind of data assets management method for platform of auditing
CN110187836B (en) * 2019-05-29 2022-09-02 北京奇艺世纪科技有限公司 Data deleting method and device, computer and storage medium
CN110417901B (en) * 2019-07-31 2022-04-29 北京金山云网络技术有限公司 Data processing method and device and gateway server
CN114840272B (en) * 2022-07-04 2022-09-30 好享家舒适智能家居股份有限公司 Multi-data-source dynamic planning and monitoring system and method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104298613A (en) * 2014-09-29 2015-01-21 广州金山网络科技有限公司 Method for cleaning up system memory and terminal device
CN104331492A (en) * 2014-11-14 2015-02-04 北京国双科技有限公司 Method and device for caching multi-instance data
CN105183902A (en) * 2015-09-30 2015-12-23 北京金山安全软件有限公司 File cleaning method and device and terminal
CN106301968A (en) * 2016-10-25 2017-01-04 广东欧珀移动通信有限公司 The processing method of a kind of terminal data, Apparatus and system
CN106325990A (en) * 2016-08-19 2017-01-11 宇龙计算机通信科技(深圳)有限公司 Control method of application program, control device and terminal
CN107797871A (en) * 2017-11-30 2018-03-13 努比亚技术有限公司 EMS memory occupation method for releasing resource, mobile terminal and computer-readable recording medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9037598B1 (en) * 2013-01-25 2015-05-19 Google Inc. Variable query generation
US9703787B2 (en) * 2014-03-25 2017-07-11 Yokogawa Electric Corporation Data storage management apparatus and data storage management method
CN107133234B (en) * 2016-02-29 2021-04-27 创新先进技术有限公司 Method, device and system for updating cache data
CN107562515B (en) * 2017-08-04 2021-09-07 海光信息技术股份有限公司 Method for managing memory in virtualization technology
CN107861688A (en) * 2017-10-30 2018-03-30 努比亚技术有限公司 A kind of data-erasure method, terminal and readable storage medium storing program for executing
CN107943581B (en) * 2017-11-14 2020-01-14 Oppo广东移动通信有限公司 Application cleaning method and device, storage medium and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104298613A (en) * 2014-09-29 2015-01-21 广州金山网络科技有限公司 Method for cleaning up system memory and terminal device
CN104331492A (en) * 2014-11-14 2015-02-04 北京国双科技有限公司 Method and device for caching multi-instance data
CN105183902A (en) * 2015-09-30 2015-12-23 北京金山安全软件有限公司 File cleaning method and device and terminal
CN106325990A (en) * 2016-08-19 2017-01-11 宇龙计算机通信科技(深圳)有限公司 Control method of application program, control device and terminal
CN106301968A (en) * 2016-10-25 2017-01-04 广东欧珀移动通信有限公司 The processing method of a kind of terminal data, Apparatus and system
CN107797871A (en) * 2017-11-30 2018-03-13 努比亚技术有限公司 EMS memory occupation method for releasing resource, mobile terminal and computer-readable recording medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"Web系统高性能本地数据缓存实现机制";谢杰涛;《计算机应用研究》;20140731(第201407期);全文 *

Also Published As

Publication number Publication date
CN109213604A (en) 2019-01-15

Similar Documents

Publication Publication Date Title
CN109213604B (en) Data source management method and device
CN111352902A (en) Log processing method and device, terminal equipment and storage medium
CN109885786B (en) Data caching processing method and device, electronic equipment and readable storage medium
CN108897628A (en) A kind of implementation method of distributed lock, device and electronic equipment
CN109450969B (en) Method and device for acquiring data from third-party data source server and server
CN108011949B (en) Method and apparatus for acquiring data
CN111382206B (en) Data storage method and device
CN109600254B (en) Method for generating full-link log and related system
CN108520401B (en) User list management method, device, platform and storage medium
CN111367948B (en) Data processing method and device, electronic equipment and computer readable storage medium
CN110430070B (en) Service state analysis method, device, server, data analysis equipment and medium
CN111309693A (en) Data synchronization method, device and system, electronic equipment and storage medium
CN109976896B (en) Service re-ranking processing method and device
CN113114611B (en) Blacklist management method and device
CN113726885A (en) Method and device for adjusting flow quota
CN113010587A (en) Data source configuration method, device, terminal, server and medium
CN109087097B (en) Method and device for updating same identifier of chain code
CN112416401B (en) Data updating method, device and equipment
CN110262756B (en) Method and device for caching data
CN111163088B (en) Message processing method, system and device and electronic equipment
CN111614675B (en) Request execution method, device, system and medium
CN114430395A (en) Flow control method, device and equipment and intelligent traffic management equipment
CN115563637A (en) Method, system, equipment and medium for updating message desensitization rule
CN111010447A (en) Data communication method and device
CN114625395A (en) Data processing method and device and electronic equipment

Legal Events

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