Following on from https://community.intersystems.com/post/custom-business-process-change-sendrequestsync-sendrequestasync we are refactoring a number of business processes to use OnRequest/SendRequestAsync/OnResponse mechanisms.
To prevent overloading some of our datasources we currently implement a simple caching system using locks similar to the code below.
Method OnRequest()
{
Set key = ..getKey(request)
Lock +^DataCache(key)
if ('..cacheValid(key))
{
Set status = ..SendRequestSync("DataProcess", dataRequest, .dataResponse)
Set