CN114064780A - Session information processing method, system, device, storage medium and electronic equipment - Google Patents

Session information processing method, system, device, storage medium and electronic equipment Download PDF

Info

Publication number
CN114064780A
CN114064780A CN202111425017.8A CN202111425017A CN114064780A CN 114064780 A CN114064780 A CN 114064780A CN 202111425017 A CN202111425017 A CN 202111425017A CN 114064780 A CN114064780 A CN 114064780A
Authority
CN
China
Prior art keywords
session
database
session information
information
stored
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
CN202111425017.8A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202111425017.8A priority Critical patent/CN114064780A/en
Publication of CN114064780A publication Critical patent/CN114064780A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application discloses a processing method, a system, a device, a storage medium and electronic equipment of session information, and relates to the field of financial science and technology. The method comprises the following steps: acquiring a session request sent by a client, and detecting whether a session ID corresponding to the session request is stored in a first database; under the condition that the session ID is stored in the first database, session information corresponding to the session ID is obtained, and the session information is returned to the client; under the condition that the session ID is not stored in the first database, detecting whether the session ID is stored in the second database; under the condition that the session ID is stored in the second database, session information corresponding to the session ID is obtained, and the session information is returned to the client; and returning the information of the login interface of the target system under the condition that the session ID is not stored in the second database. By the method and the device, the problems that in the related art, the session information is stored in the memory of the server, the occupied memory is large, and the load capacity of the server is low are solved.

Description

