CN106603713A - Session management method and system - Google Patents
Session management method and system Download PDFInfo
- Publication number
- CN106603713A CN106603713A CN201611266512.8A CN201611266512A CN106603713A CN 106603713 A CN106603713 A CN 106603713A CN 201611266512 A CN201611266512 A CN 201611266512A CN 106603713 A CN106603713 A CN 106603713A
- Authority
- CN
- China
- Prior art keywords
- caching
- service end
- client
- session
- cached
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/04—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
- H04L63/0428—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention discloses a session management method which comprises a step of obtaining a session token and a cache version number carried by a session request when the session request sent by a client is received, a step of searching the service end cache corresponding to the session token at a server local, a step of judging whether the service end cache is a latest version according to the cache version number if the service end cache corresponding to the session token is searched successfully, and a step of obtaining the service end cache corresponding to the session token from a distributed cache cluster if the service end cache corresponding to the session token is not searched or the service end cache is not the latest version, and carrying out session operation according to the session request. The invention also discloses a session management system. The session management in WEB application of multiple servers is realized.
Description
Technical field
The present invention relates to communication technical field, more particularly to a kind of conversation managing method and system.
Background technology
With the Internet flourish, increasing enterprise, government organs built WEB (World WideWeb,
WWW) application, provide the user service.As user may have access to WEB application, convenient to operation, nothing by browser
Corresponding APP (Application, application software) specially need to be installed, therefore, increasing user also selects should using WEB
With.
With growing with each passing day for WEB application visit capacity, not competent concurrency is big, highly reliable for single server
WEB application system, therefore, generally adopt distributed WEB application server cluster to provide for the business of WEB application at present and prop up
Support, improves Business Processing efficiency.Due to containing multiple servers, same user in distributed WEB application server cluster
The multiple request of client may be by different server process, and now, different servers are required for according to session
(session) data identify this client, continue to provide service support for this client, it is to avoid client repeatedly login etc. occur
Situation.
At present, for the session management scheme of multiserver mainly has:Session Stick (session is viscous), Session
Replicate, Session centralized management and the management based on Cookie etc..But, can there is single-point, internal memory in these Managed Solutions
The many, network overhead of occupancy is big, the low risk of safety, can not meet the session management demand of multiserver.
The content of the invention
Present invention is primarily targeted at providing a kind of conversation managing method and system, it is intended to solve service more than WEB application
During device there is the technical problem of risk in session management.
For achieving the above object, the present invention provides a kind of conversation managing method, and the conversation managing method includes following step
Suddenly:
When the conversation request of client transmission is received, session token and cached version that the conversation request is carried are obtained
Number;
The corresponding service end caching of the session token is searched in server local;
If being successfully found the corresponding service end caching of the session token, the clothes are judged according to the cached version number
Whether business end caching is latest edition;
If not finding the corresponding service end caching of the session token, or service end caching not being latest edition, then
The session token corresponding service end caching is obtained from distributed caching cluster, is conversated behaviour according to the conversation request
Make.
Preferably, the conversation managing method also includes:
If the service end caching is have modified according to the conversation request, update the version number of the service end caching;
Version number after the renewal is returned into the client, the cached version number is updated for the client;
The session token, the amended service end caching are sent to into the distributed caching cluster, for institute
State the service end caching that distributed caching cluster correspondence updates its storage.
Preferably, it is described when the conversation request of client transmission is received, obtain the session order that the conversation request is carried
The step of board and cached version, includes:
When the conversation request of client transmission is received, the gentle poke of session token that the conversation request is carried is obtained
According to;
It is described data cached according to the parsing of default template cache, obtain caching, encryption caching and/or service end in plain text and delay
Information is deposited, the service end cache information includes cached version number;
The conversation managing method also includes:
If have modified the plaintext caching and/or the encryption caching according to the conversation request, will be amended bright
Text caching and/or encryption caching return the client, so that the client updates.
Preferably, the conversation managing method also includes:
When the conversation request of client transmission is received, the session token that the conversation request is carried, and session are obtained
The key and cached version number of operation required service end caching;
According to the session token and the key, the service end caching needed for server local is searched;
If the service end caching needed for being successfully found, whether the service end caching is judged according to the cached version number
It is latest edition;
If the service end needed for not finding is cached, or service end caching is not latest edition, then according to the session
Token and the key, obtain corresponding service end caching from distributed caching cluster, are conversated according to the conversation request
Operation.
Preferably, the conversation managing method also includes:
If the service end caching found in server local is latest edition, cached into guild using the service end for finding
Words operation.
Additionally, for achieving the above object, the present invention also provides a kind of conversation management system, the conversation management system bag
Include:
Parsing module, for when the conversation request of client transmission is received, obtaining the session that the conversation request is carried
Token and cached version number;
Searching modul, for searching the corresponding service end caching of the session token in server local;
Judge module, if for being successfully found the corresponding service end caching of the session token, according to the caching version
This number judges whether the service end caching is latest edition;
Operation module, if for not finding the corresponding service end caching of the session token, or the service end is cached not
Be latest edition, then the corresponding service end caching of the session token is obtained from distributed caching cluster, according to the session
Ask the operation that conversates.
Preferably, the conversation management system also includes:
First update module, if for have modified the service end caching according to the conversation request, updating the clothes
The version number of business end caching;Version number after the renewal is returned into the client, the caching is updated for the client
Version number;The session token, the amended service end caching are sent to into the distributed caching cluster, for described
Distributed caching cluster correspondence updates the service end caching of its storage.
Preferably, the parsing module is additionally operable to,
When the conversation request of client transmission is received, the gentle poke of session token that the conversation request is carried is obtained
According to;It is described data cached according to the parsing of default template cache, obtain caching, encryption caching and/or service end in plain text and cache letter
Breath, the service end cache information include cached version number;
The conversation management system also includes:
Second update module, if the plaintext is cached and/or the encryption is slow for have modified according to the conversation request
Deposit, then amended plaintext is cached and/or encrypted caching and return the client, so that the client updates.
Preferably, the parsing module is additionally operable to,
When the conversation request of client transmission is received, the session token that the conversation request is carried, and session are obtained
The key and cached version number of operation required service end caching;
The searching modul, is additionally operable to according to the session token and the key, the clothes needed for server local is searched
Business end caching;
The judge module, if the service end caching needed for being additionally operable to be successfully found, sentences according to the cached version number
Whether the disconnected service end caching is latest edition;
The operation module, if the service end needed for being additionally operable to not find is cached, or service end caching is not newest
Version, then according to the session token and the key, obtain corresponding service end caching, according to institute from distributed caching cluster
State conversation request to conversate operation.
Preferably, the operation module is additionally operable to,
If the service end caching found in server local is latest edition, cached into guild using the service end for finding
Words operation.
A kind of conversation managing method and system that the embodiment of the present invention is proposed, server are receiving the session of client transmission
During request, by obtaining session token and the cached version number that conversation request is carried, to recognize this client, this client is obtained
It is corresponding data cached;Then, the service end caching corresponding to the session token of client is searched in server local;If in clothes
Business device locally finds the corresponding service end caching of client session token, then need to judge that service end is cached according to cached version number
Whether it is latest edition;If not finding the corresponding service end caching of session token, or the service end caching for finding not being latest edition
This, then obtain session token corresponding service end caching from distributed caching cluster, is conversated operation according to conversation request.
The present invention is stored in server end by session data cached, has ensured data cached safety, and has not received client
The size of cookie (caching) is limited;Due to there is multiple servers in application service cluster, client may be from different services
Device conversates, and in order to ensure that server can use newest service end to cache when operation is conversated, the present invention is clothes
Business end cached configuration cached version number, to the version for characterizing service end caching, judges that service end caches whether latest edition.And
And, the burden data cached in order to mitigate server storage, each server only need to store the meeting with the client of its session
Words service end caching, the service end caching of the latest edition that is stored with distributed caching cluster, in case server calls.Clothes
Business device is paid the utmost attention to cache using locally stored service end when conversation request is received, only when server local does not have this visitor
The service end caching at family end or local service end cached version are not newest, are just pulled from distributed caching cluster newest
The service end caching of version, it is to avoid the time delay for causing from pulling data in distributed caching cluster every time and unstability;Point
Cloth cache cluster adopts distributed structure/architecture, it is to avoid if single conversation server breaks down, cause the application cluster countless
According to available situation.Thus, the present invention has ensured that client accesses any one server in WEB application cluster, server
Session management during WEB application multiserver can be realized, is evaded using the data cached operation that conversates of latest edition
Management operation in single-point problem, EMS memory occupation is more, network overhead is big, the low risk of safety.
Description of the drawings
Fig. 1 is the schematic flow sheet of conversation managing method first embodiment of the present invention;
Fig. 2 is the schematic flow sheet of conversation managing method second embodiment of the present invention;
Fig. 3 is the schematic flow sheet of conversation managing method 3rd embodiment of the present invention;
Fig. 4 is the schematic flow sheet of conversation managing method fourth embodiment of the present invention;
Fig. 5 is the schematic flow sheet of 5th embodiment of conversation managing method of the present invention;
Fig. 6 is the functional module signal of conversation management system first embodiment of the present invention, fourth embodiment, the 5th embodiment
Figure;
Fig. 7 is the high-level schematic functional block diagram of conversation management system second embodiment of the present invention;
Fig. 8 is the high-level schematic functional block diagram of conversation management system 3rd embodiment of the present invention;
Fig. 9 is a kind of conversation modes schematic diagram in the embodiment of the present invention;
Figure 10 is a kind of service end cache model schematic diagram in the embodiment of the present invention;
Figure 11 is mutually schemed for a kind of application scenarios effect in the embodiment of the present invention.
The realization of the object of the invention, functional characteristics and advantage will be described further in conjunction with the embodiments referring to the drawings.
Specific embodiment
It should be appreciated that specific embodiment described herein is not intended to limit the present invention only to explain the present invention.
With reference to Fig. 1, conversation managing method first embodiment of the present invention provides a kind of conversation managing method, the session management
Method includes:
Step S10, when the conversation request of client transmission is received, obtain session token that the conversation request carries and
Cached version number.
Present embodiments provide a kind of based on cached version and the Conversation Model of distributed caching, realize to WEB application
The session management of multiserver, has effectively evaded and various can change managing risk.
Specifically, as a kind of embodiment, client provides business support for which in maiden visit WEB application
Server creates the session of this client, is that this client configures corresponding session token, the session order of such as 64 character strings
Board, for identifying session and related data corresponding to this client.Dialogue-based token, can uniquely find this client pair
The session data answered.It should be noted that the server in the present embodiment refers to the application service in WEB application server cluster
Device.
And, this server is data cached as needed for this client configuration session, including the number such as user name, password
According to, it will words it is data cached as service end buffer memory in server local.Also, configuration service end caches and session token
Corresponding relation, such that it is able to find its corresponding service end caching according to the session token of this client, operate for session.
After the caching of configuration service end, server also needs to the version number for arranging service end caching, and this version number is returned
Return client;Also, this server is stored in service end in distributed caching cluster, it is, of course, also possible to be stored in corresponding
Version number.It should be noted that when server is client configuration version number for the first time, being configurable to 0.
Hereafter, cache whenever server changes this service end, be required for updating the version number of this service end caching.Then,
Server caches the service end after renewal and corresponding version number is sent to distributed caching cluster, and correspondence updates distributed slow
Service end caching and version number in depositing so that the service end caching and version number in distributed caching cluster remains newest
Version;Meanwhile, the version number that service end is cached returns client, and client correspondence updates the cached version number of its storage.
It should be noted that server is in more new version number, number can be fixed on the basis of prototype version number
Adding up for value, for example, when server changes service end each time to be cached, all add 1 by the version number that service end is cached, and return
Client, client update the cached version number of its storage according to the version number for receiving;Meanwhile, server is by the service after renewal
End caching and corresponding version number are sent to distributed caching cluster and are updated.
When client initiates a session request to WEB application server cluster, by its session token and the caching version of storage
This number is configured in conversation request.
Session is requested assignment to server therein and is processed by WEB application server cluster.
Server parses conversation request when the conversation request of client is received, the session carried in obtaining conversation request
Token and cached version number.
It should be noted that for client configuration session token server with currently provide business support for this client
Server can be same, or different.
Step S20, the corresponding service end caching of the session token is searched in server local.
When server conversates operation, when needing to use historical session data, meeting of the server first according to client
Words token, searches the session data of its this client that whether is stored with to server local.
If according to session token, not finding corresponding service end caching in server local, then illustrating active client
It is maiden visit book server.
If according to session token, have found corresponding service end caching in server local, then illustrate active client not
It is maiden visit book server.
If step S30, being successfully found the session token corresponding service end caching, sentenced according to the cached version number
Whether the disconnected service end caching is latest edition.
As client is after book server is accessed, it is also possible to have accessed other servers, if other servers are to service
End caching is modified, then the session data in book server is probably old.
Accordingly, it would be desirable to judge that whether the service end caching of server local storage is latest edition, namely judge server
Whether local service end caching can use.
Specifically, as a kind of embodiment, first, obtain server local service end and cache corresponding version number.
Then, server judges whether the version number of local service end caching is more than or equal to the cached version of client-side
Number.
If the version number of local service end caching illustrates server sheet more than or equal to the side cached version number of client
The service end caching of ground storage is latest edition, be can use.
If the version number of service end caching illustrates the clothes of server local storage less than the cached version number of client-side
Business end caching is not latest edition, and this client may carry out data interaction with other servers, and other servers were changed
The service end caching of this client, the service end caching of server local storage are unavailable.
If step S40, not finding the session token corresponding service end caching, or service end caching not being newest
Version, then from distributed caching cluster obtain the corresponding service end caching of the session token, entered according to the conversation request
Guild's words operation.
When not finding the corresponding service end of client session token and caching in server local, server local does not have
Service end caching is available, and needs search the service end caching of this client from distributed caching cluster.
When the service end caching of server local is not latest edition, the service end caching of server local is old edition
, it is impossible to use, server is also required to from distributed caching cluster the service end caching for searching this client.
Specifically, when the service end caching of client is searched in distributed caching cluster, made according to the session of client
Board searches corresponding service end caching, and the file for obtaining is the service end caching of the corresponding latest edition of this client.
Hereafter, server can be cached using this service end, and operation is managed to session according to conversation request, for example,
Browsing pages of recovery client etc. are cached according to service end.
Also, server is conversated to current sessions and is renewed when replying message to client.
In the present embodiment, server obtains the meeting that conversation request is carried when the conversation request of client transmission is received
Words token and cached version number, to recognize this client, obtain this client corresponding data cached;Then, in server sheet
Search the service end caching corresponding to the session token of client in ground;If finding client session token correspondence in server local
Service end caching, then need according to cached version number judge service end cache whether be latest edition;If not finding session order
The corresponding service end of board is cached, or the service end caching for finding is not latest edition, then the acquisition meeting from distributed caching cluster
Words token corresponding service end caching, conversates operation according to conversation request.The present embodiment is stored in session data cached
Server end, has ensured data cached safety, and has not been limited by the size of client cookie (caching);Due to application
There are multiple servers in service cluster, client may be conversated from different servers, in order to ensure that server is being carried out
Session can use newest service end to cache when operating, the present embodiment cached version number that has been service end cached configuration, to
The version of service end caching is characterized, judges that service end caches whether latest edition.And, it is data cached in order to mitigate server storage
Burden, each server only needs to store the conversational services end caching with the client of its session, distributed caching collection
The service end caching of the latest edition that is stored with group, in case server calls.Server is paid the utmost attention to when conversation request is received
Cached using locally stored service end, only when server local does not have the service end caching or local service end of this client
Cached version is not newest, and the service end caching of latest edition is just pulled from distributed caching cluster, it is to avoid every time from
Time delay and unstability that in distributed caching cluster, pulling data is caused;Distributed caching cluster adopts distributed structure/architecture, keeps away
If having exempted from single conversation server to break down, the available situation of application cluster no data is caused.Thus, the present embodiment guarantee
Client accesses any one server in WEB application cluster, and server can be carried out using the data cached of latest edition
Session is operated, and realizes session management during WEB application multiserver, has been evaded the single-point problem in management operation, internal memory and has been accounted for
With many, network overhead is big, the low risk of safety.
Further, with reference to Fig. 2, conversation managing method second embodiment of the present invention provides a kind of conversation managing method, base
In the embodiment shown in above-mentioned Fig. 1, the conversation managing method also includes:
If step S50, service end caching is have modified according to the conversation request, the service end caching is updated
Version number.
When server changes service end caching when operation is conversated, if desired, then server needs correspondence to update clothes
The version number of business end caching.
It should be noted that server is in more new version number, number can be fixed on the basis of prototype version number
Adding up for value, for example, when server changes service end each time to be cached, all add 1 by the version number that service end is cached.
Step S60, the version number after the renewal is returned into the client, the caching version is updated for the client
This number.
In modification service end caching and after each more new version number, the version number after service end buffer update is configured by server
To in replying message, and return client.Meanwhile, server is also needed to enter line asynchronous to session using session token and is renewed.Need
When to be illustrated, session token needs to carry out write-back using top-level domain, ensures the authority of session token.
Client updates the cached version number of its storage according to the version number for receiving, and hereafter client is sending conversation request
When, using the cached version number after renewal.
Step S70, the session token, amended service end caching are sent to into the distributed caching collection
Group, so that distributed caching cluster correspondence updates the service end caching of its storage.
In modification service end caching and after each more new version number, server also needs to cache and this amended service end
The session token of client is sent to distributed caching cluster.
Distributed caching cluster after the session token of amended service end caching and this client is received, according to session
Token, is amended data by the service end caching update all of this client.
Further, the version number after session token, amended service end are cached and updated by server is sent to
Distributed caching cluster, so that distributed caching cluster correspondence updates the service end caching of its storage.
Thus, ensured that the service end caching in distributed caching cluster is latest edition always.
In the present embodiment, delay if server have modified service end according to the conversation request when operation is conversated
Deposit, then server needs the version number for updating service end caching, to identify the service end caching after updating;Then, server will
Version number after renewal returns client, updates cached version number for client so that client can take newest caching
Version number, can ask to cache using the service end of latest edition when request is conversated;Meanwhile, server is by the meeting of client
Words token, amended service end caching are sent to distributed caching cluster, deposit so that distributed caching cluster correspondence updates which
The service end caching of storage, ensures that the service end caching in distributed caching cluster maintains latest edition.The present embodiment is grasped in session
When the service end that made an amendment is cached, the data in timely correspondence client and distributed caching are realized to number is cached in session
According to more new management, ensured that the server in WEB application server cluster can be conversated with the data cached of latest edition
Operation.
Further, with reference to Fig. 3, conversation managing method 3rd embodiment of the present invention provides a kind of conversation managing method, base
In the embodiment (the present embodiment is by taking Fig. 1 as an example) shown in above-mentioned Fig. 1 or Fig. 2, step S10 includes:
Step S11, when the conversation request of client transmission is received, obtain session token that the conversation request carries and
It is data cached;
Step S12, parsed according to default template cache it is described data cached, obtain in plain text caching, encryption caching and/or
Service end cache information, the service end cache information include cached version number;
The conversation managing method also includes:
If step S80, plaintext caching and/or the encryption caching are have modified according to the conversation request, will repair
Plaintext caching and/or encryption caching after changing returns the client, so that the client updates.
In order to mitigate the burden of service end, in the present embodiment, client is stored with the data cached of partial session.
Specifically, when server is client allocating cache data, it is divided three classes data cached:Caching, encryption in plain text
Caching and service end caching, to book of final entry session data.
Wherein, caching is configured to client in the form of plaintext in plain text, usually inessential and disclosed data, for example
The pet name of user.
Encryption caching is that server will be configured to client after data cached encryption.Encryption caching is important, no
Wish that third party can be directly obtained data cached, the inside ID of such as user.
Service end caching refers to and cached version number is configured to the data cached of client, actual data cached presence only
Service end.Service end caching is very important data cached, if the compromised safety that will affect system, such as log in close
Code etc..
When client is when conversation request is sent, by the plaintext for wherein storing caching, encryption caching and service end caching letter
Breath packing generation is data cached, is configured in conversation request.In addition, in addition it is also necessary to which its session token is configured in conversation request.
Server parses the session token that conversation request obtains this client, and client when conversation request is received
It is data cached.
Then, server is data cached according to the parsing of default template cache, and plaintext caching, the encryption for obtaining client is slow
Deposit and/or service end cache information.Wherein, service end cache information includes the cached version number of service end caching.Certainly, service
Device first can also not parse it is data cached, when session operation is needed with then parsing again.
It should be noted that server can be used directly caching in plain text;Using be pre-configured with secret key pair encryption cache into
After row decryption, can just use;And service end caching, then need server priority to search the session token for locally whether having client
Corresponding service end caching, if having, judges local service end caching whether latest edition, to obtain the service end of latest edition
Caching.
If when operation is conversated, server have modified, then after server will be changed
Plaintext caching and/or encrypt cached configuration in replying message, return client.
Client preserves amended plaintext caching and/or encrypts caching, replaces the old edition for storing before and caches in plain text
And/or encryption caching.
If when operation is conversated, server have modified service end caching, and have updated the version that service end is cached, then
Cached version number after renewal is configured in replying message by server, returns client.Meanwhile, server is by amended clothes
Business end caching is sent to distributed caching cluster, is updated.
When using polytype caching preservation session data, what caching, encryption caching and service end were cached in plain text matches somebody with somebody
Put, call and update and be separate.
In the present embodiment, server obtains the meeting that conversation request is carried when the conversation request of client transmission is received
Words token and data cached;Then, parsed according to default template cache it is data cached, obtain in plain text caching, encryption caching and/
Or service end cache information, service end cache information includes cached version number;If server is when operation is conversated according to meeting
Words request have modified, then cache and/or encrypt caching by amended plaintext and return client
End, so that client updates data cached.The present embodiment is using caching classification and version mechanism, the importance, peace according to data
Full property by data cached classification, only will it is very important it is data cached cache as service end, be stored in service end, due to presence
The data of service end are lightweights, it is achieved thereby that light service end weighs client, data safety is controllable.For being configured to client
The plaintext caching and encryption caching at end, server after session operation modification can directly update the data cached of client, improve
Session efficiency.
Further, with reference to Fig. 4, conversation managing method fourth embodiment of the present invention provides a kind of conversation managing method, base
In the embodiment (the present embodiment is by taking Fig. 1 as an example) shown in above-mentioned Fig. 1, Fig. 2 or Fig. 3, step S10 includes:
Step S13, the session token for when the conversation request of client transmission is received, obtaining the conversation request carrying,
And the key and cached version number of session operation required service end caching;
Step S20 includes:
Step S21, the service end caching according to the session token and the key, needed for server local is searched;
Step S30 includes:
If step S31, be successfully found needed for service end caching, the service end is judged according to the cached version number
Whether caching is latest edition;
Step S40 includes:
If step S41, do not find needed for service end caching, or service end caching is not latest edition, then basis
The session token and the key, obtain corresponding service end caching, from distributed caching cluster according to the conversation request
Conversate operation.
When server is when operation is conversated, the partial data in session cache, rather than whole session may be only needed
Data, therefore, it is possible to use key-value (key-value), data cached make a distinction out different in same session data
Come, different key corresponding content or different types of data cached, the corresponding value of each key be each key it is corresponding it is data cached in
Hold, the corresponding value of such as key 123 is account name, and the corresponding value of key 456 is login password.
Thus, the corresponding value of multiple keys is potentially included in the session data of same client, namely including multiple keys correspondence
Service end cache object.
Server obtains the session token that conversation request is carried when the conversation request of client transmission is received;Meanwhile, also
Need the key of the service end caching according to needed for conversation request obtains this session operation, and the caching of required service end caching
Version number.
Then, server is searched corresponding value in server local, and will be found according to the session token and key for obtaining
Value cache as current desired service end.Specifically, server first can find correspondence according to the session token of client
Value;Again from the corresponding value of session token, key respective value is found, cached as required service end.
If being successfully found corresponding service end caching according to session token and key, according to this clothes of client-side record
The cached version number of business end caching, and the version number of the service end caching found in server local, judge the service found
Whether end caching is latest edition.
If the service end caching according to needed for session token and key do not find session operation, or the service end caching for finding
It is not latest edition, then according to session token and key, corresponding service end caching is searched from distributed caching cluster, enters guild
Words operation.
Further, if when operation is conversated, have modified service end caching according to conversation request, then update service end
The version number of caching;Version number after renewal is returned into client, cached version number is updated for client;By session token and
Key and amended service end caching are sent to distributed caching cluster, deposit so that distributed caching cluster correspondence updates which
The service end caching of storage.
Distributed caching cluster receive session token and key and amended service end caching after, first according to meeting
Words token and key, it is determined that needing the value for updating;Then, using amended service end buffer update, this needs the value for updating.
Further, if client is locally stored caching, encryption caching and/or service end cache information in plain text, correspondence
's:
When the conversation request of client transmission is received, server obtains the gentle poke of session token that conversation request is carried
According to;It is data cached according to the parsing of default template cache, caching, encryption caching and/or service end cache information in plain text are obtained, is taken
Business client information includes that each service end caches corresponding key and cached version number.
If session operation needs to use service end caching, server according to conversation request and service end cache information, really
Determine the key and cached version number of session operation required service end caching.
Then, the service end caching according to the session token and key for obtaining, needed for server local is searched;If successfully looking for
Cache to required service end, then judge whether the service end caching of server local is latest edition according to cached version number;
If the service end needed for not finding is cached, or the service end caching for finding is not latest edition, then according to the session token for obtaining
And key, corresponding service end caching is obtained from distributed caching cluster, is conversated operation according to conversation request.
If server have modified service end caching according to conversation request, the version number of service end caching is updated;Will service
Version number after the corresponding key of end caching and renewal returns client, updates the caching in service end cache information for client
Version number;Simultaneously, it will words token, service end cache corresponding key, and amended service end caching be sent to it is distributed
Cache cluster, so that distributed caching cluster correspondence updates the service end caching of its storage.
If server is have modified according to conversation request cache in plain text and/or encrypt caching, the second update module will update
Plaintext caching afterwards and/or encryption caching, so that client updates data cached.
The renewal of caching, encryption caching and service end caching is separate in plain text.
In the present embodiment, server obtains the meeting that conversation request is carried when the conversation request of client transmission is received
Words token, and the key and cached version number of session operation required service end caching, so that it is determined that required for this session operation
Service end cache corresponding key, and the version number of the required service end caching of client-side record;Then, server according to
The session token for obtaining and key, the service end caching needed for server local is searched;If being successfully found institute in server local
Whether the service end caching for needing, then judging that the service end of server local is cached according to the cached version number of client-side record is
Latest edition;If the service end needed for server local does not find is cached, or the service end caching of server local is not most
Redaction, then server is according to session token and key is obtained, and corresponding service end caching, root are obtained from distributed caching cluster
Conversate operation according to conversation request.Service end caching is divided into many parts using key by the present embodiment, and server can only obtain which
Required service end caching, only can also be updated operation to required service end caching.Also, distributed caching
Cluster can support the reading and renewal of single or multiple session values, prevent from returning whole session object, reduce network consumption,
Improve session efficiency.
Further, with reference to Fig. 5,5th embodiment of conversation managing method of the present invention provides a kind of conversation managing method, base
In the embodiment (the present embodiment is by taking Fig. 1 as an example) shown in above-mentioned Fig. 1, Fig. 2, Fig. 3 or Fig. 4, the conversation managing method also includes:
If step S90, the service end caching found in server local are latest editions, slow using the service end for finding
Deposit the operation that conversates.
Cache when corresponding service end is searched in server local according to session token, or according to the session token for obtaining
And key is when server local is searched corresponding service end and cached, if corresponding service end caching is successfully found, and the clothes for finding
The locally stored service end caching of business device is latest edition, be can use, then server is carried out using the service end caching of server local
Session is operated.
If server have modified service end caching according to conversation request, the version number of service end caching is updated;To update
Version number afterwards returns client, updates cached version number for client;And by the session token of client, amended service
End caching, is sent to distributed caching cluster, so that distributed caching cluster correspondence updates the service end caching of its storage.Or
Version number after renewal, and service end are cached corresponding key and return client, caching version are updated for client
This number;And the session token of client, amended service end are cached, and service end caches corresponding key, is sent to point
Cloth cache cluster, so that distributed caching cluster correspondence updates the service end caching of its storage
Further, with reference to Fig. 9, used as a kind of specific conversation modes, conversational system includes Client (client),
Application Server (WEB application program) and Distributed Memory Cache (distributed caching cluster).
Client, namely Browser (browser), the cookie of storage include Normal (caching in plain text), Encrypt
(encryption caching), Server (service end caching) three types.Certainly, be also stored with session token (session token).Respectively
Using the relation of Name-Value (name-value), data storage during class is data cached, it is easy to search, such as in caching in plain text
ID, entitled ID, corresponding value be 108.
In Application Server (WEB application program), including Cookie Manager (cache manager) and
Session Manager (session manager).
Cookie Manager are for according to default Cookie Template (template cache), carrying out Request
Cookei Paser (request caching parsing), and parsing is obtained into caching carry out Request Cookei Map (request caching reflects
Penetrate), it is given to Session Manager process.Cookie Manager are additionally operable to Response Cookie Writer and (return
Write buffer data), including the configuration and renewal of Cookie.
It is (local that Session Manager are mainly used in Session Operation (session operation), Local Session
Session management) and Distributed Session Agent (distributed conversation agency).
Wherein, Session Operation are for according to conversation request, reflecting incoming slow using Cookie Manager
Deposit data conversates operation, or processes to data cached.
Local Session are mainly used in that edition comparison, session are renewed, session is cleared up.Edition comparison refers to and compares service
The local service end cached version number of device, the cached version number with client-side judge that the service end caching of server local is
No latest edition;Session is renewed for replying to client, renews session;Session is cleared up for clearing up expired session.
Distributed Session Agent are mainly used in that data acquisition, data update, session renews.Data are obtained
Fetching obtains newest from Distributed Memory Cache when the service end cached version of server local is not newest
The service end caching of version;Data update and refer to when service end caching is changed, and update Distributed Memory Cache
In service end caching, make the caching of the service end in Distributed Memory Cache be maintained at latest edition;Session is renewed
Finger renews the distributed conversation with Distributed Memory Cache.
With reference to Figure 10, service end cache model includes local session container and distributed conversation container.
Local session container and distributed conversation container are all Hash (Hash) structures, and String (character string) is
Serializable (serializability) object.
Two fields must be included in serializability object Data Structures:Version number and renewal flag bit, for returning
Write cookie.The server by utilizing version number come determining server it is local in service end caching whether latest edition, if not
Then from the distributed conversation of Distributed Memory Cache in pull.If the server have modified the service end delayed
Deposit, then to the version number from increasing 1, and be written back in cookie, while updating the data of distributed conversation container.
Local session container adopts HashTable (Hash table) structure, using character string as Key and serializability object
As Value;Distributed conversation container namely Distributed Memory Cache, distributed caching cluster, can adopt
Distributed caching component, such as Redis, can support the reading and renewal of single and multiple session values, so can only transfer certain
Prevent from returning whole session object during the corresponding value of individual key.
The client-cache of the latest edition comprising each client in Distributed Memory Cache, uses
Distributed Session Key (distributed conversation key), namely session token, recognize, distinguish different clients
Client-cache.
Same client correspondence may have the corresponding Value of multiple different Key, namely the corresponding client-cache of different keys
Object.
Thus, by Client, Application Server and Distributed Memory Cache realize meeting
Words management.
Further, with reference to Figure 11, used as a kind of specific application scenarios, conversation request Request is sent by Client
To application server.
Cookie Manager carry out filter a request (filter request), paser with cookie
Template (is parsed according to template cache), the cookie for obtaining include normal cookie value (cache in plain text),
Encrypt cookie value (encryption caching), the caching of server cookie value (service end caching) three types.
Wherein, server cookie value describe the version number of each service end caching of this client, and each service end caching is right
The key answered.
Cookie Manager are put into the caching of these three types in cookie ponds, carry out create cookie map
Data cached in cookie ponds is mapped to Session Manager by (create caching mapping).
Then, Session Manager carry out Session Operation (session operation).
If Session Manager need get session data (calling session data), get value by
Session type (judge the session data type for needing to call).
If desired call, then get value from cookie (read from cookie ponds
Take).If desired call service end to cache, then get value from local session (from local middle reading);If local
There is the service end caching that need to be called, then carry out compare version (edition comparison), this service end for comparing client-side is delayed
Corresponding version number and local version number are deposited, judges whether local service end caching is latest edition.
If whether local service end caching is latest edition, local service end is called to cache;If it is not, then get
Value from Distributed Session Agent, cache from the service end for pulling latest edition from distributed conversation.
If needing the service end called to cache locally not finding, get value from Distributed
Session Agent.If distributed conversation does not return data cached, the newly-built service of Session Manager needs for pulling
End caching, and configuration version number is 0.
If Session Manager need set session data (configuration session data), including it is newly-built with modification, then
Set by session type first (arrange the type of session data).
If desired set cookie normal data (configuration cache in plain text) or set cookie encrypt data
(configuration encryption caching), then mark in cookie map (being marked in caching mapping), for set change in
Response (is configured to updating in the replying message of client), and it is further desired that carrying out renewal distributed
Session (session is renewed).
If desired set cookie server data (configuration service end caching), then need update local
Session (updates local service end caching), and update distributed session (update the clothes in distributed conversation
Business end caching), namely the synchronized update for realizing server local and service end caching in distributed caching cluster.Need explanation
It is, in addition it is also necessary to correspondence more new version number.
Hereby it is achieved that session management.
In the present embodiment, if the service end caching found in server local is latest edition, server is using looking for
To service end caching conversate operation.The present embodiment preferentially caches the behaviour that conversates using the service end of server local
Make, reduce from distributed caching cluster network and the system resource for pulling that service end caching takes, improve session management
Efficiency.
With reference to Fig. 6, conversation management system first embodiment of the present invention provides a kind of conversation management system, the session management
System includes:
Parsing module 10, for when the conversation request of client transmission is received, obtaining the meeting that the conversation request is carried
Words token and cached version number.
Present embodiments provide a kind of based on cached version and the Conversation Model of distributed caching, realize to WEB application
The session management of multiserver, has effectively evaded and various can change managing risk.Conversation management system can be deployed in WEB application service
In device.
Specifically, as a kind of embodiment, client provides business support for which in maiden visit WEB application
Creation module in server creates the session of this client, is that this client configures corresponding session token, such as 64 words
The session token of symbol string, for identifying session and related data corresponding to this client.Dialogue-based token, uniquely can look for
To the corresponding session data of this client.It should be noted that during the server in the present embodiment refers to WEB application server cluster
Application server.
And, creation module is data cached as needed for this client configuration session, including the number such as user name, password
According to, it will words it is data cached as service end buffer memory in server local.Also, configuration service end caches and session token
Corresponding relation, such that it is able to find its corresponding service end caching according to the session token of this client, operate for session.
After the caching of configuration service end, creation module also needs to the version number for arranging service end caching, and by this version number
Return client;Also, creation module is stored in service end in distributed caching cluster, it is, of course, also possible to be stored in correspondence
Version number.It should be noted that when server is client configuration version number for the first time, being configurable to 0.
Hereafter, cache whenever server changes this service end, be required for updating the version number of this service end caching.Then,
Service end caching after renewal and corresponding version number are sent to into distributed caching cluster, correspondence is updated in distributed caching
Service end is cached and version number so that the service end caching and version number in distributed caching cluster remains latest edition;Meanwhile,
The version number that service end is cached returns client, and client correspondence updates the cached version number of its storage.
It should be noted that server is in more new version number, number can be fixed on the basis of prototype version number
Adding up for value, for example, when server changes service end each time to be cached, all add 1 by the version number that service end is cached, and return
Client, client update the cached version number of its storage according to the version number for receiving;Meanwhile, server is by the service after renewal
End caching and corresponding version number are sent to distributed caching cluster and are updated.
When client initiates a session request to WEB application server cluster, by its session token and the caching version of storage
This number is configured in conversation request.
Session is requested assignment to server therein and is processed by WEB application server cluster.
When the conversation request of client is received, parsing module 10 parses session to the conversation management system disposed in server
Request, the session token carried in obtaining conversation request and cached version number.
It should be noted that for client configuration session token server with currently provide business support for this client
Server can be same, or different.
Searching modul 20, for searching the corresponding service end caching of the session token in server local.
When server conversates operation, when needing to use historical session data, searching modul 20 is first according to client
Session token, search the session data of its this client that whether is stored with to server local.
If searching modul 20 does not find corresponding service end caching in server local, then illustrates according to session token
Active client is maiden visit book server.
If searching modul 20 have found corresponding service end caching in server local according to session token, then explanation is worked as
Front client is not maiden visit book server.
Judge module 30, if for being successfully found the corresponding service end caching of the session token, according to the caching
Version number judges whether the service end caching is latest edition.
As client is after book server is accessed, it is also possible to have accessed other servers, if other servers are to service
End caching is modified, then the session data in book server is probably old.
Therefore, judge module 30 needs whether the service end caching for judging server local storage is latest edition, namely
Judge whether the service end caching of server local can use.
Specifically, as a kind of embodiment, first, it is determined that the acquisition server local service end caching of module 30 is corresponding
Version number.
Then, judge module 30 judges whether the version number of local service end caching is more than or equal to the side of client and caches
Version number.
If the version number of local service end caching illustrates server sheet more than or equal to the cached version number of client-side
The service end caching of ground storage is latest edition, be can use.
If the version number of local service end caching is less than the cached version number of client-side, illustrate that server local is stored
Service end caching be not latest edition, this client may carry out data interaction with other servers, and other servers are repaiied
The service end caching of this client of correcting one's mistakes, the service end caching of server local storage are unavailable.
Operation module 40, if for not finding the corresponding service end caching of the session token, or service end caching
Be not latest edition, then the corresponding service end caching of the session token is obtained from distributed caching cluster, according to the meeting
Words request conversates operation.
When searching modul 20 does not find the corresponding service end of client session token and caches in server local, service
The local no service end caching of device is available, and operation module 40 needs from distributed caching cluster the service end for searching this client
Caching.
When the service end caching of server local is not latest edition, the service end caching of server local is old edition
, it is impossible to use, operation module 40 is also required to from distributed caching cluster the service end caching for searching this client.
Specifically, when operation module 40 searches the service end caching of client in distributed caching cluster, according to client
The session token at end searches corresponding service end caching, and the file for obtaining is the service end of the corresponding latest edition of this client and delays
Deposit.
Hereafter, operation module 40 can be cached using this service end, and operation, example are managed to session according to conversation request
Such as, browsing pages of recovery client etc. are cached according to service end.
Also, operation module 40 is conversated to current sessions and is renewed when replying message to client.
In the present embodiment, when the conversation request of client transmission is received, parsing module 10 obtains conversation request and carries
Session token and cached version number, to recognize this client, obtain this client corresponding data cached;Then, search mould
Block 20 searches the service end caching corresponding to the session token of client in server local;If finding client in server local
End session token corresponding service end caching, then judge module 30 need to judge service end whether to cache according to cached version number be
Latest edition;If searching modul 20 does not find the corresponding service end caching of session token, or the service end caching for finding is not most
Redaction, then obtain the corresponding service end caching of session token from 40 distributed caching cluster of operation module, please according to session
Ask the operation that conversates.The present embodiment is stored in server end by session data cached, has ensured data cached safety, and
And do not limited by the size of client cookie (caching);Due to there is multiple servers in application service cluster, client may
Conversate from different servers, in order to ensure that server can be slow using newest service end when operation is conversated
Deposit, the present embodiment is service end cached configuration cached version number, to the version for characterizing service end caching, judge that service end is slow
Deposit whether latest edition.And, the burden data cached in order to mitigate server storage, each server only need storage and its session
The conversational services end caching of the client crossed, the service end caching of the latest edition that is stored with distributed caching cluster, with
Standby server calls.Server is paid the utmost attention to be cached using locally stored service end, only works as service when conversation request is received
It is not newest that device does not locally have the service end caching or local service end cached version of this client, just from distributed caching
The service end caching of latest edition is pulled in cluster, it is to avoid the time delay that causes from pulling data in distributed caching cluster every time
And unstability;Distributed caching cluster adopts distributed structure/architecture, it is to avoid if single conversation server breaks down, cause
The available situation of application cluster no data.Thus, the present embodiment has ensured that client accesses any one in WEB application cluster
Server, server can realize meeting during WEB application multiserver using the data cached operation that conversates of latest edition
Words management, evaded management operation in single-point problem, EMS memory occupation is more, network overhead is big, the low risk of safety.
With reference to Fig. 7, conversation management system second embodiment of the present invention provides a kind of conversation management system, it is characterised in that
The conversation management system also includes:
First update module 50, if for have modified the service end caching according to the conversation request, updating described
The version number of service end caching;Version number after the renewal is returned into the client, updates described slow for the client
Deposit version number;The session token, the amended service end caching are sent to into the distributed caching cluster, for institute
State the service end caching that distributed caching cluster correspondence updates its storage.
When operation module 40 changes service end caching when operation is conversated, if desired, then the first update module 50 is needed
Will corresponding to update service end caching version number.
It should be noted that the first update module 50 can be entered on the basis of prototype version number in more new version number
Row fixed numbers it is cumulative, for example, when operation module 40 change service end each time to be cached, the first update module 50 will all take
The version number of business end caching adds 1.
In modification service end caching and after each more new version number, the first update module 50 is by the version after service end buffer update
During this number is configured to and replies message, and return client.Meanwhile, the first update module 50 is also needed to using session token to session
Enter line asynchronous to renew.Need explanation when, session token needs to carry out write-back using top-level domain, ensures the power of session token
Limit.
Client updates the cached version number of its storage according to the version number for receiving, and hereafter client is sending conversation request
When, using the cached version number after renewal.
In modification service end caching and after each more new version number, the first update module 50 is also needed to amended service end
The session token of caching and this client is sent to distributed caching cluster.
Distributed caching cluster after the session token of amended service end caching and this client is received, according to session
Token, is amended data by the service end caching update all of this client.
Further, the version after session token, amended service end are cached and updated by the first update module 50
Number distributed caching cluster is sent to, so that distributed caching cluster correspondence updates service end caching of its storage.
Thus, ensured that the service end caching in distributed caching cluster is latest edition always.
In the present embodiment, if operation module 40 have modified service end according to the conversation request when operation is conversated
Cache, then the first update module 50 needs the version number for updating service end caching, to identify the service end caching after updating;So
Afterwards, the version number after renewal is returned client by the first update module 50, updates cached version number for client so that client
Newest cached version number can be taken, can ask to cache using the service end of latest edition when request is conversated;Meanwhile,
The session token of client, amended service end caching are sent to distributed caching cluster by the first update module 50, for
Distributed caching cluster correspondence updates the service end caching of its storage, ensures that the service end caching in distributed caching cluster is maintained
In latest edition.The present embodiment is corresponded in client and distributed caching in time when session operation have modified service end and cache
Data, realize to more new management data cached in session, have ensured that the server in WEB application server cluster can be used
The data cached operation that conversates of latest edition.
Further, with reference to Fig. 8, conversation management system 3rd embodiment of the present invention provides a kind of conversation management system, base
In the embodiment (the present embodiment is by taking Fig. 6 as an example) shown in above-mentioned Fig. 6 or Fig. 7, the parsing module 10 is additionally operable to,
When the conversation request of client transmission is received, the gentle poke of session token that the conversation request is carried is obtained
According to;It is described data cached according to the parsing of default template cache, obtain caching, encryption caching and/or service end in plain text and cache letter
Breath, the service end cache information include cached version number;
The conversation management system also includes:
Second update module 60, if for have modified the plaintext caching and/or the encryption according to the conversation request
Caching, then cache and/or encrypt caching by amended plaintext and return the client, so that the client updates.
In order to mitigate the burden of service end, in the present embodiment, client is stored with the data cached of partial session.
Specifically, when the configuration module of server is client allocating cache data, it is divided three classes data cached:In plain text
Caching, encryption caching and service end caching, to book of final entry session data.
Wherein, caching is configured to client in the form of plaintext in plain text, usually inessential and disclosed data, for example
The pet name of user.
Encryption caching is that server will be configured to client after data cached encryption.Encryption caching is important, no
Wish that third party can be directly obtained data cached, the inside ID of such as user.
Service end caching refers to and cached version number is configured to the data cached of client, actual data cached presence only
Service end.Service end caching is very important data cached, if the compromised safety that will affect system, such as log in close
Code etc..
When client is when conversation request is sent, by the plaintext for wherein storing caching, encryption caching and service end caching letter
Breath packing generation is data cached, is configured in conversation request.In addition, in addition it is also necessary to which its session token is configured in conversation request.
Parsing module 10 parses the session token that conversation request obtains this client, Yi Jike when conversation request is received
Family end it is data cached.
Then, parsing module 10 is data cached according to the parsing of default template cache, obtains the plaintext caching of client, adds
Close caching and/or service end cache information.Wherein, service end cache information includes the cached version number of service end caching.Certainly,
Parsing module 10 first can also not parse it is data cached, when session operation is needed with then parsing again.
It should be noted that operation module 40 can be used directly caching in plain text;Operation module 40 is secret using what is be pre-configured with
After key is decrypted to encryption caching, can just use;And service end caching, then require to look up module 20 it is preferential search it is local whether
The service end caching having corresponding to the session token of client, if having, judge module 30 judges that local service end caching is
No latest edition, is cached with the service end for obtaining latest edition.
If when operation is conversated, operation module 40 have modified, then second updates mould
Amended plaintext is cached and/or is encrypted cached configuration in replying message by block 60, returns client.
Client preserves amended plaintext caching and/or encrypts caching, replaces the old edition for storing before and caches in plain text
And/or encryption caching.
If when operation is conversated, operation module 40 have modified service end caching, and the first update module 50 have updated clothes
The version of business end caching, then, during the cached version number after renewal is configured to and is replied message by the first update module 50, return client
End.Meanwhile, amended service end caching is sent to distributed caching cluster by the first update module 50, is updated.
When using polytype caching preservation session data, what caching, encryption caching and service end were cached in plain text matches somebody with somebody
Put, call and update and be separate.
In the present embodiment, when the conversation request of client transmission is received, parsing module 10 obtains conversation request and carries
Session token and data cached;Then, parsing module 10 is data cached according to the parsing of default template cache, obtains slow in plain text
Deposit, encrypt caching and/or service end cache information, service end cache information includes cached version number;If server is entering guild
Have modified according to conversation request during words operation and cache in plain text and/or encrypt caching, then second update module 60 will be amended
Cache and/or encrypt caching in plain text and return client, so that client updates data cached.The present embodiment using caching classification and
Version mechanism, the importance, safety according to data, only will be very important data cached as service by data cached classification
End caching, is stored in service end, as the data at presence service end are lightweights, it is achieved thereby that light service end weight client
End, data safety are controllable.For the plaintext for being configured to client caches and encrypt caching, server can after session operation modification
The data cached of client is directly updated, session efficiency is improve.
Further, with reference to Fig. 6, conversation management system fourth embodiment of the present invention provides a kind of conversation management system, base
In the invention described above conversation management system first embodiment, second embodiment or 3rd embodiment, (the present embodiment is with meeting of the invention
As a example by session management first embodiment), the parsing module 10 is additionally operable to,
When the conversation request of client transmission is received, the session token that the conversation request is carried, and session are obtained
The key and cached version number of operation required service end caching;
The searching modul 20, is additionally operable to according to the session token and the key, needed for server local is searched
Service end is cached;
The judge module 30, if the service end caching needed for being additionally operable to be successfully found, according to the cached version number
Judge whether the service end caching is latest edition;
The operation module 40, if the service end needed for being additionally operable to not find is cached, or service end caching is not most
Redaction, then according to the session token and the key, obtain corresponding service end caching from distributed caching cluster, according to
The conversation request conversates operation.
When server is when operation is conversated, the partial data in session cache, rather than whole session may be only needed
Data, therefore, it is possible to use key-value (key-value), data cached make a distinction out different in same session data
Come, different key corresponding content or different types of data cached, the corresponding value of each key be each key it is corresponding it is data cached in
Hold, the corresponding value of such as key 123 is account name, and the corresponding value of key 456 is login password.
Thus, the corresponding value of multiple keys is potentially included in the session data of same client, namely including multiple keys correspondence
Service end cache object.
When the conversation request of client transmission is received, the session token that 10 conversation request of parsing module is carried;Meanwhile, solution
Analysis module 10 also needs to the key of the service end caching according to needed for conversation request obtains this session operation, and required service end
The cached version number of caching.
Then, searching modul 20 searches corresponding value in server local according to the session token and key for obtaining, and will
The value for finding is cached as current desired service end.Specifically, the session token that searching modul 20 can first according to client
Find corresponding value;Again from the corresponding value of session token, key respective value is found, cached as required service end.
If being successfully found corresponding service end caching according to session token and key, judge module 30 is according to client-side
The cached version number of this service end caching of record, and the version number of the service end caching found in server local, judge
Whether the service end caching for finding is latest edition.
If the service end caching according to needed for session token and key do not find session operation, or the service end caching for finding
It is not latest edition, then operation module 40 searches corresponding service end from distributed caching cluster according to session token and key
Caching, conversate operation.
Further, if when operation is conversated, have modified service end caching according to conversation request, then first updates mould
Block 50 updates the version number of service end caching;Version number after renewal is returned client by the first update module 50, for client
Update cached version number;Session token and key and amended service end caching are sent to distribution by the first update module 50
Formula cache cluster, so that distributed caching cluster correspondence updates the service end caching of its storage.
Distributed caching cluster receive session token and key and amended service end caching after, first according to meeting
Words token and key, it is determined that needing the value for updating;Then, using amended service end buffer update, this needs the value for updating.
Further, if client is locally stored caching, encryption caching and/or service end cache information in plain text, correspondence
's:
When the conversation request of client transmission is received, the session token for parsing the fast 10 acquisition conversation request carrying of mould eases up
Deposit data;Parsing mould fast 10 is data cached according to the parsing of default template cache, obtains caching, encryption caching and/or clothes in plain text
Business end cache information, service end information include that each service end caches corresponding key and cached version number.
If session operation needs to use service end caching, parsing mould fast 10 is according to conversation request and service end caching letter
Breath, determines the key and cached version number of session operation required service end caching.
Then, searching modul 20 according to the session token and key for obtaining, delay by the service end needed for server local is searched
Deposit;If the service end caching needed for being successfully found, judge module 20 judge the service of server local according to cached version number
Whether end caching is latest edition;If the service end needed for not finding is cached, or the service end caching for finding is not latest edition,
Then operation module 40 obtains corresponding service end caching, root from distributed caching cluster according to the session token and key for obtaining
Conversate operation according to conversation request.
If operation module 40 have modified service end caching according to conversation request, the first update module 50 updates service end and delays
The version number for depositing;Version number after service end is cached corresponding key and updated returns client, for client more new demand servicing
Cached version number in the cache information of end;Meanwhile, session token, service end are cached corresponding key by the first update module 50, with
And amended service end caching is sent to distributed caching cluster, so that distributed caching cluster correspondence updates the clothes of its storage
Business end caching.
If operation module 40 have modified according to conversation request and cache in plain text and/or encrypt caching, the second update module will
Plaintext caching and/or encryption caching after renewal, so that client updates data cached.
The renewal of caching, encryption caching and service end caching is separate in plain text.
In the present embodiment, server obtains the meeting that conversation request is carried when the conversation request of client transmission is received
Words token, and the key and cached version number of session operation required service end caching, so that it is determined that required for this session operation
Service end cache corresponding key, and the version number of the required service end caching of client-side record;Then, server according to
The session token for obtaining and key, the service end caching needed for server local is searched;If being successfully found institute in server local
Whether the service end caching for needing, then judging that the service end of server local is cached according to the cached version number of client-side record is
Latest edition;If the service end needed for server local does not find is cached, or the service end caching of server local is not most
Redaction, then server is according to session token and key is obtained, and corresponding service end caching, root are obtained from distributed caching cluster
Conversate operation according to conversation request.Service end caching is divided into many parts using key by the present embodiment, and server can only obtain which
Required service end caching, only can also be updated operation to required service end caching.Also, distributed caching
Cluster can support the reading and renewal of single or multiple session values, prevent from returning whole session object, reduce network consumption,
Improve session efficiency.
Further, with reference to Fig. 6,5th embodiment of conversation management system of the present invention provides a kind of conversation management system, base
In the invention described above conversation management system first embodiment, second embodiment, 3rd embodiment or fourth embodiment (the present embodiment
By taking conversation management system first embodiment of the present invention as an example), the operation module 40 is additionally operable to,
If the service end caching found in server local is latest edition, cached into guild using the service end for finding
Words operation.
Cache when corresponding service end is searched in server local according to session token, or according to the session token for obtaining
And key is when server local is searched corresponding service end and cached, if searching modul 20 is successfully found corresponding service end caching,
And find server local storage service end caching be latest edition, can use, then operation module 40 using server local clothes
Business end caches the operation that conversates.
If operation module 40 have modified service end caching according to conversation request, the first update module 40 updates service end and delays
The version number for depositing;Version number after renewal is returned into client, cached version number is updated for client;And by the session of client
Token, amended service end caching, are sent to distributed caching cluster, so that distributed caching cluster correspondence updates its storage
Service end caching.Or
Version number after renewal, and service end are cached corresponding key and return client by the first update module 40, for visitor
Family end updates cached version number;And the session token of client, amended service end are cached, and service end caching correspondence
Key, be sent to distributed caching cluster, for distributed caching cluster correspondence update its storage service end caching.
In the present embodiment, if the service end caching found in server local is latest edition, operation module 40 makes
The operation that conversates is cached with the service end for finding.The present embodiment is preferentially conversated using the service end caching of server local
Operation, reduces from distributed caching cluster network and the system resource for pulling that service end caching takes, improves session pipe
Reason efficiency.
The alternative embodiment of the present invention is these are only, the scope of the claims of the present invention is not thereby limited, it is every using this
Equivalent structure or equivalent flow conversion that bright description and accompanying drawing content are made, or directly or indirectly it is used in other related skills
Art field, is included within the scope of the present invention.
Claims (10)
1. a kind of conversation managing method, it is characterised in that the conversation managing method is comprised the following steps:
When the conversation request of client transmission is received, session token and cached version number that the conversation request is carried are obtained;
The corresponding service end caching of the session token is searched in server local;
If being successfully found the corresponding service end caching of the session token, the service end is judged according to the cached version number
Whether caching is latest edition;
If not finding the session token corresponding service end caching, or service end caching is not latest edition, then from point
The session token corresponding service end caching is obtained in cloth cache cluster, is conversated operation according to the conversation request.
2. conversation managing method as claimed in claim 1, it is characterised in that the conversation managing method also includes:
If the service end caching is have modified according to the conversation request, update the version number of the service end caching;
Version number after the renewal is returned into the client, the cached version number is updated for the client;
The session token, the amended service end caching are sent to into the distributed caching cluster, for described point
Cloth cache cluster correspondence updates the service end caching of its storage.
3. conversation managing method as claimed in claim 1, it is characterised in that described in the conversation request for receiving client transmission
When, include the step of obtain session token and the cached version that the conversation request is carried:
When the conversation request of client transmission is received, session token that the conversation request carries and data cached is obtained;
It is described data cached according to the parsing of default template cache, obtain caching, encryption caching and/or service end in plain text and cache letter
Breath, the service end cache information include cached version number;
The conversation managing method also includes:
If have modified the plaintext caching and/or the encryption caching according to the conversation request, amended plaintext is delayed
Deposit and/or encrypt caching and return the client, so that the client updates.
4. conversation managing method as claimed in claim 1, it is characterised in that the conversation managing method also includes:
When the conversation request of client transmission is received, the session token that the conversation request is carried, and session operation are obtained
The key and cached version number of required service end caching;
According to the session token and the key, the service end caching needed for server local is searched;
If the service end caching needed for being successfully found, judge whether the service end caching is most according to the cached version number
Redaction;
If the service end needed for not finding is cached, or service end caching is not latest edition, then according to the session token
And the key, corresponding service end caching is obtained from distributed caching cluster, is conversated operation according to the conversation request.
5. the conversation managing method as described in any one of claim 1-4, it is characterised in that the conversation managing method is also wrapped
Include:
If the service end caching found in server local is latest edition, the behaviour that conversates is cached using the service end for finding
Make.
6. a kind of conversation management system, it is characterised in that the conversation management system includes:
Parsing module, for when the conversation request of client transmission is received, obtaining the session token that the conversation request is carried
With cached version number;
Searching modul, for searching the corresponding service end caching of the session token in server local;
Judge module, if for being successfully found the corresponding service end caching of the session token, according to the cached version number
Judge whether the service end caching is latest edition;
Operation module, if for not finding the corresponding service end caching of the session token, or service end caching is not most
Redaction, then obtain the corresponding service end caching of the session token, from distributed caching cluster according to the conversation request
Conversate operation.
7. conversation management system as claimed in claim 6, it is characterised in that the conversation management system also includes:
First update module, if for have modified the service end caching according to the conversation request, updating the service end
The version number of caching;Version number after the renewal is returned into the client, the cached version is updated for the client
Number;The session token, the amended service end caching are sent to into the distributed caching cluster, for the distribution
Formula cache cluster correspondence updates the service end caching of its storage.
8. conversation management system as claimed in claim 6, it is characterised in that the parsing module is additionally operable to,
When the conversation request of client transmission is received, session token that the conversation request carries and data cached is obtained;Root
It is described data cached according to the parsing of default template cache, obtain caching, encryption caching and/or service end cache information in plain text, institute
Stating service end cache information includes cached version number;
The conversation management system also includes:
Second update module, if for have modified the plaintext caching and/or the encryption caching according to the conversation request,
Amended plaintext is cached and/or encrypted caching and returns the client, so that the client updates.
9. conversation management system as claimed in claim 6, it is characterised in that the parsing module is additionally operable to,
When the conversation request of client transmission is received, the session token that the conversation request is carried, and session operation are obtained
The key and cached version number of required service end caching;
The searching modul, is additionally operable to according to the session token and the key, the service end needed for server local is searched
Caching;
The judge module, if the service end caching needed for being additionally operable to be successfully found, judges institute according to the cached version number
State whether service end caching is latest edition;
The operation module, if the service end needed for being additionally operable to not find is cached, or service end caching is not latest edition,
Then according to the session token and the key, corresponding service end caching is obtained from distributed caching cluster, according to the meeting
Words request conversates operation.
10. the conversation management system as described in any one of claim 6-9, it is characterised in that the operation module is additionally operable to,
If the service end caching found in server local is latest edition, the behaviour that conversates is cached using the service end for finding
Make.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611266512.8A CN106603713B (en) | 2016-12-29 | 2016-12-29 | Session management method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611266512.8A CN106603713B (en) | 2016-12-29 | 2016-12-29 | Session management method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106603713A true CN106603713A (en) | 2017-04-26 |
CN106603713B CN106603713B (en) | 2020-09-22 |
Family
ID=58581934
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611266512.8A Active CN106603713B (en) | 2016-12-29 | 2016-12-29 | Session management method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106603713B (en) |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108924266A (en) * | 2018-08-24 | 2018-11-30 | 郑州云海信息技术有限公司 | A kind of client request separation management method and device based on distributed file system |
CN109150936A (en) * | 2017-06-19 | 2019-01-04 | 北京宝兰德软件股份有限公司 | The sharing method and device of session object Session in a kind of distributed type assemblies |
CN109495532A (en) * | 2017-09-13 | 2019-03-19 | 北京京东尚科信息技术有限公司 | Client update method and device |
CN109587251A (en) * | 2018-12-07 | 2019-04-05 | 用友网络科技股份有限公司 | Session access method and server |
CN110119409A (en) * | 2019-05-23 | 2019-08-13 | 武汉神算云信息科技有限责任公司 | Cache design method, device, equipment and storage medium in Distributed Application |
CN110381078A (en) * | 2019-07-29 | 2019-10-25 | 迈普通信技术股份有限公司 | Determination method, apparatus, electronic equipment and the storage medium that token renews |
CN110471868A (en) * | 2019-08-21 | 2019-11-19 | 携程旅游信息技术(上海)有限公司 | Improve method, system, equipment and the medium of SOA interface response speed |
CN110493308A (en) * | 2019-07-08 | 2019-11-22 | 中国平安人寿保险股份有限公司 | Distributed consensus system session method, apparatus and storage medium, server |
CN111010603A (en) * | 2019-12-18 | 2020-04-14 | 浙江大华技术股份有限公司 | Video caching and forwarding processing method and device |
CN111372092A (en) * | 2020-03-04 | 2020-07-03 | 北京字节跳动网络技术有限公司 | Communication link establishing method, device, equipment and storage medium |
CN111563005A (en) * | 2020-04-02 | 2020-08-21 | 苏宁云计算有限公司 | Cookie data processing method and device, computer equipment and storage medium |
CN111953580A (en) * | 2020-07-17 | 2020-11-17 | 上海泛微网络科技股份有限公司 | Method, device and storage medium for sending and acquiring session |
CN112131241A (en) * | 2020-09-30 | 2020-12-25 | 上海众言网络科技有限公司 | System quota real-time statistical method, device, equipment and storage medium |
CN113259475A (en) * | 2021-06-10 | 2021-08-13 | 大汉软件股份有限公司 | Distributed session processing system and method based on micro-service architecture |
CN114443761A (en) * | 2021-12-27 | 2022-05-06 | 天翼云科技有限公司 | Session process distributed cache synchronization method, device and equipment |
CN114979234A (en) * | 2022-04-22 | 2022-08-30 | 中国工商银行股份有限公司 | Session control sharing method and system in distributed cluster system |
CN114443761B (en) * | 2021-12-27 | 2025-02-11 | 天翼云科技有限公司 | A method, device and equipment for synchronizing distributed cache in session process |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090144546A1 (en) * | 2007-12-03 | 2009-06-04 | Wachovia Corporation | Application controlled encryption of web browser data |
CN102244652A (en) * | 2010-05-13 | 2011-11-16 | 阿里巴巴集团控股有限公司 | Method and system for generating session information and application server |
CN103841111A (en) * | 2014-03-17 | 2014-06-04 | 北京京东尚科信息技术有限公司 | Method for preventing data from being submitted repeatedly and server |
CN104753987A (en) * | 2013-12-26 | 2015-07-01 | 北京东方通科技股份有限公司 | Distributed session management method and system |
US20150188900A1 (en) * | 2013-12-31 | 2015-07-02 | Digital River, Inc. | Session managment in a multi-tenant, multi-data center environment system and method |
CN105141676A (en) * | 2015-08-11 | 2015-12-09 | 北京思特奇信息技术股份有限公司 | Session persistence sharing method and session persistence sharing system under multiple servers |
-
2016
- 2016-12-29 CN CN201611266512.8A patent/CN106603713B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090144546A1 (en) * | 2007-12-03 | 2009-06-04 | Wachovia Corporation | Application controlled encryption of web browser data |
CN102244652A (en) * | 2010-05-13 | 2011-11-16 | 阿里巴巴集团控股有限公司 | Method and system for generating session information and application server |
CN104753987A (en) * | 2013-12-26 | 2015-07-01 | 北京东方通科技股份有限公司 | Distributed session management method and system |
US20150188900A1 (en) * | 2013-12-31 | 2015-07-02 | Digital River, Inc. | Session managment in a multi-tenant, multi-data center environment system and method |
CN103841111A (en) * | 2014-03-17 | 2014-06-04 | 北京京东尚科信息技术有限公司 | Method for preventing data from being submitted repeatedly and server |
CN105141676A (en) * | 2015-08-11 | 2015-12-09 | 北京思特奇信息技术股份有限公司 | Session persistence sharing method and session persistence sharing system under multiple servers |
Cited By (20)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109150936A (en) * | 2017-06-19 | 2019-01-04 | 北京宝兰德软件股份有限公司 | The sharing method and device of session object Session in a kind of distributed type assemblies |
CN109495532A (en) * | 2017-09-13 | 2019-03-19 | 北京京东尚科信息技术有限公司 | Client update method and device |
CN108924266A (en) * | 2018-08-24 | 2018-11-30 | 郑州云海信息技术有限公司 | A kind of client request separation management method and device based on distributed file system |
CN109587251A (en) * | 2018-12-07 | 2019-04-05 | 用友网络科技股份有限公司 | Session access method and server |
CN110119409A (en) * | 2019-05-23 | 2019-08-13 | 武汉神算云信息科技有限责任公司 | Cache design method, device, equipment and storage medium in Distributed Application |
CN110493308A (en) * | 2019-07-08 | 2019-11-22 | 中国平安人寿保险股份有限公司 | Distributed consensus system session method, apparatus and storage medium, server |
CN110381078A (en) * | 2019-07-29 | 2019-10-25 | 迈普通信技术股份有限公司 | Determination method, apparatus, electronic equipment and the storage medium that token renews |
CN110471868A (en) * | 2019-08-21 | 2019-11-19 | 携程旅游信息技术(上海)有限公司 | Improve method, system, equipment and the medium of SOA interface response speed |
CN111010603A (en) * | 2019-12-18 | 2020-04-14 | 浙江大华技术股份有限公司 | Video caching and forwarding processing method and device |
CN111372092B (en) * | 2020-03-04 | 2022-03-04 | 北京字节跳动网络技术有限公司 | Communication link establishing method, device, equipment and storage medium |
CN111372092A (en) * | 2020-03-04 | 2020-07-03 | 北京字节跳动网络技术有限公司 | Communication link establishing method, device, equipment and storage medium |
CN111563005A (en) * | 2020-04-02 | 2020-08-21 | 苏宁云计算有限公司 | Cookie data processing method and device, computer equipment and storage medium |
CN111563005B (en) * | 2020-04-02 | 2023-05-19 | 苏宁云计算有限公司 | Cookie data processing method and device, computer equipment and storage medium |
CN111953580A (en) * | 2020-07-17 | 2020-11-17 | 上海泛微网络科技股份有限公司 | Method, device and storage medium for sending and acquiring session |
CN112131241A (en) * | 2020-09-30 | 2020-12-25 | 上海众言网络科技有限公司 | System quota real-time statistical method, device, equipment and storage medium |
CN113259475A (en) * | 2021-06-10 | 2021-08-13 | 大汉软件股份有限公司 | Distributed session processing system and method based on micro-service architecture |
CN113259475B (en) * | 2021-06-10 | 2021-11-05 | 大汉软件股份有限公司 | Distributed session processing system and method based on micro-service architecture |
CN114443761A (en) * | 2021-12-27 | 2022-05-06 | 天翼云科技有限公司 | Session process distributed cache synchronization method, device and equipment |
CN114443761B (en) * | 2021-12-27 | 2025-02-11 | 天翼云科技有限公司 | A method, device and equipment for synchronizing distributed cache in session process |
CN114979234A (en) * | 2022-04-22 | 2022-08-30 | 中国工商银行股份有限公司 | Session control sharing method and system in distributed cluster system |
Also Published As
Publication number | Publication date |
---|---|
CN106603713B (en) | 2020-09-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106603713A (en) | Session management method and system | |
US6823391B1 (en) | Routing client requests to back-end servers | |
US8848710B2 (en) | System and method for performing flash caching of dynamically generated objects in a data communication network | |
US7827280B2 (en) | System and method for domain name filtering through the domain name system | |
JP5183214B2 (en) | System and method for performing caching of dynamically generated objects in a network | |
US8788581B2 (en) | Method and device for performing caching of dynamically generated objects in a data communication network | |
US8112434B2 (en) | Performance of an enterprise service bus by decomposing a query result from the service registry | |
US8499057B2 (en) | System and method for performing flash crowd caching of dynamically generated objects in a data communication network | |
US8301839B2 (en) | System and method for performing granular invalidation of cached dynamically generated objects in a data communication network | |
US9553867B2 (en) | Secure application access system | |
US9514243B2 (en) | Intelligent caching for requests with query strings | |
US20070226371A1 (en) | Method and system for class-based management of dynamic content in a networked environment | |
US20080126355A1 (en) | Entry group tags | |
US10645192B2 (en) | Identifying content files in a cache using a response-based cache index | |
US20100325363A1 (en) | Hierarchical object caching based on object version | |
CN103416027B (en) | The system of the method, buffer and cache optimization of cache optimization | |
US8364655B2 (en) | Hybrid off-peak and just-in-time integration | |
WO2017092356A1 (en) | Server, method and system for providing service data | |
US9686228B2 (en) | Integrated just-in-time synchronization | |
US7761405B2 (en) | Per entry changelog | |
Naumenko | Some recommendations on building proxy caching service | |
CN116318841A (en) | Micro-application account login-free method based on Web multi-level cache | |
CN117714541A (en) | iOS application network data caching method and system based on request link interception | |
CN119201281A (en) | A method for speeding up the first loading of web pages embedded in Android APP | |
Center | T-Engine Forum |
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 |