TSADD
- If the given
timestamp
already exists in the specified time series, this command overwrites the existing value with the givenvalue
. - If the given
key
does not exist, a new time series is created for thekey
, and the given values are inserted to the associated given fields. - If the given exists, but is not of time series type, an error is raised.
EXPIRE_IN TTL
sets the TTL (time-to-live) in seconds for the entries being added.EXPIRE_AT UNIX_TIMESTAMP
ensures that the entries added would expire by the givenUNIX_TIMESTAMP
(seconds since January 1, 1970).
Returns the appropriate status string.
"OK"
$ TSADD cpu_usage 20 "80" 30 "60" 40 "90"
"OK"
We could also encode the timestamp as “yyyymmddhhmm”, since this would still produce integers that are sortable by the actual timestamp.
$ TSADD cpu_usage 201710311100 "50"
"OK"
$ TSGET cpu_usage 10
$ TSGET cpu_usage 201710311100
"50"
"75"
Set a TTL of 3600 seconds (1 hour) for an entry that we add.
$ TSADD cpu_usage 60 "70" EXPIRE_IN 3600
"OK"
"OK"
, tsget
, ,tsrevrangebytime
, , tscard