Welcome Guest, Not a member yet? Register   Sign In
trying to run function just once
#11

(This post was last modified: 06-22-2021, 04:42 PM by richb201.)

[quote="includebeer" pid="387882" dateline="1624400615"]
Once per what? Once per day? Once per page load? What are you trying to accomplish? If you don't need to run it more than one time, in which context is it called repeatedly?

Good question. I need to run it once per user who logs in. 
It is straight CI3. It starts off with __construct and at the bottom of __construct is a call to _init(). 
I did program in C for many years (many years ago) and in C, things just run once. I am using Grocery_crud extensively and also ci_simplicity. It seems that in CI every time a user clicks on any of my menu items, _init() runs again. 
Seemed strange to me too. 
What I am trying to do is each time a  user logs into the system, __construct get called which loads the CI helpers and it runs _init. In init() I call get_from_locker() and it retrieves their image data from S3 to use during their session. When they log off, I delete their image data from my server, just to make sure that the next user who logs in to that server won't see the first users data.

Bringing down the users data from S3 can be time consuming so I want to only do it once per user log in.
proof that an old dog can learn new tricks
Reply


Messages In This Thread
trying to run function just once - by richb201 - 06-21-2021, 09:06 AM
RE: trying to run function just once - by ikesela - 06-21-2021, 07:10 PM
RE: trying to run function just once - by paliz - 06-22-2021, 04:19 AM
RE: trying to run function just once - by richb201 - 06-22-2021, 04:36 PM
RE: trying to run function just once - by craig - 06-23-2021, 03:26 AM
RE: trying to run function just once - by paliz - 06-24-2021, 02:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB