1

Background: I have an object that is expensive to construct, so I want to pass it from the web script to a backend script without having to re-construct.

I like the approach in this question. I'm pretty sure this will work for me. But is it possible to write the string to memory, and pass the memory address to the backend script (treating it like filename kinda) so it can read the string.

Community
  • 1
  • 1
Dan
  • 10,614
  • 5
  • 24
  • 35
  • 2
    Not directly, no.... there's some techniques such as threads, or queueing systems like rabbitmq or gearman, or using a caching system like redis or memcache – Mark Baker Apr 30 '15 at 18:43
  • A classic XY problem. Since you use web to collect data, use a queueing mechanism and construct your object once - in the backend script. Simply write the data somewhere if you can't use queueing libraries and shift the logic to the proper authority - backend task. – N.B. Apr 30 '15 at 22:28

1 Answers1

2

Check out the shared memory funtions in PHP..

http://php.net/manual/en/ref.shmop.php

Of course, getting the data from the "backend script" would depend on the language used.

I wrestled a bear once.
  • 22,983
  • 19
  • 69
  • 116