Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application scope in php

Tags:

php

I need to share same array object across all requests irrespective of requests coming from same browser/user. Is there any application scope in php where I could store that array object. I am using php 5.x .

like image 677
Xinus Avatar asked Oct 07 '09 11:10

Xinus


2 Answers

If you want to share it across all requests on a per user basis, using sessions is probably the way to go.

If you want to share it across all requests of all users, you have to store it in the database, on disk or keep it in memory, e.g. using memcache or memcached.

like image 53
middus Avatar answered Oct 29 '22 13:10

middus


Some extensions, like APC or Zend Cache allow you to mimic application-scope.
If none are available to you, you can cache the object in a file or DB.

like image 4
Itay Moav -Malimovka Avatar answered Oct 29 '22 15:10

Itay Moav -Malimovka