Session information processing method, system, device, storage medium and electronic equipment
Technical Field
The present application relates to the field of financial technology, and in particular, to a method, a system, an apparatus, a storage medium, and an electronic device for processing session information.
Background
When the web application is used, a user uses a session mode to perform account login authentication of the user, but after the user performs authentication login, if interaction with the application program is not performed for a long time, the server automatically deletes session information after the timeout time is exceeded, so that the identity of the user cannot be identified, and the user needs to log in again. The timeout time of the server is usually 15-30 minutes, the session information of the user usually exists in the memory of the server, and meanwhile, in the interaction process between the user browser and the server, the identity verification of the login user needs to be completed by means of the transmission of the session ID in the session information.
In the related art, session information of a user often exists in a memory of a single server, the problem that the memory is too large when the session information is stored by the single server under the condition that the session information is more exists, and the session information is lost under the condition that the server fails, and meanwhile, under the condition that the access pressure is higher or the number of the servers is more, the memory storage capacity has a performance bottleneck, and a performance ceiling is easily reached.
Aiming at the problems that the session information is stored in the memory of the server, the occupied memory is large, and the load capacity of the server is low in the related technology, an effective solution is not provided at present.
Disclosure of Invention
The application provides a method, a system, a device, a storage medium and an electronic device for processing session information, which are used for solving the problems that the session information is stored in a memory of a server in the related art, the occupied memory is large, and the load capacity of the server is low.
According to one aspect of the application, a method for processing session information is provided. The method comprises the following steps: acquiring a session request sent by a client, identifying a session ID from the session request, and detecting whether the session ID is stored in a first database, wherein the session request is generated after the client successfully logs in a target system; under the condition that the session ID is stored in the first database, session information corresponding to the session ID is obtained from the first database, session content in the session information is called, and the session content is returned to the client; under the condition that the session ID is not stored in the first database, detecting whether the session ID is stored in the second database or not, wherein the storage time of the session information in the second database is longer than that in the first database; under the condition that the session ID is stored in the second database, session information corresponding to the session ID is obtained from the second database, session content in the session information is called, and the session content is returned to the client; and returning the information of the login interface of the target system under the condition that the session ID is not stored in the second database.
Optionally, after acquiring session information corresponding to the session ID from the second database and calling session content in the session information, the method further includes: and storing the session information into a first database, and updating the calling duration corresponding to the session information to an initial value.
Optionally, the method further includes: deleting the session information with calling duration exceeding a first duration threshold in a first database according to a first time period, wherein the calling duration is the duration from the time of calling the session information last time to the current time, and the calling duration is updated to an initial value after the session information is called each time; and deleting the session information of which the calling duration exceeds a second duration threshold in the second database according to a second time period, wherein the second duration threshold is greater than the first duration threshold.
Optionally, the method further includes: and sending the session information with the calling duration less than or equal to the first duration threshold value in the first database to the second database according to a third time period, and covering the session information with the same session ID in the second database.
Optionally, before acquiring the session request sent by the client, the method further includes: receiving a login request sent by a client, identifying a user ID in the login request, and detecting whether the user ID is stored in a first database or a second database; under the condition that the user ID is stored in the first database or the second database, the repeated login information is returned to the client; and under the condition that the user ID is not stored in the first database and the second database, creating a session ID corresponding to the user ID and session information corresponding to the session ID, storing the session information into the first database, and synchronizing the session information in the first database into the second database.
Optionally, after the repeated login information is returned to the client, the method further includes: under the condition that a request for continuing login returned by a client is received, session information corresponding to a user ID in a first database is deleted, a session ID corresponding to the user ID and session information corresponding to the session ID are created, the session information is stored in the first database, and the session information in the first database is synchronized to a second database.
According to another aspect of the present application, a system for processing session information is provided. The system comprises: the client is used for sending a login request and a session request; the server is in communication connection with the client, a first database is arranged in the server, the server is used for creating a session ID corresponding to a user ID and session information corresponding to the session ID under the condition of receiving a login request, storing the session information into the first database and synchronizing the session information in the first database to a second database, and the server is also used for returning the session information stored in the first database or the second database to the client under the condition of receiving a session request, wherein the storage duration of the session information in the first database is less than that in the second database; and the second database is arranged outside the server, is in communication connection with the server and is used for storing the session information in the first database in the server.
According to another aspect of the present application, a processing apparatus of session information is provided. The device includes: the first detection unit is used for acquiring a session request sent by a client, identifying a session ID from the session request, and detecting whether the session ID is stored in a first database, wherein the session request is generated after a target system is successfully logged in the client; the first acquiring unit is used for acquiring the session information corresponding to the session ID from the first database under the condition that the session ID is stored in the first database, calling the session content in the session information and returning the session content to the client; the second detection unit is used for detecting whether the session ID is stored in the second database or not under the condition that the session ID is not stored in the first database, wherein the storage time length of the session information in the second database is longer than that in the first database; the second acquiring unit is used for acquiring the session information corresponding to the session ID from the second database under the condition that the session ID is stored in the second database, calling the session content in the session information and returning the session content to the client; and the first returning unit is used for returning the information of the login interface of the target system under the condition that the session ID is not stored in the second database.
According to another aspect of the embodiments of the present invention, there is also provided a non-volatile storage medium, which includes a stored program, wherein the program controls a device in which the non-volatile storage medium is located to execute a processing method of session information when running.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including one or more processors and a memory; the memory stores computer readable instructions, and the processor is used for executing the computer readable instructions, wherein the computer readable instructions execute a processing method of session information.
Through the application, the following steps are adopted: acquiring a session request sent by a client, identifying a session ID from the session request, and detecting whether the session ID is stored in a first database, wherein the session request is generated after the client successfully logs in a target system; under the condition that the session ID is stored in the first database, session information corresponding to the session ID is obtained from the first database, session content in the session information is called, and the session content is returned to the client; under the condition that the session ID is not stored in the first database, detecting whether the session ID is stored in the second database or not, wherein the storage time of the session information in the second database is longer than that in the first database; under the condition that the session ID is stored in the second database, session information corresponding to the session ID is obtained from the second database, session content in the session information is called, and the session content is returned to the client; and returning the information of the login interface of the target system under the condition that the session ID is not stored in the second database. The problems that in the related art, the session information is stored in the memory of the server, the occupied memory is large, and the load capacity of the server is low are solved. By respectively storing the session information in the first database and the second database and calling the corresponding session information from the second server after the first server deletes the session information, the effect of session sharing among multiple servers can be achieved while the storage time and the storage amount of the session information are increased.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the application and, together with the description, serve to explain the application and are not intended to limit the application. In the drawings:
fig. 1 is a flowchart of a processing method of session information provided according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a system for processing session information provided according to an embodiment of the application;
fig. 3 is a schematic diagram of a processing device for session information provided according to an embodiment of the present application;
fig. 4 is a schematic diagram of an electronic device provided according to an embodiment of the present application.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for presentation, analyzed data, etc.) referred to in the present disclosure are information and data authorized by the user or sufficiently authorized by each party.
According to an embodiment of the application, a method for processing session information is provided.
Fig. 1 is a flowchart of a processing method of session information according to an embodiment of the present application. As shown in fig. 1, the method comprises the steps of:
step S101, obtaining a session request sent by a client, identifying a session ID from the session request, and detecting whether the session ID is stored in a first database, wherein the session request is generated after the client successfully logs in a target system.
Specifically, the first database may be a memory of a server, where a user sends a session request to the server through a client, the session request is a session request after successfully logging in a system, the session request sent by the user includes a user ID and a session ID, the server first identifies the session ID, then queries the session ID in the memory of the server, and determines whether to store the session ID and session information corresponding to the session ID, where the session information includes the session ID, the user ID, session content, and call time.
Step S102, when the first database stores the session ID, the session information corresponding to the session ID is obtained from the first database, the session content in the session information is called, and the session content is returned to the client.
Specifically, the session content may be related information of the user, for example, a bank card number, permission information, and the like, and when the server queries the session ID in the memory, the session content corresponding to the session ID is sent to the client, and at this time, the user may directly perform corresponding operations without repeating operations such as inputting verification information and the like.
Step S103, under the condition that the first database does not store the session ID, detecting whether the second database stores the session ID, wherein the storage duration of the session information in the second database is longer than that in the first database.
Specifically, the second database may be a storage cluster for storing session information, the storage cluster may store session information in memories of multiple servers, and the same session information may be stored in the storage cluster for a longer time than in the memories of the servers.
For example, the session ID is stored in the memory of the server for 5 minutes, the session ID is stored in the storage cluster for 15 minutes, when the server does not inquire the session ID of the user in the memory, the session ID can be searched in the storage cluster, and the sharing of the session information between the storage and the server can be realized through the storage cluster, for example, the server 1 stores the session information of the user to the memory and stores the session information of the user to the storage cluster after the user logs in, at this time, when the crash caused by excessive stored information occurs in the memory of the server, the session information can be acquired through the storage cluster, and the purpose of not affecting the use of the user can be achieved through the method.
And step S104, under the condition that the second database stores the session ID, acquiring the session information corresponding to the session ID from the second database, calling the session content in the session information, and returning the session content to the client.
Specifically, when the server finds the session ID corresponding to the user in the storage cluster, the server directly sends the session content corresponding to the session ID from the storage cluster to the client, and at this time, the user may directly perform corresponding operations without repeating operations such as authentication information input.
In step S105, if the session ID is not stored in the second database, the information of the login interface of the target system is returned.
Specifically, when the server finds the session ID corresponding to the user in the storage cluster, it is proved that the session information corresponding to the session ID is not stored in both the memory of the server and the storage cluster, it is determined that the user access is overtime, and the login overtime information is fed back to the client, and the user needs to log in again.
According to the processing method of the session information, the session request sent by the client is obtained, the session ID is identified from the session request, and whether the session ID is stored in the first database or not is detected, wherein the session request is generated after the client successfully logs in a target system; under the condition that the session ID is stored in the first database, session information corresponding to the session ID is obtained from the first database, session content in the session information is called, and the session content is returned to the client; under the condition that the session ID is not stored in the first database, detecting whether the session ID is stored in the second database or not, wherein the storage time of the session information in the second database is longer than that in the first database; under the condition that the session ID is stored in the second database, session information corresponding to the session ID is obtained from the second database, session content in the session information is called, and the session content is returned to the client; and under the condition that the session ID is not stored in the second database, returning the information of the login interface of the target system, thereby solving the problems that the session information is stored in the memory of the server in the related technology, the occupied memory is more, and the load capacity of the server is low. By respectively storing the session information in the first database and the second database and calling the corresponding session information from the second server after the first server deletes the session information, the effect of session sharing among multiple servers can be achieved while the storage time and the storage amount of the session information are increased.
Optionally, in the method for processing session information provided in this embodiment of the present application, after obtaining session information corresponding to the session ID from the second database and calling session content in the session information, the method further includes: and storing the session information into a first database, and updating the calling duration corresponding to the session information to an initial value.
Specifically, when the server does not inquire the session ID of the user in the memory, the server needs to search the session ID in the memory cluster, and after the session ID is found in the memory cluster, the server returns the session information to the server, and stores the session information in the memory of the server. The embodiment synchronizes the session information stored in the second database to the first database, so as to achieve the effect that the first database and the second database are synchronized, and the session information can be directly acquired from the first database when being acquired next time.
Optionally, in order to prevent that session information stored in the first database and the second database is too much and affects performance of the databases, in the processing method of session information provided in the embodiment of the present application, the method further includes: deleting the session information with calling duration exceeding a first duration threshold in a first database according to a first time period, wherein the calling duration is the duration from the time of calling the session information last time to the current time, and the calling duration is updated to an initial value after the session information is called each time; and deleting the session information of which the calling duration exceeds a second duration threshold in the second database according to a second time period, wherein the second duration threshold is greater than the first duration threshold.
Specifically, the memory of the server may clear the session information in the memory according to the first time period, so as to avoid that the performance of the server is affected by excessive information storage, for example, the session information is cleared every 1 minute, the cleared session information may be the session information whose invocation time exceeds the first duration threshold, for example, the first duration threshold may be set to 5 minutes, and when the invocation time of the session information exceeds 5 minutes, the session information is deleted when the session information is periodically deleted next time.
It should be noted that the calling time and the session ID correspond to each other, and when the time for the user corresponding to the session ID to make the next session request is within 5 minutes, the calling time corresponding to the session ID is changed to an initial value, that is, 0, and the timer is restarted until the user makes the session request again within 5 minutes or the time exceeds 5 minutes and then the calling time is deleted.
Correspondingly, the session information in the memory cluster also needs to be periodically deleted, the session information in the memory cluster can be cleared according to a second time period, so that the situation that the performance of the memory cluster is affected due to excessive information storage is avoided, the second time period can be the same as or different from the first time period, for example, the session information is cleared every 1 minute, the cleared session information can be the session information with the calling time exceeding a second time threshold, for example, the second time threshold can be set to 15 minutes, and when the calling time of the session information exceeds 15 minutes, the session information is deleted when the periodic deletion is performed next time. The effects of reducing the memories of the first database and the second database and improving the operation efficiency of the server are achieved through the embodiment.
Optionally, in order to synchronize session information in the first database and the second database, in the processing method of session information provided in the embodiment of the present application, the method further includes: and sending the session information with the calling duration less than or equal to the first duration threshold value in the first database to the second database according to a third time period, and covering the session information with the same session ID in the second database.
Specifically, after the call time in the memory of the server is updated, the changed session information needs to be synchronized to the storage cluster from the memory, and at this time, all the session information whose call time is smaller than the first duration threshold needs to be sent to the storage cluster, and the session information with the same session ID in the storage cluster is replaced, so that information synchronization is completed.
For example, the information synchronization is performed every 1.5 minutes, and the session information in the memory that is overtime is synchronized to the storage cluster for storage. Through the step, the session information in the memory and the storage cluster is synchronized, so that the session information in the memory is deleted and backed up in the storage cluster. The session information changed in the first database is synchronized to the second database through the embodiment, so that the effect of synchronously changing the session information of the first database and the session information of the second database is achieved.
Optionally, before the user successfully logs in, it is required to check whether the account repeatedly logs in, and in the processing method of session information provided in the embodiment of the present application, before acquiring the session request sent by the client, the method further includes: receiving a login request sent by a client, identifying a user ID in the login request, and detecting whether the user ID is stored in a first database or a second database; under the condition that the user ID is stored in the first database or the second database, the repeated login information is returned to the client; and under the condition that the user ID is not stored in the first database and the second database, creating a session ID corresponding to the user ID and session information corresponding to the session ID, storing the session information into the first database, and synchronizing the session information in the first database into the second database.
Specifically, when a user logs in at a client, it is necessary to determine whether an account that the user logs in is already logged in another server. At this time, the server judges whether the user ID of the user has a corresponding session ID in the memory, performs inquiry in the storage cluster when the user ID does not have a corresponding session ID in the memory, judges that the account is not logged in when the user ID does not have a corresponding session ID in the storage cluster, creates a session ID corresponding to the user ID, corresponds the session ID to session content, and initializes the call time. The method for creating the session ID may be to perform hash calculation after combining the current time, the server IP address, the network card MAC address, and the random number, and generate the session ID. By the method, the session ID which is not repeated can be obtained, and the situation that a plurality of user IDs correspond to one same session ID is prevented. And after the session information corresponding to the user ID is generated, storing the session information into the memory and the storage cluster.
When the session ID corresponding to the user ID is found in the memory or the storage cluster, the account is judged to be logged in at a certain place, at the moment, the login information is returned to the client, and the client judges whether to log in a covering manner. The effect of preventing the phenomenon of repeated login of the unified account is achieved through the embodiment.
Optionally, in the processing method of session information provided in the embodiment of the present application, after the repeated login information is returned to the client, the method further includes: under the condition that a request for continuing login returned by a client is received, session information corresponding to a user ID in a first database is deleted, a session ID corresponding to the user ID and session information corresponding to the session ID are created, the session information is stored in the first database, and the session information in the first database is synchronized to a second database.
Specifically, when the session ID corresponding to the user ID is found in the memory or the storage cluster, it is determined that the account is logging in at a certain place, at this time, the login information is returned to the client, and the client determines whether to log in a covering manner. And after judging that the overlay login is carried out, the server deletes all the session information corresponding to the user ID in the memory, re-creates the session ID corresponding to the user ID, corresponds the session ID with the session content and initializes the calling time. The method for creating the session ID may be to perform hash calculation after combining the current time, the server IP address, the network card MAC address, and the random number, and generate the session ID. And after the session information corresponding to the user ID is generated, storing the session information into the memory and the storage cluster. Through the embodiment, the effect of backing up the session information in the first database is achieved.
The embodiment of the present application further provides a processing system of session information, and it should be noted that the processing system of session information in the embodiment of the present application may be used to execute the processing method for session information provided in the embodiment of the present application. The following describes a processing system for session information provided in an embodiment of the present application.
Fig. 2 is a schematic diagram of a system for processing session information according to an embodiment of the present application, and as shown in fig. 2, the system includes:
the client 201 is used for sending a login request and a session request.
Specifically, the client 201 sends a login request during the first login, and sends a session request after successful login.
The server 202 is in communication connection with the client 201, a first database is arranged in the server 202, the server 202 is used for creating a session ID corresponding to a user ID and session information corresponding to the session ID under the condition that a login request is received, storing the session information into the first database, and synchronizing the session information in the first database to the second database 203, and the server 202 is further used for returning the session information stored in the first database or the second database 203 to the client 201 under the condition that a session request is received, wherein the storage time length of the session information in the first database is shorter than that in the second database 203.
Specifically, when a user logs in to the client 201, it is necessary to determine whether an account to which the user logs in is already logged in to another server 202. At this time, the server 202 determines whether the user ID of the user has a corresponding session ID in the memory, and if there is no corresponding session ID in the memory, it makes an inquiry in the storage cluster constituted by the plurality of second databases 203, and if there is no corresponding session ID in the storage cluster, it determines that the account is not registered, and the server 202 creates a session ID corresponding to the user ID, associates the session ID with the session content, and initializes the call time. The method for creating the session ID may be to perform hash calculation after combining the current time, the IP address of the server 202, the MAC address of the network card, and the random number, and generate the session ID. By the method, the session ID which is not repeated can be obtained, and the situation that a plurality of user IDs correspond to one same session ID is prevented. And after the session information corresponding to the user ID is generated, storing the session information into the memory and the storage cluster.
It should be noted that after successful login, the session information in the memory or in the storage cluster is returned to the client 201, and a re-login interface is returned after the corresponding session information is not queried.
And the second database 203 is arranged outside the server 202, is in communication connection with the server 202, and is used for storing the session information in the first database in the server 202.
Specifically, the second database 203 may be a storage cluster only used for storing session information, the storage cluster may store session information in memories of multiple servers 202, and the same session information is stored in the storage cluster for a longer time than the time in the memory of the server 202.
The processing system of the session information provided by the embodiment of the application sends a login request and a session request through the client 201; the server 202 is in communication connection with the client 201, a first database is arranged in the server 202, the server 202 is used for creating a session ID corresponding to a user ID and session information corresponding to the session ID under the condition that a login request is received, storing the session information into the first database, and synchronizing the session information in the first database to the second database 203, and the server 202 is also used for returning the session information stored in the first database or the second database 203 to the client 201 under the condition that a session request is received, wherein the storage time length of the session information in the first database is shorter than that in the second database 203; the second database 203 is disposed outside the server 202, and is connected to the server 202 in communication, for storing the session information in the first database in the server 202. The problems that in the related art, the session information is stored in the memory of the server, the occupied memory is large, and the load capacity of the server is low are solved. By setting the database connected with the server, storing the memory in the server in the external database, and calling the corresponding session information from the external database after the memory in the server deletes the session information, the effect of session sharing among multiple servers is achieved while the storage time and storage amount of the session information are increased.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
The embodiment of the present application further provides a processing apparatus of session information, and it should be noted that the processing apparatus of session information in the embodiment of the present application may be used to execute the processing method for session information provided in the embodiment of the present application. The following describes a processing apparatus for session information according to an embodiment of the present application.
Fig. 3 is a schematic diagram of a processing apparatus for session information according to an embodiment of the present application. As shown in fig. 3, the apparatus includes:
a first detecting unit 301, configured to obtain a session request sent by a client, identify a session ID from the session request, and detect whether the session ID is stored in a first database, where the session request is a session request generated after a target system is successfully logged in on the client;
a first obtaining unit 302, configured to, when a session ID is stored in a first database, obtain session information corresponding to the session ID from the first database, call session content in the session information, and return the session content to a client;
a second detecting unit 303, configured to detect whether a session ID is stored in a second database when the session ID is not stored in the first database, where a storage duration of the session information in the second database is longer than a storage duration in the first database;
a second obtaining unit 304, configured to, in a case that the second database stores the session ID, obtain session information corresponding to the session ID from the second database, call session content in the session information, and return the session content to the client;
a first returning unit 305, configured to return information of the login interface of the target system in a case where the session ID is not stored in the second database.
The processing device for session information provided in the embodiment of the present application obtains, by a first detection unit 301, a session request sent by a client, identifies a session ID from the session request, and detects whether the session ID is stored in a first database, where the session request is a session request generated after the client successfully logs in a target system; when the session ID is stored in the first database, the first obtaining unit 302 obtains session information corresponding to the session ID from the first database, invokes session content in the session information, and returns the session content to the client; the second detecting unit 303 detects whether a session ID is stored in the second database when the session ID is not stored in the first database, wherein the storage duration of the session information in the second database is longer than the storage duration in the first database; the second obtaining unit 304, when the session ID is stored in the second database, obtains the session information corresponding to the session ID from the second database, calls the session content in the session information, and returns the session content to the client; the first returning unit 305 returns information of the login interface of the target system in the case where the session ID is not stored in the second database. The problems that in the related art, the session information is stored in the memory of the server, the occupied memory is large, and the load capacity of the server is low are solved. By respectively storing the session information in the first database and the second database and calling the corresponding session information from the second server after the first server deletes the session information, the effect of session sharing among multiple servers can be achieved while the storage time and the storage amount of the session information are increased.
Optionally, in the processing apparatus for session information provided in the embodiment of the present application, the processing apparatus further includes: the first storage unit is used for storing the session information into a first database and updating the calling duration corresponding to the session information to an initial value.
Optionally, in the processing apparatus for session information provided in the embodiment of the present application, the processing apparatus further includes: the first deleting unit is used for deleting the session information of which the calling duration exceeds a first duration threshold in the first database according to a first time period, wherein the calling duration is the duration from the time of calling the session information last time to the current time, and the calling duration is updated to an initial value after the session information is called each time; and the second deleting unit is used for deleting the session information of which the calling duration exceeds a second duration threshold in the second database according to a second time period, wherein the second duration threshold is greater than the first duration threshold.
Optionally, in the processing apparatus for session information provided in the embodiment of the present application, the processing apparatus further includes: and the first sending unit is used for sending the session information with the calling duration less than or equal to the first duration threshold value in the first database to the second database according to a third time period, and covering the session information with the same session ID in the second database.
Optionally, in the processing apparatus for session information provided in the embodiment of the present application, the processing apparatus further includes: the first receiving unit is used for receiving a login request sent by a client, identifying a user ID in the login request and detecting whether the user ID is stored in a first database or a second database; the second returning unit is used for returning the repeated login information to the client under the condition that the user ID is stored in the first database or the second database; and the first creating unit is used for creating a session ID corresponding to the user ID and session information corresponding to the session ID, storing the session information into the first database and synchronizing the session information in the first database into the second database under the condition that the user ID is not stored in the first database and the second database.
Optionally, in the processing apparatus for session information provided in the embodiment of the present application, the processing apparatus further includes: and the second creating unit is used for deleting the session information corresponding to the user ID in the first database, creating the session ID corresponding to the user ID and the session information corresponding to the session ID, storing the session information into the first database, and synchronizing the session information in the first database into the second database under the condition that a request for continuing login returned by the client is received.
The processing device of the session information includes a processor and a memory, and the first detecting unit 301, the first acquiring unit 302, the second detecting unit 303, the second acquiring unit 304, the first returning unit 305, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the problems that in the related technology, the session information is stored in the memory of the server, the memory is occupied more, and the load capacity of the server is low are solved by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a computer-readable storage medium on which a program is stored, which, when executed by a processor, implements the processing method of the session information.
The embodiment of the invention provides a processor, which is used for running a program, wherein the processing method of the session information is executed when the program runs.
As shown in fig. 4, an embodiment of the present invention provides an electronic device, where the device 10 includes a processor, a memory, and a program stored in the memory and running on the processor, and the processor executes the program to implement the following steps: acquiring a session request sent by a client, identifying a session ID from the session request, and detecting whether the session ID is stored in a first database, wherein the session request is generated after the client successfully logs in a target system; under the condition that the session ID is stored in the first database, session information corresponding to the session ID is obtained from the first database, session content in the session information is called, and the session content is returned to the client; under the condition that the session ID is not stored in the first database, detecting whether the session ID is stored in the second database or not, wherein the storage time of the session information in the second database is longer than that in the first database; under the condition that the session ID is stored in the second database, session information corresponding to the session ID is obtained from the second database, session content in the session information is called, and the session content is returned to the client; and returning the information of the login interface of the target system under the condition that the session ID is not stored in the second database. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: acquiring a session request sent by a client, identifying a session ID from the session request, and detecting whether the session ID is stored in a first database, wherein the session request is generated after the client successfully logs in a target system; under the condition that the session ID is stored in the first database, session information corresponding to the session ID is obtained from the first database, session content in the session information is called, and the session content is returned to the client; under the condition that the session ID is not stored in the first database, detecting whether the session ID is stored in the second database or not, wherein the storage time of the session information in the second database is longer than that in the first database; under the condition that the session ID is stored in the second database, session information corresponding to the session ID is obtained from the second database, session content in the session information is called, and the session content is returned to the client; and returning the information of the login interface of the target system under the condition that the session ID is not stored in the second database.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that 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 the process, method, article, or apparatus that comprises the element.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A processing method of session information is characterized by comprising the following steps:
acquiring a session request sent by a client, identifying a session ID from the session request, and detecting whether the session ID is stored in a first database, wherein the session request is generated after a target system is successfully logged in the client;
under the condition that the session ID is stored in the first database, acquiring session information corresponding to the session ID from the first database, calling session content in the session information, and returning the session content to the client;
under the condition that the session ID is not stored in the first database, detecting whether a second database stores the session ID or not, wherein the storage time of the session information in the second database is longer than that in the first database;
under the condition that the session ID is stored in the second database, acquiring session information corresponding to the session ID from the second database, calling session content in the session information, and returning the session content to the client;
and returning the information of the login interface of the target system under the condition that the session ID is not stored in the second database.
2. The method according to claim 1, wherein after obtaining the session information corresponding to the session ID from the second database and invoking the session content in the session information, the method further comprises:
and storing the session information into the first database, and updating the calling duration corresponding to the session information to an initial value.
3. The method of claim 1, wherein:
deleting the session information with calling duration exceeding a first duration threshold in the first database according to a first time period, wherein the calling duration is the duration from the last time of calling the session information to the current time, and the calling duration is updated to an initial value after the session information is called each time;
and deleting the session information of which the calling duration exceeds a second duration threshold in the second database according to a second time period, wherein the second duration threshold is greater than the first duration threshold.
4. The method of claim 3, wherein:
and sending the session information of which the calling duration is less than or equal to the first duration threshold value in the first database to the second database according to a third time period, and covering the session information of which the session IDs are the same in the second database.
5. The method of claim 1, wherein prior to obtaining the session request sent by the client, the method further comprises:
receiving a login request sent by the client, identifying a user ID in the login request, and detecting whether the user ID is stored in the first database or the second database;
returning repeated login information to the client under the condition that the user ID is stored in the first database or the second database;
and under the condition that the user ID is not stored in the first database and the second database, creating a session ID corresponding to the user ID and the session information corresponding to the session ID, storing the session information into the first database, and synchronizing the session information in the first database into the second database.
6. The method of claim 1, wherein after returning the repeated login information to the client, the method further comprises:
and under the condition that a request for continuing login returned by the client is received, deleting the session information corresponding to the user ID in the first database, creating the session ID corresponding to the user ID and the session information corresponding to the session ID, storing the session information in the first database, and synchronizing the session information in the first database to the second database.
7. A processing system of session information, wherein the processing system of session information is adapted to the processing method of session information of any one of claims 1 to 6, and comprises:
the client is used for sending a login request and a session request;
the server is in communication connection with the client, a first database is arranged in the server, the server is used for creating a session ID corresponding to a user ID and session information corresponding to the session ID under the condition that the login request is received, storing the session information into the first database and synchronizing the session information in the first database to a second database, and the server is also used for returning the session information stored in the first database or the second database to the client under the condition that the session request is received, wherein the storage time length of the session information in the first database is shorter than that in the second database;
and the second database is arranged outside the server, is in communication connection with the server and is used for storing the session information in the first database in the server.
8. A device for processing session information, comprising:
the system comprises a first detection unit, a second detection unit and a third detection unit, wherein the first detection unit is used for acquiring a session request sent by a client, identifying a session ID from the session request and detecting whether the session ID is stored in a first database or not, and the session request is generated after a target system is successfully logged in the client;
a first obtaining unit, configured to, when the session ID is stored in the first database, obtain session information corresponding to the session ID from the first database, call session content in the session information, and return the session content to the client;
a second detecting unit, configured to detect whether a second database stores the session ID when the session ID is not stored in the first database, where a storage duration of the session information in the second database is longer than a storage duration in the first database;
a second obtaining unit, configured to, when the session ID is stored in the second database, obtain session information corresponding to the session ID from the second database, call session content in the session information, and return the session content to the client;
and the first returning unit is used for returning the information of the login interface of the target system under the condition that the session ID is not stored in the second database.
9. A non-volatile storage medium, characterized in that the non-volatile storage medium comprises a stored program, wherein the program controls a device in which the non-volatile storage medium is located to execute the session information processing method according to any one of claims 1 to 6 when the program runs.
10. An electronic device comprising one or more processors and memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of processing session information of any one of claims 1-6.
CN202111425017.8A 2021-11-26 2021-11-26 Session information processing method, system, device, storage medium and electronic equipment Pending CN114064780A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111425017.8A CN114064780A (en) 2021-11-26 2021-11-26 Session information processing method, system, device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111425017.8A CN114064780A (en) 2021-11-26 2021-11-26 Session information processing method, system, device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN114064780A true CN114064780A (en) 2022-02-18

