コード例 #1
0
  /**
   * Helper method to send event when an existing cache entry is removed.
   *
   * @param event the event to send.
   */
  protected void sendEntryRemovedEvent(CacheEntryEvent<T> event) {
    for (org.xwiki.cache.event.CacheEntryListener<T> listener :
        this.cacheEntryListeners.getListeners(org.xwiki.cache.event.CacheEntryListener.class)) {
      listener.cacheEntryRemoved(event);
    }

    disposeCacheValue(event.getEntry().getValue());
  }
コード例 #2
0
ファイル: TestCache.java プロジェクト: andrm/xwiki-platform
 @Override
 public void set(String key, T value) {
   T old = cache.put(key, value);
   if (listener != null && old == null) {
     listener.cacheEntryAdded(getEvent(key, value));
   } else {
     listener.cacheEntryModified(getEvent(key, value));
   }
   lastInsertedKey = key;
 }
コード例 #3
0
ファイル: TestCache.java プロジェクト: andrm/xwiki-platform
 @Override
 public void remove(String key) {
   T value = cache.remove(key);
   if (listener != null) {
     listener.cacheEntryRemoved(getEvent(key, value));
   }
 }
コード例 #4
0
 /**
  * Helper method to send event when a cache entry is modified.
  *
  * @param event the event to send.
  */
 protected void sendEntryModifiedEvent(CacheEntryEvent<T> event) {
   for (org.xwiki.cache.event.CacheEntryListener<T> listener :
       this.cacheEntryListeners.getListeners(org.xwiki.cache.event.CacheEntryListener.class)) {
     listener.cacheEntryModified(event);
   }
 }