ResponseCache cache = getCache();
if (cache != null && uri.getVersion() == Resource.LIVE) {
List<CacheTag> tags = new ArrayList<CacheTag>();
// resource id
tags.add(new CacheTagImpl(CacheTag.Resource, uri.getIdentifier()));
// subjects, so that resource lists get updated
for (String subject : resource.getSubjects())
tags.add(new CacheTagImpl(CacheTag.Subject, subject));
cache.invalidate(tags.toArray(new CacheTagImpl[tags.size()]), true);
}
// Write the updated resource to disk