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

The ISessionStorageManager interface 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 interface 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)=0
 
virtual bool ContainsKey (Guid sessionId, String const &key)=0
 
virtual Collections::List< StringGetKeys (Guid sessionId)=0
 
virtual Collections::List< GuidGetSessionsContainingKey (String const &key)=0
 
virtual Nullable< StringGetValue (Guid sessionId, String const &key)=0
 
virtual void RemoveAllValueChangedHandlers (Guid sessionId, String const &key)=0
 
virtual void RemoveValue (Guid sessionId, String const &key)=0
 
virtual void RemoveValueChangedHandler (Guid sessionId, String const &key, ValueChangedCallback handler)=0
 
virtual void SetValue (Guid sessionId, String const &key, String const &value, bool forceResponse=false)=0
 
virtual void SetValueForAllSessions (String const &key, String const &value)=0
 
Events
 DEFINE_PURE_VIRTUAL_EVENT (NewKey, ISessionStorageManager &, SessionStorageChangedEventArgs)
 
Constructors and Destructors
virtual ~ISessionStorageManager ()
 

Member Typedef Documentation

typedef Function<void(SessionStorageChangedEventArgs const&)> ValueChangedCallback

A wrapper for functions passed to AddValueChangedHandler and RemoveValueChangedHandler.

Usage Description

virtual void AddValueChangedHandler ( Guid  sessionId,
String const &  key,
ValueChangedCallback  handler 
)
pure 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.

Implemented in SessionStorageManager.

virtual bool ContainsKey ( Guid  sessionId,
String const &  key 
)
pure 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.

Implemented in SessionStorageManager.

DEFINE_PURE_VIRTUAL_EVENT ( NewKey  ,
ISessionStorageManager ,
SessionStorageChangedEventArgs   
)

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

virtual Collections::List<String> GetKeys ( Guid  sessionId)
pure 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.

Implemented in SessionStorageManager.

virtual Collections::List<Guid> GetSessionsContainingKey ( String const &  key)
pure 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.

Implemented in SessionStorageManager.

virtual Nullable<String> GetValue ( Guid  sessionId,
String const &  key 
)
pure 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.

Implemented in SessionStorageManager.

virtual void RemoveAllValueChangedHandlers ( Guid  sessionId,
String const &  key 
)
pure 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.

Implemented in SessionStorageManager.

virtual void RemoveValue ( Guid  sessionId,
String const &  key 
)
pure 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.

Implemented in SessionStorageManager.

virtual void RemoveValueChangedHandler ( Guid  sessionId,
String const &  key,
ValueChangedCallback  handler 
)
pure 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.

Implemented in SessionStorageManager.

virtual void SetValue ( Guid  sessionId,
String const &  key,
String const &  value,
bool  forceResponse = false 
)
pure 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.

Implemented in SessionStorageManager.

virtual void SetValueForAllSessions ( String const &  key,
String const &  value 
)
pure 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.

Implemented in SessionStorageManager.