1 Answer
1

This is because DataCacheFactory is an expensive object to create - you don't want to be creating an instance of it every time you want to access the cache.

What they're showing you in the lab is how to create an instance of DataCacheFactoryonce to get hold of a DataCache instance, and then storing that DataCache instance in Session state so you can go back to that one each time you access the cache.

Of course, this still means you're creating an instance of DataCacheFactory per user, I think storing it in Application state would be an even better design.