473,713 Members | 2,781 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sharing instances over requests/sessions

Vic
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
Jul 17 '05 #1
1 1607
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.ev il.ones.will.bo w-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1255
by: wh | last post by:
I really just need some reassurance that I'm doing the right thing really. Here goes... I have an object which needs to be available to all sessions. This is being created in the Application_OnStart() event. Once created the object is stored in the Application collection. The idea of this global object is to manage resources (xml files) between different sessions/users.
1
1478
by: Augustin Prasanna. J | last post by:
Hi, When the user opens a new browser instance using 'Ctrl-N' and logs in with a different user login, both the browser instances begins to share the same session. Any suggestions on how to handle this issue ? Thanks, Augustin
4
2605
by: Daniel | last post by:
Hi I am having a problem sharing session between SSL and non-SSL asp.net pages I have F5 BigIP with sticky sessions working fine, but the problem is tha sticky session applies at the port level (80 vs. 443) so when a user goes t a SSL page I lose session vars because it's on another server on the farm When the user stays on the same server for both non-SSL and SSL the sessio is shared OK Has anyone come across this problem and are...
0
1331
by: Daniel Malcolm | last post by:
Hi I have a site where I would like some pages to be accessed via SSL (login and payment etc) and others via regular http. However I'm not sure whether Session state can be maintained between the 2 protocols. We have SSL set up on the site so that it can be accessed via the same domain: http://www.mydomain.com/login.aspx
4
2337
by: qube3 | last post by:
We have applications written by JSP/Servlet and ASP.NET. All our future development would be based on ASP.NET. We wants to develop a single user interface so that users would not be aware that some of the modules they are using are implement by JSP or ASP.NET (e.g. no need to login both JSP and ASP.NET applications)? Are there any suggestions to share the session in formation among JSP and ASP.NET, or some single-sign on solution.
8
1990
by: Michael Schwarz | last post by:
Hi, I have a problem where I have two requests (i.e. two different windows that are using the same session) that are accessing the session collection. The requests will need more time on the server, but I get the problem that the two sessions are not getting updated values from each requests. Is this by design or is there any solution to do this? -- Best regards | Schöne Grüße
5
2705
by: oliv | last post by:
Hi, New to .NET, I was wondering what was the proper way to share a variable between all the instances of a web page. I try with a static var, but it does not seem to always work. Why is that ? public partial class _Default : System.Web.UI.Page {
9
7382
by: Gilles Ganault | last post by:
Hello Some data are common to all user sessions, and to improve performance/save resources, I'd like to share those data between all sessions, so that each user doesn't have to hit MySQL for the same data. I'd rather avoid writing those in a flat file, and keep stuff in RAM instead. Someone told me about cache servers like MemCacheD. I was also given the hints of writing in OO (public class variables) or using
7
3147
by: =?Utf-8?B?Vkg=?= | last post by:
Hi, all. Need help with what seems to be either connection, or threading problem in my ASP.NET 2.0 application. The gist of the problem is this: IHttpHandler in my application serves an HTML page that has two images (image A and image B) in it. Once the HTML page is served, expected behavior is this: 1) receive request for image A, 2) receive request for image B almost at the same time as for A,
0
8795
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9068
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9009
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6621
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5943
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4715
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3155
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.