Developing Caching Resource Managers

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

When an application program invokes the caching resource manager, the caching resource manager retrieves the requested information from its local cache, if possible, or alternatively, from the underlying resource manager. If the application performs an update, the updated data is stored only in the local cache, allowing the caching resource manager to avoid sending unnecessary messages to the underlying resource manager. The caching resource manager uses the DTC phase zero interfaces to receive notification of any impending transaction commits. This permits the caching resource manager to send its cached updates to the underlying resource manager just before the start of the two-phase commit protocol.

The phase zero notification mechanism uses the following interfaces:

The phase zero notification interfaces allow applications to detect when a transaction is ready to proceed with a two-phase commit protocol so that they can perform such operations and communicate to the transaction manager when they are completed.

Certain distributed transaction applications require a mechanism by which they can learn that a transaction is ready to enter the prepare state of the two-phase commit protocol. For example, an application that participates in a transaction might possess data that has been modified but not yet written to stable storage. If the application is not capable of providing the durability guarantees required by transactions (for example, by acting as a resource manager and participating in the two-phase commit process and recovery), it must ensure that it has flushed all modified data to a full-service resource manager before the two-phase commit protocol is initiated.

The phase zero notification mechanism is provided by phase zero enlistment objects and phase zero notification objects. These objects implement the ITransactionPhase0EnlistmentAsync and ITransactionPhase0NotifyAsync interfaces, respectively. The former is implemented by the DTC proxy, and the latter is implemented by the application that needs to participate in phase zero notification. Both interfaces are exchanged as sinks when a phase zero enlistment object is created.