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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |