[ColdBox 3.8.1] Best way to use SessionStorage

We will be using SessionStorage to store some user data. What is the best way and place to use this so we don’t have to use getPlugin(“SessionStorage”) everywhere since it will be used in multiple views and layouts?

Hi Chad,

You can define your own method in “Request Context Decorator” then that method will be available in handlers, views and layout.
http://wiki.coldbox.org/wiki/RequestContextDecorator.cfm

Your custom method will be short version of any implementation like sessionStorage, clientStorage etc.

i would put a method in your applicationhelper.cfm.

You could also simply load it into the RequestCollection using the “requestStartHandler” defined in your Coldbox configuration CFC.

Chad,

Personally, where ever you need it. So if you need it in a handler, or a service then have Wirebox inject it, this plugin can be a singleton reducing the memory footprint. So feel free to drop it any where you need it, doing int this way.