[PHP] Global storage of objects.

2001-11-29 Thread Stefan Bergstrand


I would like to know if there is a way to store objects globally from a
php-page, so that the object can be used from another page.

/Stefan B

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Global storage of objects.

2001-11-29 Thread Boget, Chris

 I would like to know if there is a way to store objects 
 globally from a php-page, so that the object can be used 
 from another page.

Yes, using sessions or cookies.

Chris



Re: [PHP] Global storage of objects.

2001-11-29 Thread Andrey Hristov

Simultaneously? Or you want them preloaded and constructed in memory on every page 
request?

Regards,
Andrey
- Original Message - 
From: Stefan Bergstrand [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 29, 2001 5:56 PM
Subject: [PHP] Global storage of objects.


 
 I would like to know if there is a way to store objects globally from a
 php-page, so that the object can be used from another page.
 
 /Stefan B
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Global storage of objects.

2001-11-29 Thread Christoph Starkmann

Hi Stefan!
 I would like to know if there is a way to store objects 
 globally from a
 php-page, so that the object can be used from another page.

Why not writing these objects to a *.php document which you can
include wherever you need it?

HTH,

Kiko

-
It's not a bug, it's a feature.
christoph starkmann
mailto:[EMAIL PROTECTED]
http://www.fh-augsburg.de/~kiko
ICQ: 100601600
-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Global storage of objects.

2001-11-29 Thread Jani Mikkonen

 I would like to know if there is a way to store objects globally from a
 php-page, so that the object can be used from another page.

Keyword is Serialization. If you save object to flatfile or to db, i dont
see any point why the result wouldnt be accessible from other places
(providing that those other places do have access to same datesource)

More info can be found @

http://www.php.net/manual/en/language.oop.serialization.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Global storage of objects.

2001-11-29 Thread Stefan Bergstrand


Your suggestion is as far as I got on my own... ;-=)

What I want is to keep the object in memory, and not have to read data
from disk the next time I need the object.

I cant use cookies, since the object should be avaliable to more than
one user. (Global, as I said in my first post.) The object can be pretty
large, too.

Since I come from the Java/JSP-world, what I am trying to find is
something that corresponds to :

pageContext.setAttribute(key, object, PageContext.APPLICATION_SCOPE);


This will store object under the name key, being avaliable from
anywhere in the JSP-environment.

Poor man's cache, that is.


/Stefan



Jani Mikkonen wrote:
 
  I would like to know if there is a way to store objects globally from a
  php-page, so that the object can be used from another page.
 
 Keyword is Serialization. If you save object to flatfile or to db, i dont
 see any point why the result wouldnt be accessible from other places
 (providing that those other places do have access to same datesource)
 
 More info can be found @
 
 http://www.php.net/manual/en/language.oop.serialization.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Global storage of objects.

2001-11-29 Thread Andrey Hristov

Sorry but this feature is not available in PHP. Script data can be serialized and 
written do disk.
Simple types (ints, arrays, floats) can reside in memory and every script can use them 
but this is available only
under *nixes. This feature uses SysV semaphores and SysV shared memory. Read the docs 
about using this.
The problem occurs with OO scripts because in the memory serialized object will be 
stored and on every page request the object
structure will be rebuild. There was a discussion few days before on this list or on 
php-dev - I can't remember. A link that you
should visit is http://www.vl-srm.net/index.php

Regards,

Andrey Hristov
P.S.
http://oasis.sourceforge.net
uses SysV semaphores and shared memory, so you can look how they are used in real life 
application
- Original Message -
From: Stefan Bergstrand [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 30, 2001 9:38 AM
Subject: Re: [PHP] Global storage of objects.



 Your suggestion is as far as I got on my own... ;-=)

 What I want is to keep the object in memory, and not have to read data
 from disk the next time I need the object.

 I cant use cookies, since the object should be avaliable to more than
 one user. (Global, as I said in my first post.) The object can be pretty
 large, too.

 Since I come from the Java/JSP-world, what I am trying to find is
 something that corresponds to :

 pageContext.setAttribute(key, object, PageContext.APPLICATION_SCOPE);


 This will store object under the name key, being avaliable from
 anywhere in the JSP-environment.

 Poor man's cache, that is.


 /Stefan



 Jani Mikkonen wrote:
 
   I would like to know if there is a way to store objects globally from a
   php-page, so that the object can be used from another page.
 
  Keyword is Serialization. If you save object to flatfile or to db, i dont
  see any point why the result wouldnt be accessible from other places
  (providing that those other places do have access to same datesource)
 
  More info can be found @
 
  http://www.php.net/manual/en/language.oop.serialization.php

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]