CodeIgniter Forums
how to keep received data between instances - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: how to keep received data between instances (/showthread.php?tid=72443)



how to keep received data between instances - richb201 - 12-20-2018

I need to capture the fact that i got a message which starts up a controller from a specific userid and the time. I am trying to not allow a single user to send a message twice in 10 seconds. Each of the messages starts up its own controller. I probably don't want to write to disk. Is there any Global variable that all the controllers that are spawned can read? I really don't have the language to describe this well.


RE: how to keep received data between instances - php_rocs - 12-20-2018

@richb201,

You could definitely use a session variable. I don't know why you would have every message startup it's own controller instead of a controller that handles all messages?


RE: how to keep received data between instances - richb201 - 12-20-2018

That is a good question. I have my application that sits there and get used by online web users. But there is a Chrome Extension written in JS that POSTS messages to myURL/Subit_backend/logger_survey which is a function within the Subit_backend controller, not the application. This file only wakes up when a message has been sent to it. It is as if it spawned.

On the session variable, lets say I have 4 of these logger survey functions running at the same time. They all need to be able to read and write to the session variable. I wonder if I should have them get access to the session variable sequentially?