Sharing instances over requests/sessions

This is a discussion on Sharing instances over requests/sessions within the PHP Language forums, part of the PHP Programming Forums category; Hi, Is there a mechanism within PHP for sharing data over multiple requests that are not tied to a specific ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-01-2004
Vic
 
Posts: n/a
Default Sharing instances over requests/sessions

Hi,

Is there a mechanism within PHP for sharing data over
multiple requests that are not tied to a specific session.

I need to write a memory senstive cache in pure PHP. I
have an application which needs to store documents
from an application server elsewhere, due to the data
within the documents I can't write them to disk and I
have to minimise the amount of accesses to the server.

So my plan is to write something to store the documents
in a cache avaliable to all requests and store an access
key in the session. When a request is made for a
document that is not in the cache I'll do a quick check
to see if I need to free some space before I add the new
document. However the actual docs to remove will most
likely belong to a different session.

The question is, how do I create an instance of my cache
so it is available over different requests and users.

This was a trivial exercise in a java servlet, however
I now need to use PHP.

Thanks,

Vic
Reply With Quote
  #2 (permalink)  
Old 06-03-2004
FLEB
 
Posts: n/a
Default Re: Sharing instances over requests/sessions

Regarding this well-known quote, often attributed to Vic's famous "1 Jun
2004 06:29:08 -0700" speech:

> Hi,
>
> Is there a mechanism within PHP for sharing data over
> multiple requests that are not tied to a specific session.
>
> I need to write a memory senstive cache in pure PHP. I
> have an application which needs to store documents
> from an application server elsewhere, due to the data
> within the documents I can't write them to disk and I
> have to minimise the amount of accesses to the server.
>
> So my plan is to write something to store the documents
> in a cache avaliable to all requests and store an access
> key in the session. When a request is made for a
> document that is not in the cache I'll do a quick check
> to see if I need to free some space before I add the new
> document. However the actual docs to remove will most
> likely belong to a different session.
>
> The question is, how do I create an instance of my cache
> so it is available over different requests and users.
>
> This was a trivial exercise in a java servlet, however
> I now need to use PHP.
>
> Thanks,
>
> Vic


Can you just serialize the data (if you even need to), then dump it to a
file?

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:37 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0