-3

I have an algorithm which requires scheduled task that runs a script on a regular basis (every minute). I want to store this data and access those values ranging from last hour to last 24 hrs.

I've looked into saving an array of data to a single mysql field. I know serialize() and unserialize() functions will do.

Can you suggest any other way to store those cron scheduled task values or will array be sufficient?

4

2 回答 2

0

memcache can store for a particualer time. Seeing its basically an array it should do fine.

Set the timeout to (60*60*24=) 86400

于 2013-03-30T19:25:26.200 回答
0

The solution to this problem is simply to insert the data into a table in MySQL. The table should look something like this:

create table MinuteStats as (
    MinuteStatsId int not null auto_increment,
    TimeOfMeasurement datetime,
    Measure1 int,
    Measure2 int,
    CreatedAt TimeStamp default CURRENT_TIMESTAMP
);

Then, every minute, do something like:

insert into MinuteStats(TimeOfMeasurement, Measure1, Measure1)
    select <time>, <measure1>, <measure2>

You will then have the data in a nice format for subsequent processing.

于 2013-03-30T20:28:26.050 回答