The standard pattern is to create a singleton object extending SessionVar instead
of creating an instance variable of a concrete SessionVar subclass. This is preferred
because SessionVar will use the name of its instantiating class for part of its state
maintenance mechanism.
If you find it necessary to create a SessionVar subclass of which there may be more
than one instance, it is necessary to override the nameSalt() method to return
a unique salt value for each instance to prevent name collisions.
A typesafe container for data with a lifetime nominally equivalent to the lifetime of HttpSession attributes.
object MySnippetCompanion { object mySessionVar extends SessionVar[String]("hello") }
The standard pattern is to create a singleton object extending SessionVar instead of creating an instance variable of a concrete SessionVar subclass. This is preferred because SessionVar will use the name of its instantiating class for part of its state maintenance mechanism.
If you find it necessary to create a SessionVar subclass of which there may be more than one instance, it is necessary to override the nameSalt() method to return a unique salt value for each instance to prevent name collisions.
Note: SessionVars can be used within CometActors