/** * @param uid remove the bundle from the cache */ void clear(String uid) { this.onDemandBundleCache.remove(uid); }
public void flushEntry(String key) { this.cache.remove(key); }
/** * Remove a descriptor from the cache. * * @param wikiId the wiki id to remove * @param aliases the wiki aliases to remove * @since 8.4.6 * @since 9.9RC1 */ public void remove(String wikiId, List<String> aliases) { // Remove from the wiki name cache this.wikiIdCache.remove(wikiId); // Remove from the wiki alias cache for (String alias : aliases) { this.wikiAliasCache.remove(alias); } }
private void clearFromCriteria(Map<Object, List<String>> cachedFilesKeysMap, Object criteria) { // Get the list of cached files keys corresponding to the criteria List<String> cachedFilesKeys = cachedFilesKeysMap.get(criteria); if (cachedFilesKeys == null) { return; } // Remove all the cached files corresponding to the cached keys for (String cachedFileKey : cachedFilesKeys) { cache.remove(cachedFileKey); } // Remove the list of cached keys corresponding to the criteria cachedFilesKeysMap.remove(criteria); }
@Override public void clear(String wiki) { // Get the list of cached files keys corresponding to the wiki List<String> cachedFilesKeys = cachedFilesKeysMap.get(wiki); if (cachedFilesKeys == null) { return; } // Remove all the cached files corresponding to the cached keys for (String cachedFileKey : cachedFilesKeys) { cache.remove(cachedFileKey); } // Remove the list of cached keys corresponding to the wiki cachedFilesKeysMap.remove(wiki); }
@Override public void clear(DocumentReference documentReference) { cache.remove(getKeyFromDocument(documentReference)); }
@Override public void clear(String name) { cache.remove(getKeyFromName(name)); }
@Override public void remove(UserSecurityReference user, SecurityReference entity) { this.invalidationWriteLock.lock(); try { writeLock.lock(); try { SecurityCacheEntry entry = getEntry(user, entity); if (entry != null) { if (logger.isDebugEnabled()) { logger.debug("Remove outdated access entry for [{}].", getEntryKey(user, entity)); } this.cache.remove(entry.getKey()); } } finally { writeLock.unlock(); } } finally { this.invalidationWriteLock.unlock(); } }
@Override public void remove(SecurityReference entity) { this.invalidationWriteLock.lock(); try { writeLock.lock(); try { SecurityCacheEntry entry = getEntry(entity); if (entry != null) { if (logger.isDebugEnabled()) { logger.debug("Remove outdated rule entry for [{}].", getEntryKey(entity)); } this.cache.remove(entry.getKey()); } } finally { writeLock.unlock(); } } finally { this.invalidationWriteLock.unlock(); } }
private void clearCache(DocumentReference user) { if (user == null) { return; } String userId = serializer.serialize(user); cache.remove(userId); ExecutionContext context = execution.getContext(); for (String key: new ArrayList<>(context.getProperties().keySet())) { if (key.startsWith(USER_TOGGLEABLE_FILTER_PREFERENCES)) { context.removeProperty(key); } } } }
private void flushVirtualWikis(XWikiDocument doc) { List<BaseObject> bobjects = doc.getXObjects(VIRTUAL_WIKI_DEFINITION_CLASS_REFERENCE); if (bobjects != null) { for (BaseObject bobj : bobjects) { if (bobj != null) { String host = bobj.getStringValue("server"); if (StringUtils.isNotEmpty(host)) { if (this.virtualWikiMap != null) { if (this.virtualWikiMap.get(host) != null) { this.virtualWikiMap.remove(host); } } } } } } }
/** * {@inheritDoc} * * @see com.xpn.xwiki.internal.cache.DocumentCache#remove(java.lang.Object, * org.xwiki.model.reference.DocumentReference, java.lang.Object[]) */ public void remove(C data, DocumentReference documentReference, Object... extensions) { String key = getKey(documentReference, extensions); this.cache.remove(key); String documentReferenceString = serializer.serialize(documentReference); Collection<String> keys = mappingCache.get(documentReferenceString); if (keys != null) { keys.remove(key); } }
public void deleteXWikiDoc(XWikiDocument doc, XWikiContext context) throws XWikiException { String key = getKey(doc, context); this.store.deleteXWikiDoc(doc, context); // Make sure cache is initialized initCache(context); getCache().remove(key); getPageExistCache().remove(key); getPageExistCache().set(key, new Boolean(false)); }
/** * Add a new entry in the cache and prevent cache container deadlock (in cooperation with the entry * dispose method) in case adding the entry cause this same entry to be evicted. * @param key the key of the entry to be added. * @param entry the entry to add. * @throws ConflictingInsertionException when the entry have been disposed while being added, the full load should * be retried. */ private void addEntry(String key, SecurityCacheEntry entry) throws ConflictingInsertionException { try { newEntry = entry; cache.set(key, newEntry); if (entry.disposed) { // XWIKI-13746: The added entry have been disposed while being added, meaning that the eviction // triggered by adding the entry has hit the entry itself, so remove it and fail. cache.remove(key); throw new ConflictingInsertionException(); } } finally { newEntry = null; } }
private void disposeChildren() { if (children != null) { for (SecurityCacheEntry child : children) { if (!child.disposed) { if (logger.isDebugEnabled()) { logger.debug("Cascaded removal of entry [{}] from cache.", child.getKey()); } // XWIKI-13746: Prevent an addition in progress to bite his own entry in a bad way. if (child == newEntry) { child.dispose(); } else { try { DefaultSecurityCache.this.cache.remove(child.getKey()); } catch (Throwable e) { logger.error("Security cache failure during eviction of entry [{}]", child.getKey(), e); } } } } } }
public void saveXWikiDoc(XWikiDocument doc, XWikiContext context, boolean bTransaction) throws XWikiException { String key = getKey(doc, context); this.store.saveXWikiDoc(doc, context, bTransaction); doc.setStore(this.store); // Make sure cache is initialized initCache(context); // We need to flush so that caches // on the cluster are informed about the change getCache().remove(key); getPageExistCache().remove(key); /* * We do not want to save the document in the cache at this time. If we did, this would introduce the * possibility for cache incoherince if the document is not saved in the database properly. In addition, the * attachments uploaded to the document stay with it so we want the document in it's current form to be garbage * collected as soon as the request is complete. */ }
/** * {@inheritDoc} * * @see org.xwiki.observation.EventListener#onEvent(org.xwiki.observation.event.Event, java.lang.Object, * java.lang.Object) */ public void onEvent(Event event, Object source, Object data) { // only react to remote events since local actions are already taken into account if (this.remoteObservationManagerContext.isRemoteState()) { if (event instanceof WikiDeletedEvent) { flushCache(); } else { XWikiDocument doc = (XWikiDocument) source; XWikiContext context = (XWikiContext) data; String key = getKey(doc, context); if (getCache() != null) { getCache().remove(key); } if (getPageExistCache() != null) { getPageExistCache().remove(key); } } } }
if (serverdoc.isNew()) { this.virtualWikiMap.remove(wikiUrl);
/** * @param document the translation document */ private void unregisterTranslationBundle(XWikiDocument document) { Scope scope = getScope(document); // Unregister component if (scope != null && scope != Scope.ON_DEMAND) { ComponentDescriptor<TranslationBundle> descriptor = createComponentDescriptor(document.getDocumentReference()); getComponentManager(document, scope, true).unregisterComponent(descriptor); } // Remove from cache this.onDemandBundleCache.remove(this.uidSerializer.serialize(document.getDocumentReference())); }