Sharing instances over requests/sessions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Vic

    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
  • FLEB

    #2
    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:
    [color=blue]
    > 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[/color]

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

    --
    -- Rudy Fleminger
    -- sp@mmers.and.ev il.ones.will.bo w-down-to.us
    (put "Hey!" in the Subject line for priority processing!)
    -- http://www.pixelsaredead.com

    Comment

    Working...