Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Expert advice on keeping the value of a Vector in memory.

 
john von
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. Im not pretty sure on how or is it possible to do it.
I need to know on how (if possible) to keep the value of a Vector in memory until the user log out from the system. Similar to a session.
Im developing a system for Network Marketing Company(e.g. Amway). So i need the list of user's downlines in the whole system without querying to the database again and again.
Thanks and i hope i made it clear. Need really an expert advice here.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There was a very nice discussion of caching strategies here recently - it was written up in one of the FAQs on this page.
That should give you a good start on the problem.
Bill
 
Mike Fuellbrandt
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you not just store it in the session?
 
john von
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im developing a desktop application and not web. Though, i havent' tried it.
 
clio katz
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just some ideas, tho i'm not sure exactly what you can access in the desktop environment:

Ideas Part (1) "shutdown" hook

(a) if you have access to "comms/logout" code (somehow you would have to have this, i think, to know how long to maintain the vector?), you could use a shutdown hook to transfer the vector to a physical or virtual (mem) location accessible to the logout component, or .. [ideas below]

(b) You could have your shutdown launch a tiny zombie at shutdown
(written in, say, C), that *could* monitor connection
status (active), or later be accessed by your 'logout' component(passive), then provide Vector access, then die.

Ideas, Part (2) serialized vector (w or w/out logout timestamp)

(a) serialized vector will be more versatile - can be stored in tmp, "cookie-ized', sent over any comms, etc.

(b) you could also jam a (ser) obj back into an implementation resource such as jar, config file, etc - if security/access/visibility is an issue,
for later access by whatever


[but in the "olden daze", we would have poked the little puppy in a hard-coded mem loc... sure am glad since the olden daze passed away:-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic