How To Make Entries Dependent On The Clients Lifetime Transient Lifetime

<< Back to the .Networking page

Ordinarily, keys stored on the Shared Dictionary server persist indefinitely and independent of any instance connection. However, the SD specifies two highly useful reserved key names: '.transient' and '.lifetime'. Both are used to control the lifetime of sub-trees in the Shared Dictionary hierarchy:

  • The '.transient' key makes data persist only for the lifetime of the connected client. Its value is loaded with the user's GUID representing the client. When that client is disconnected, the key one level up from the .transient key plus all its children (including the .transient key) are deleted.
  • The '.lifetime' key allows a developer to force data to persist for a specified time duration. Its value is loaded with a time value (in seconds). The shared dictionary server (not the clients) tracks this time from when the value is set, and will remove its parent and all its children when the specified duration has passed.