Update items based on a read operations on same items is a bad practice?

by trmaphi   Last Updated July 11, 2019 10:05 AM

DynamoDB is the database solution, I'm using to store my items. It's a NoSQL/Document database and I got a real problem on real-time updates of items.

First, the saved format is like

  expiredTime: 'Yesterday(this is a epoch or formatted string)',
  state: 'enum values EXPIRED and VALID'

The problem is I need accuracy and real-time compatible data for read requests, but DynamoDB has not supported that type of trigger.

So, I thought about an idea of a subscriber of read requests in my code, then if read requests contain expired time is the past. The subscriber will update the state of items. Any function calls the items will receive altered state (corrected) even the listener haven't finished.

Is this considered bad practice? Because I must not allow any read requests except the one attached a subcriber.

Related Questions

Updated July 23, 2017 20:05 PM

Updated December 27, 2017 10:05 AM

Updated May 23, 2019 06:05 AM

Updated March 12, 2016 07:02 AM