-1

-User can prepare Post to be published for future.

So

Post.PostState is PostState.Scheduled. Post.PublishDate is FutureDate

When futuredate comes PostState will be PostState.Published.

How can I implement this in Redis.

Sorry for duplication: I found that Delayed execution / scheduling with Redis?

Delayed execution / scheduling with Redis?

It seems an answer will be more related with code than db, so

c# reliable delayed/scheduled execution best practice

Community
  • 1
  • 1
Oguz Karadenizli
  • 3,449
  • 6
  • 38
  • 73
  • I do not understand the question. – Didier Spezia Jun 01 '12 at 08:45
  • You can find both code oriented and db oriented solutions for some patterns. Ex: Publish/Subscribe Pattern 1) Code centric:http://www.codeproject.com/Articles/34316/Topic-based-Publish-Subscribe-design-pattern-imple ,2)Db centric http://redis.io/topics/pubsub . There is a solution for scheduling mechanism as c# http://quartznet.sourceforge.net/, I hope that maybe redis has an approach for it also.. Maybe expiration approach in redis can be used for it.http://redis.io/commands/expire – Oguz Karadenizli Jun 01 '12 at 12:30

2 Answers2

1

There is no scheduling as such, but you could set the values for both keys and put an expire on the scheduled date. Always lookup both keys and prefer the first. When the schedule expires, you will get back the actual as the first (and only) result.

You could also hide all that behind a lua script.

Nicholas
  • 15,916
  • 4
  • 42
  • 66
1

Sorry but using REDIS key expiration for scheduling won't work. expiration can happen before, or very far in the future (eg. depending on available memory).

I think you might want to use another tool for delayed execution depending on you development platform. (eg. polling a REDIS queue, linux cron, timers, etc.)

Benja
  • 4,099
  • 1
  • 30
  • 31