C++ API Library Reference  4.3.2-74-ge1d4cca
Classes | Public Types | Public Functions | List of all members
SessionStorageManager Class Referenceabstract

The SessionStorageManager class is used to interact with PureWeb's session storage. Session storage is an automatically synchronized and subscribable key/value store that is private between this client and the service application.

The class provides methods to get and set values in the session storage of any connected session. You can also register a selector to listen for changes to particular keys in the session store.

Public Types

typedef Function< void(SessionStorageChangedEventArgs const &)> ValueChangedCallback
 

Public Functions

virtual void AddValueChangedHandler (Guid sessionId, String const &key, ValueChangedCallback handler)
 
virtual bool ContainsKey (Guid sessionId, String const &key)
 
 DEFINE_EVENT (NewKey, ISessionStorageManager &, SessionStorageChangedEventArgs)
 
virtual Collections::List< StringGetKeys (Guid sessionId)
 
virtual Collections::List< ResponseInfo > GetNextResponses (Guid sessionId)=0
 
virtual Collections::List< GuidGetSessionsContainingKey (String const &key)
 
virtual Nullable< StringGetValue (Guid sessionId, String const &key)
 
virtual void Initialize (StateManager *pStateManager)=0
 
virtual void RemoveAllValueChangedHandlers (Guid sessionId, String const &key)
 
virtual void RemoveValue (Guid sessionId, String const &key)
 
virtual void RemoveValueChangedHandler (Guid sessionId, String const &key, ValueChangedCallback handler)
 
virtual void SessionConnected (Guid sessionId, Typeless const &command)=0
 
virtual void SessionDisconnected (Guid sessionId, Typeless const &command)=0
 
virtual void SetValue (Guid sessionId, String const &key, String const &value, bool forceResponse=false)
 
virtual void SetValueForAllSessions (String const &key, String const &value)
 
virtual void Uninitialize ()=0
 
Events
 DEFINE_PURE_VIRTUAL_EVENT (NewKey, ISessionStorageManager &, SessionStorageChangedEventArgs)
 

Member Typedef Documentation

typedef Function<void(SessionStorageChangedEventArgs const&)> ValueChangedCallback
inherited

A wrapper for functions passed to AddValueChangedHandler and RemoveValueChangedHandler.

Usage Description

void AddValueChangedHandler ( Guid  sessionId,
String const &  key,
ValueChangedCallback  handler 
)
virtual

Adds a value changed handler for the specified session and key; the callback will be fired if that key changes.

Parameters
sessionIdThe unique identifier of the session for which the handler is being set.
keyThe key whose corresponding value, when changed, will trigger the callback.
handlerThe handler function to call when the change occurs.

Implements ISessionStorageManager.

bool ContainsKey ( Guid  sessionId,
String const &  key 
)
virtual

Checks whether a given session storage contains the specified key. Will return true if it does, or false otherwise.

Parameters
sessionIdThe unique identifier of the session whose storage you are querying.
keyThe key that will be tested for its presence.

Implements ISessionStorageManager.

DEFINE_EVENT ( NewKey  ,
ISessionStorageManager ,
SessionStorageChangedEventArgs   
)

This event is fired when a new key is added to the SessionStorageManager.

DEFINE_PURE_VIRTUAL_EVENT ( NewKey  ,
ISessionStorageManager ,
SessionStorageChangedEventArgs   
)
inherited

This event is fired when a new key is added to the SessionStorageManager.

Collections::List< String > GetKeys ( Guid  sessionId)
virtual

Returns a list of all the keys in the storage of the specified session.

Parameters
sessionIdThe unique identifier of the session whose storage you are querying.

Implements ISessionStorageManager.

virtual Collections::List<ResponseInfo> GetNextResponses ( Guid  sessionId)
pure virtualinherited

Gets the next responses for the specified session.

Parameters
sessionIDThe session's unique identifer.
Collections::List< Guid > GetSessionsContainingKey ( String const &  key)
virtual

Returns a list of sessions that contain the given key in their storage. The list is expressed as an array of session IDs.

Parameters
keyThe key that will be tested for its presence.

Implements ISessionStorageManager.

Nullable< String > GetValue ( Guid  sessionId,
String const &  key 
)
virtual

Returns the value from session storage for the specified session and key, or null if there is no such value.

Parameters
sessionIdThe unique identifer of the session whose storage you are querying.
keyThe key that identifies the value.

Implements ISessionStorageManager.

virtual void Initialize ( StateManager pStateManager)
pure virtualinherited

Initializes the plugin with the specified StateManager.

Parameters
stateManagerThe StateManager.

Implemented in ViewManager.

void RemoveAllValueChangedHandlers ( Guid  sessionId,
String const &  key 
)
virtual

Removes all value changed event handlers for the specified session and key.

Parameters
sessionIdThe unique identifier for which the handlers are being removed.
keyThe key whose handlers will be removed.

Implements ISessionStorageManager.

void RemoveValue ( Guid  sessionId,
String const &  key 
)
virtual

Removes the value from session storage for the specified session and key.

Parameters
sessionIdThe unique identifier of the session from whose storage you are removing the key and value.
keyThe key that identifies the value to remove.

Implements ISessionStorageManager.

void RemoveValueChangedHandler ( Guid  sessionId,
String const &  key,
ValueChangedCallback  handler 
)
virtual

Removes a value changed event handler for the specified session and key.

Parameters
sessionIdThe unique identifier of the session from which the handler is being removed.
keyThe key whose whose handler will be removed.
handlerThe handler function to remove.

Implements ISessionStorageManager.

virtual void SessionConnected ( Guid  sessionId,
Typeless const &  command 
)
pure virtualinherited

Indicates that the specified session is connected.

Parameters
sessionIdThe session's unique identifier.
commandThe command that was received causing the session to connect.
virtual void SessionDisconnected ( Guid  sessionId,
Typeless const &  command 
)
pure virtualinherited

Indicates that the specified session is disconnected.

Parameters
sessionIdThe session's unique identifier.
commandThe command that was received causing the session to disconnect.
void SetValue ( Guid  sessionId,
String const &  key,
String const &  value,
bool  forceResponse = false 
)
virtual

Sets a key/value pair in session storage for the specified session.

Parameters
sessionIdThe unique identifier of the session for which to set the key and value.
keyThe key that will identify the value.
valueThe value identified by the key.
forceResponseforce a response to be sent even if the set-value is idempotent.

Implements ISessionStorageManager.

void SetValueForAllSessions ( String const &  key,
String const &  value 
)
virtual

Sets the value in the session storage of all connected sessions.

Parameters
keyThe key that will identify the value.
valueThe value identified by the key.

Implements ISessionStorageManager.

virtual void Uninitialize ( )
pure virtualinherited

Uninitializes the plugin.

Implemented in ViewManager.