Transactional cache

 


If data is accessed in the context of a transaction, the request is redirected to the transactional cache. In 1C:Enterprise all the operations related to data modifications in the database are executed within transactions. For example, a document posting event handler is executed within a transaction.

A transaction is an indivisible sequence of data manipulations that brings the database from one integral state to a new one. So if for some reason one of the transaction operations cannot be accomplished, the database returns to the state it had before the transaction (transaction rollback).

The transactional cache is essentially the same sequential queue as the standard cache. The difference is that all the data in the transactional cache is definitely valid (up-to-date).

When the platform reads data to the transactional cache, it locks the data in the database, so there is no way it can be changed until the transaction is complete.

The transactional cache stores read data until it is replaced by subsequently read data or until the transaction is completed. Upon completion of a transaction, the cache is cleared while the actions performed at the moment of clearing depend on the completion status of the transaction.

If the transaction is successfully completed (committed), the data of all the objects in the transactional cache is moved to the standard cache and the transactional cache is cleared (fig. 14.34).


Fig. 14.34. Successful completion of a transaction

If the changes are canceled (rolled back), they are simply cleared from the transactional cache (fig. 14.35).


Fig. 14.35. Clearing transactional cache upon rollback


Comments
0
Add comment