You can flush (invalidate) the caches for an item descriptor or an entire SQL repository, using the following methods. Note that first, you must cast your atg.repository.RepositoryItemDescriptor to an atg.repository.ItemDescriptorImpl. If you are using distributed cache mode, use the Cache Invalidator, as described in the Cache Invalidation Service section below.

The methods in atg.repository.ItemDescriptorImpl are:


Invalidates the item caches for this item descriptor.


Invalidates both the item and query caches for this item descriptor.

removeItemFromCache(String pId)

Removes the specified item from any repository caches

These methods also have versions that accept a boolean parameter that indicates whether the cache should be changed globally, or just for the local cache. These methods are:

removeItemFromCache(id, boolean pGlobal)
invalidateCaches(boolean pGlobal)
invalidateItemCache(boolean pGlobal)

If this global parameter is true, the invalidation occurs across the cluster. Otherwise, the invalidation occurs only in the local ATG instance.

The removeItemFromCache method, when given a true value, will use one of two mechanisms to distribute the invalidation event:

  • If the item descriptor uses distributed cache mode, it uses the event server to send the invalidation event.

  • Otherwise, it uses the GSAInvalidatorService to send the event.

The invalidateCaches and invalidateItemCache methods, when given true for the global parameter, will always use the GSAInvalidatorService. If this service is not enabled, a warning is logged and the cache is only invalidated locally.

This method in atg.repository.RepositoryImpl affects all caches in the repository:


Invalidates all caches in this repository.

You can cast your repository to these classes and call these methods from there. You can both flush items of a specific kind, items and queries of a specific kind or a specific item with these methods.

For example, here is how you might use the invalidateItemCache() method to invalidate the item caches for every item descriptor in a repository:

RepositoryImpl rep = getRepository();
  String[] descriptorNames = getItemDescriptorNames();
// iterate over all the descriptors
for (int i=0; i<descriptorNames.length; i++) {
    String name = descriptorNames[i];
    ItemDescriptorImpl d = (ItemDescriptorImpl)rep.getItemDescriptor(name);
loading table of contents...