G
G
gene40002015-09-19 06:58:25
PHP
gene4000, 2015-09-19 06:58:25

How to make cron equivalent by calling a script regularly at random times?

The counter script is called at an arbitrary time. Unique user data is written to the database so that the counter counts users, not hits. Let's assume that in a day the user becomes "new", that is, the user table needs to be cleared of records older than 24 hours. I would like to do this not through cron, but using the same script.
How can this be done if you do not specifically save the time of the last cleaning, for example, once every ten minutes? It is not possible to call deletion of old records every time the counter script is run (because of the load).
PS One of the ideas is to save a "unique user identifier" with a reference to time, but apart from the number of the day (for example, useragent + ip + day), nothing comes to mind, but then the interval will not be 24 hours, but "date change".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sivabur, 2015-09-20
@sivabur

Procedures ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question