Family

ID=80276621

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111425017.8A Pending CN114064780A (en) 2021-11-26 2021-11-26 Session information processing method, system, device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114064780A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500098A (en) * 2022-03-03 2022-05-13 广州市智荟环保有限公司 Verification method and device, computer equipment and readable storage medium
CN114615315A (en) * 2022-03-22 2022-06-10 深圳壹账通创配科技有限公司 Communication method, device, equipment and storage medium for online conversation

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500098A (en) * 2022-03-03 2022-05-13 广州市智荟环保有限公司 Verification method and device, computer equipment and readable storage medium
CN114615315A (en) * 2022-03-22 2022-06-10 深圳壹账通创配科技有限公司 Communication method, device, equipment and storage medium for online conversation

Similar Documents

Publication Publication Date Title
CN107196982B (en) User request processing method and device
CN111314479B (en) Data processing method and equipment
CN114064780A (en) Session information processing method, system, device, storage medium and electronic equipment
CN110602169B (en) Service calling method and device, computer equipment and storage medium
CN106899654B (en) Sequence value generation method, device and system
CN110888889A (en) Data information updating method, device and equipment
CN107423942B (en) Service transfer method and device
CN107872517B (en) Data processing method and device
CN106921712B (en) Service processing method and device
CN106899564B (en) Login method and device
JP6859518B2 (en) How to prevent attacks on servers and devices
CN107203429A (en) A kind of method and device that distributed task scheduling is loaded based on distributed lock
CN110795395A (en) File deployment system and file deployment method
CN111245897B (en) Data processing method, device, system, storage medium and processor
CN111858677A (en) Local cache data access method, device, equipment and storage medium
CN111240892A (en) Data backup method and device
CN109145536B (en) Webpage tamper-proofing method and device
CN106878252B (en) Method for establishing password-free login relationship, method for clearing account and device thereof
CN107276998B (en) OpenSSL-based performance optimization method and device
CN114691445A (en) Cluster fault processing method and device, electronic equipment and readable storage medium
CN111491021B (en) License data processing method and device for distributed cluster
CN114880300A (en) Processing method and device based on block chain file, processor and electronic equipment
CN111522649B (en) Distributed task allocation method, device and system
CN113630317A (en) Data transmission method and device, nonvolatile storage medium and electronic device
CN109561123B (en) Token caching method and device

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