How to Force-Update a Node's Cache from the Database?

cancel
Showing results for 
Search instead for 
Did you mean: 
Active Member II

How to Force-Update a Node's Cache from the Database?

We are on Alfresco 5.1.3.  We have a "Batch" Alfresco instance that is not part of the cluster and that handles batch jobs.

We have several "Request" Alfresco instances that are part of the cluster and that handle transactional requests (mainly via CMIS).

Our Batch instance updates a node's metadata, but of course, the Request instances cannot see the new metadata until their cached value expires. 

My question is: 

Is there a way for the Request instances to fetch the node while forcing a refresh from the database instead of getting the stale cached data?

Thanks.

1 Reply
Master

Re: How to Force-Update a Node's Cache from the Database?

The internal / undocumented API of the NodeDAO provides a setCheckNodeConsistency method to disable use of the shared cache of the nodesTransactionalCache for the current transaction, which will result in always loading the state / identity data from the DB. This does not however affect the caches for aspects and properties, but these should not be a problem since their value key includes the node identity data (including the ID of the txn when the node was last changed), so if the node was updated, it will bypass the stale, cached data and also load the current data from the database.

Though I do question the setup of having a write-enabled server connected to the same DB without being part of the cluster. It is generally possible to do this for read-only servers (when disabling some shared caches), i.e. to offload work for indexing without cluster communication adding more load, but IMHO should not be used for write-enabled servers.