Cache to store persistent application's variables

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
 
P

Patrice Scribe

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
 
N

NWx

Hi,

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

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top