views:

32

answers:

2

Assume I have a feed of data ordered by an "ordering" field. This data is fed to a consumer via API, and the consumer caches it locally.

Now, let's say I correct a typo in an entry that has already been cached by the consumer, but need the consumer to pick it up. The content I'm feeding them is ordered by "ordering", and they won't be re-requesting older data.

How can consumers pick up the changes? This data isn't necessarily date-based, and "ordering" does not necessarily correspond with the value of a primary key.

+2  A: 

Can you insert a special type of record which is a "change" record and has a new timestamp. Then they'll pick it up, know it's not an actual record and make the needed change.

Pace
A: 

The Observer Pattern.

harschware
sorry, perhaps i misunderstand. in my case, they come us for data, we dont push it to them.
Carson
I'm getting the feeling you're using the word API in place of web service. From the way I read your question you're consumer could be an observer and register itself with the subject. You could make this work even in a web service setting if your consumer has a service running that could be used to inform it of changes to the subject. If not, then observer pattern is not likely what you need, see answer by @Pace.
harschware