6 Replies Latest reply on Mar 14, 2007 11:44 AM by arjan tijms

    Caching data per user - multiple instances or not?

    augustientje bloem Newbie

      Hi,

      First of all I'm a beginner with JbossCache, so please bear with me ;) What I would like to do is cache data in the web tier per user, i.e. as a replacement for some stuff I now store in the HttpSession.

      What would be the best strategy when using JBossCache for this? Would I create a JBoss cache instance per user and associate that with her session, or would I create a single JBoss Cache instance, associate that with the application context and create a node per user?

      The advantage of the first strategy would be that the lifetime of the cache and all of its contents are directly linked to the lifetime of the session. When the user logs of the cache is certainly cleared for this user.

      On the other hand, I don't see a lot of articles or posts about JBoss Cache that advice something like this. The FAQ touches on the subject by saying that there are "some scenarios" for multiple cache instances. It would seem that caching data per user is not just some scenario but actually a major one.

      Could someone please advise me in this matter?