NetTalk Central

Author Topic: Object Session Value  (Read 2976 times)

Gordon Holfelder

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Object Session Value
« on: January 26, 2011, 11:27:49 AM »
Hi There-

I have a business layer object that I would like to use in a way similar to a session value. There is quite a bit of information loaded from the database and it is used as part of the validation for a form. This currently requires re-instantiation and reloading for every field. What (in my mind) would make the use of this object more efficient would be to have SetSessionObject('Name', object-reference) and GetSessionObject('Name') methods to be available as part of the NetTalk class. This way I could create and load the object once and re-use the the object for each field validation.

There are other forms that could also re-use this same object and that could also help in the efficiency of the web server.

I realize that there would need to be a way of purging the objects when the session goes away and that there would be Set and Get methods for each business object that would be used in this fashion

Are there some embed points that could be used for doing something like this? I looked at the session value queue, but don't see how I could extend it.

Thanks for considering this request.

Regards,
Gordon

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Object Session Value
« Reply #1 on: January 26, 2011, 10:33:04 PM »
Hi Gordon,

I think you should be able to at least do a proof-of-concept there.
If that works out then we could definitely fold your changes back into NetTalk.

The simplest approach I think would be to store the address of the object in the session queue.
ie create a SetSessionObject, which just takes the address of the object and stores it (as a number) in the session queue.
Then GetSessionObject does the reverse.
Don't worry about the DeleteObject for now - that's easy enough to add once you've got the basics working.
You also shouldn't then need to edit any of the Q structures, so that makes it easier.

You can edit netweb.inc and netweb.clw directly to add the two methods described above.

The key potential problems are;
a) passing an "object" without knowing which object you are passing. Ditto returning. I suspect you'll need to work with ADDRESS to make this generic.

b) getting the syntax right for calling SetSessionObject, and GetSessionObject.

but both I think are achievable.

Keep me posted.

cheers
Bruce
 

Gordon Holfelder

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Re: Object Session Value
« Reply #2 on: January 27, 2011, 01:11:20 PM »
I'll give it a try and let you know what happens.

Thanks,
Gordon