• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im developing a desktop application and not web. Though, i havent' tried it.
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:-)
 
a wee bit from the empire
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic