I am trying to Set Data to Redis at (6 am, 12 pm, 6 pm and 12 am). But all I can do is setting an expiration time for data caching in redis. Is there any way in Golang to do this?
Code:
err := client.Set(key, data[]byte, 6 * time.Hour).Err()
I am trying to Set Data to Redis at (6 am, 12 pm, 6 pm and 12 am). But all I can do is setting an expiration time for data caching in redis. Is there any way in Golang to do this?
Code:
err := client.Set(key, data[]byte, 6 * time.Hour).Err()
Copyright © 2021 Jogjafile Inc.
Since you want to add data in redis at evry 6 hours. You should use cronjob for this.
I have created a sample scenario which might help you as follows:
For better understanding you can refer gocron package.