Transactions and Caching
The repository engine changes are cached to improve performance. Guaranteed updates to a repository are written to persistent storage only when the active transaction is committed.
By default, multiple repository instances within the same process share a repository cache. Within the same process, when a transaction for one repository instance commits, its updates are immediately visible to transactions executing for other repository instances. These updates are not visible to open repository instances in other processes if those processes already have the preupdate data cached. Explicit refreshes are required to view updates from transactions that have completed in other processes.
You can override the default sharing behavior by setting a flag that allocates a new cache for each repository instance. For more information about REPOS_CONN_NEWCACHE, see ConnectionFlags Enumeration.
You can customize cache behavior by defining different age out strategies for different kinds of rows. For more information about age out strategies and caching behavior, see Optimizing Repository Performance.
To refresh a cache
- Refresh an individual repository item by invoking the Refresh method for the repository item.
This method invalidates unchanged cache data for the repository item. Subsequent requests for that data will be fulfilled by retrieving the data from the repository database.
-or-
- Refresh all repository items currently cached for an open repository instance by invoking the Refresh method associated with that repository instance.
This method invalidates unchanged cache data for all repository items. Subsequent requests for that data will be fulfilled by retrieving the data from the repository database.
In addition to explicit refreshes, repository items may be refreshed implicitly at any time by the repository engine, due to execution of internal repository caching algorithms.