- the default value to be returned if none was set prior to requesting a value to be returned from the container
-- an implicit parameter that keeps us honest about only storing things that can be actually serialized. Lift provides a subset of these.
Different Vars require different mechanisms for synchronization.
Different Vars require different mechanisms for synchronization. This method implements the Var specific synchronization mechanism.
In the case of ContainerVar, we synchronize on the ContainerVar instance itself.
A typesafe container for data with a lifetime nominally equivalent to the lifetime of HttpSession attributes. This alternative to SessionVar keeps data in the container's session and must be serializable to support session migration. Use SessionVars unless you are using MigratoryLiftSessions.
object MySnippetCompanion { object mySessionVar extends ContainerVar[String]("hello") }
The standard pattern is to create a singleton object extending ContainerVar instead of creating an instance variable of a concrete ContainerVar subclass. This is preferred because ContainerVar will use the name of its instantiating class for part of its state maintenance mechanism.
If you find it necessary to create a ContainerVar 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.