Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I store data in memory, so that it's accessible to PHP scripts just like $_SESSION?

Tags:

php

I have few scripts that must share highly dynamic data that is accessible on every HTTP request, just like $_SESSION for user's session. What is the best way to achieve that?

like image 612
user1165454 Avatar asked Jan 23 '26 06:01

user1165454


2 Answers

You may try APC or Memcache.

If you are not able to use any of those, a MySQL table with memory engine might be also the answer.

like image 174
Narcis Radu Avatar answered Jan 25 '26 18:01

Narcis Radu


Take a look into in-memory storages, like memcached (PHP extension), Redis or MySQL's MEMORY tables. Also, there are a lot of other storage engines that uses RAM to store data.

like image 31
Timur Avatar answered Jan 25 '26 19:01

Timur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!