This invention relates to the field of computer systems. More particularly, a system and methods are provided for caching and serving data without sacrificing session awareness or losing session-specific information.
Many data-serving systems or applications (e.g., databases, web servers) need or attempt to distinguish between different users or different user sessions. Doing so allows the system or application, for example, to identify new users or customers, track a user""s purchases, examine her browsing habits, etc. With this individualized information, the system can maintain accurate user profiles, tailor its presentation of information to a user""s tastes, apply user demographics to improve the system, and so on.
In order to obtain this information, data-serving systems may assign session identifiers to user sessions, thereby allowing one user""s requests or actions to be distinguished from another""s. In particular, the first time a user connects to a system, the system may assign a session identifier, which is thereafter provided by the user (or a user agent such as a browser) with each data request. Session identifiers are often assigned expirations so that a session will be torn down after a certain period of user inactivity.
Data-serving systems designed to capture userxe2x80x94or session-specific information often are unable to use caches to serve their data more rapidly, because caches are typically configured to serve their data in response to any request for the dataxe2x80x94without enforcing or requiring session identifiers. If such a data-serving application employed a cache, user state transitions or other information could be lost or not captured by the data server (e.g., web server, database). For example, a user""s first request would be intercepted and served by the cache without assigning a session identifier. If most or all of the user""s requests are handled by the cache, the data server may never learn of the user""s contact, his or her pattern of activity, etc.
Further, because traditional caches are not configured to be session-aware or to enforce session identification, the use of a cache in a data-serving environment may cause active user sessions to expire. In particular, if a data server assigns a user session a session identifier that expires after a given period of time, and the user""s requests are thereafter served by the cache (i.e., instead of the data server), the user""s session may expire because the data server does not know of the user""s ongoing activity with the cache.
Thus, what is needed is a session-aware cache system for enforcing session identification and ensuring that a data server or application receives necessary user or session information.
In one embodiment of the invention a cache system and methods of serving cached data are provided for ensuring that user sessions are distinguished from each other and that significant state transitions are captured. Significant state transitions may include a user""s connection to a data-serving environment, disconnection from the environment, a particular pattern of activity (e.g., data requests), etc. A cache system is configured, in this embodiment, to ensure that an origin server (e.g., database, data server, web server) is informed of the transitions. Illustratively, a user request that embodies or reflects a significant state transition may be passed to the origin server for action or, alternatively, the cache may handle the request but separately notify the origin server of the activity.
In one embodiment of the invention, a cache system or cache server is configured to periodically or regularly pass client requests to the origin server, or otherwise inform the origin server of the client""s continuing activity, so that a session identifier assigned to the client can be refreshed or prevented from expiring. Thus, a first data request from a client may be forwarded to the origin server so that the origin server is made aware of the new connection and can assign a session identifier and/or take other action. Thereafter, the cache may pass periodic or occasional requests to the data server in order to keep the client session alive, inform the data server of significant activity, and so on.
In another embodiment, if a request is received for a cached data item or set of data, the cache system determines whether service of the data item has been restricted to registered client sessions. If so, then the cache system may only serve the cached data item for requests that include session identifiers. If the received request does not have a session identifier (e.g., it is a new connection), the request is passed to the origin server so that a session identifier may be assigned.