Cache to store persistent application's variables

  • Thread starter Thread starter NWx
  • Start date Start date
N

NWx

Hi,

Is Cache appropriate to store persistent variables used across the
application? What I want is to store UserID for currently logged user,
SessionID (my own SessionID, which keep track of datetime for login and
logout as well as other info, like Client IP , etc)

My objects I want store to cache are not set-up to expire.

Or should I store them better in Session storage?

Regards
 
Small user specific values are probably better stored in the session object.
I would use the cache for more broader used values (application wide). In
particular I believe that when storing in the cache you should be always
prepared for cache misses (under low memory condition, I believe even
"permanent" items may be destroyed. Can someone confirm this ?

In any case you may want to provide a class that store/retrieve these
values, this way you'll be easily able to change the underlying storage for
these values (plus type safety, intellisence for user settings etc...)

Patrice
 
Hi,

Your suggestion about packing saving / restoring to a class is great. I'll
use it, thnaks.

Regards
 
Back
Top