C# / .Net API Library Reference  4.3.2-74-ge1d4cca
Public Functions | Events
ISessionStorageManager Interface Reference

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 Functions

void AddValueChangedHandler (Guid sessionId, string key, EventHandler< SessionStorageChangedEventArgs > handler)
 
bool ContainsKey (Guid sessionId, string key)
 
ICollection< string > GetKeys (Guid sessionId)
 
List< Guid > GetSessionsContainingKey (string key)
 
String GetValue (Guid sessionId, string key)
 
void RemoveAllValueChangedHandlers (Guid sessionId, string key)
 
void RemoveValue (Guid sessionId, string key)
 
void RemoveValueChangedHandler (Guid sessionId, string key, EventHandler< SessionStorageChangedEventArgs > handler)
 
void SetValue (Guid sessionId, String key, string value, bool forceResponse=false)
 
void SetValueForAllSessions (string key, string value)
 

Events

EventHandler< SessionStorageChangedEventArgsKeyAdded
 

Usage Description

void AddValueChangedHandler ( Guid  sessionId,
string  key,
EventHandler< SessionStorageChangedEventArgs handler 
)

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.

bool ContainsKey ( Guid  sessionId,
string  key 
)

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.

ICollection<string> GetKeys ( Guid  sessionId)

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.

List<Guid> GetSessionsContainingKey ( string  key)

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.

String GetValue ( Guid  sessionId,
string  key 
)

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.

void RemoveAllValueChangedHandlers ( Guid  sessionId,
string  key 
)

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.

void RemoveValue ( Guid  sessionId,
string  key 
)

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.

Implemented in SessionStorageManager.

void RemoveValueChangedHandler ( Guid  sessionId,
string  key,
EventHandler< SessionStorageChangedEventArgs handler 
)

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.

void SetValue ( Guid  sessionId,
String  key,
string  value,
bool  forceResponse = false 
)

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.
void SetValueForAllSessions ( string  key,
string  value 
)

Sets a key/value pair in session storage for all connected sessions.

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

Implemented in SessionStorageManager.

Event Documentation

EventHandler<SessionStorageChangedEventArgs> KeyAdded

This event fires when a new key and its corresponding value are added to session storage.