/** * Remove principal fragment property list from local and remote caches. * * @param principalKey principal key fragment property list */ public synchronized static void principalFragmentPropertyListCacheRemove(String principalKey) { // remove fragment properties list cached locally and // notify remote caches by principal key if (principalKey != null) { principalPropertiesCache.remove(principalKey); boolean removed = principalPropertiesPathCache.remove(principalKey); // if a remove was not successful from the path cache, update // notification to distributed peers was not performed; // for updates of objects evicted from the cache, this is // problematic: put into path cache and remove a second time // to force notification if (!removed) { principalPropertiesPathCache.put(principalPropertiesPathCache.createElement(principalKey, new DatabasePageManagerPrincipalKeyCacheObject(principalKey))); principalPropertiesPathCache.remove(principalKey); } } }
principalPropertiesCache.remove(principalKey); boolean removed = principalPropertiesPathCache.remove(principalKey); principalPropertiesPathCache.put(principalPropertiesPathCache.createElement(principalKey, new DatabasePageManagerPrincipalKeyCacheObject(principalKey))); principalPropertiesPathCache.remove(principalKey); if (principalPropertiesPathCache.get(principalKey) == null) principalPropertiesPathCache.put(principalPropertiesPathCache.createElement(principalKey, new DatabasePageManagerPrincipalKeyCacheObject(principalKey))); principalPropertiesCache.put(principalPropertiesCache.createElement(principalKey, fragmentPropertyList));
public EhDecorationContentCacheImpl(Ehcache ehcache, JetspeedCache preferenceCache, ContentCacheKeyGenerator keyGenerator) { this(ehcache); this.preferenceCache = preferenceCache; this.keyGenerator = keyGenerator; preferenceCache.addEventListener(this,false); //only listen to remote events }
private IdentityToken createToken(String token) { IdentityToken identityToken = new IdentityTokenImpl(token); CacheElement element = cache.createElement(token, identityToken); cache.put(element); return identityToken; }
private void setCachedContent( String cacheKey, String content ) { CacheElement cachedElement = desktopContentCache.createElement( cacheKey, content ); cachedElement.setTimeToIdleSeconds(desktopContentCache.getTimeToIdleSeconds()); cachedElement.setTimeToLiveSeconds(desktopContentCache.getTimeToLiveSeconds()); desktopContentCache.put( cachedElement ); }
for (Object remove : oidCache.getKeys()) oidCache.remove((Identity)remove); for (Object remove : propertiesCache.getKeys()) propertiesCache.remove(remove); for (Object remove : principalPropertiesCache.getKeys()) principalPropertiesCache.remove(remove); for (Object remove : pathCache.getKeys()) pathCache.removeQuiet(remove); for (Object remove : propertiesPathCache.getKeys()) propertiesPathCache.removeQuiet(remove); for (Object remove : principalPropertiesPathCache.getKeys()) principalPropertiesPathCache.removeQuiet(remove);
protected boolean addToCache(PortletWindow window) { String fullName = window.getPortletDefinition().getUniqueName(); CacheElement cachedElement = trackingCache.get(fullName); if (cachedElement == null) { List<String> windowIds = new ArrayList<String>(); windowIds.add(window.getWindowId()); cachedElement = trackingCache.createElement(fullName, windowIds); trackingCache.put(cachedElement); return true; } else { List<String> windowIds = (List<String>)cachedElement.getContent(); if (!windowIds.contains(window.getWindowId())) { windowIds.add(window.getWindowId()); trackingCache.put(cachedElement); return true; } } return false; }
/** * Removes a file entry from the file cache * * @param key the full path name of the file * @return the entry removed */ public Object remove(String key) { boolean removed = this.cache.remove(key); return null; }
public synchronized static Object cacheLookup(Identity oid) { CacheElement element = oidCache.get(oid); if (element != null) { return element.getContent(); } return null; }
List<String> principalKeys = principalPropertiesCache.getKeys(); for (String principalKey : principalKeys) CacheElement propertiesElement = principalPropertiesCache.get(principalKey); if (propertiesElement != null) DatabasePageManagerCache.principalPropertiesCache.removeQuiet(principalKey); DatabasePageManagerCache.principalPropertiesPathCache.removeQuiet(principalKey); break;
protected boolean removeFromCache(PortletWindow window) { String fullName = window.getPortletDefinition().getUniqueName(); CacheElement cachedElement = trackingCache.get(fullName); if (cachedElement == null) { return false; } List<String> windowIds = (List<String>)cachedElement.getContent(); if (!windowIds.contains(window.getWindowId())) { windowIds.remove(window.getWindowId()); trackingCache.put(cachedElement); return true; } return false; }
DatabasePageManagerCache.oidCache.remove(oid); DatabasePageManagerCache.propertiesCache.removeQuiet(fragmentKey); DatabasePageManagerCache.propertiesPathCache.removeQuiet(fragmentKey);
public List<PortletTrackingInfo> getOutOfServiceList() { List<PortletTrackingInfo> result = new ArrayList<PortletTrackingInfo>(); List<String> keys = trackingCache.getKeys(); for (String fullName : keys) { CacheElement element = trackingCache.get(fullName); if (element != null) { List<String> windows = (List<String>) element.getContent(); result.add(new PortletTrackingInfo(fullName, windows)); } } return result; }
public synchronized static void cacheRemoveQuiet(String key, RegistryCacheObjectWrapper w) { RegistryCacheObjectWrapper wrapper = w; if (wrapper == null) { CacheElement cacheElement = nameCache.get(key); if (cacheElement != null) { wrapper = (RegistryCacheObjectWrapper) cacheElement.getContent(); } } if (wrapper == null) { return; } Identity oid = wrapper.getId(); PortletDefinition pd = (PortletDefinition)cacheLookup(oid); if (pd == null) return; oidCache.removeQuiet(oid); nameCache.removeQuiet(pd.getUniqueName()); }
/** * get an iterator over the cache values * * @return iterator over the cache values */ public List getKeys() { return cache.getKeys(); }
ContentCacheKey cacheKey = portletContentCache.createCacheKey(requestContext, fragment.getId()); CacheElement cachedElement = portletContentCache.get(cacheKey);
public void notifyElementRemoved(JetspeedCache cache, boolean local, Object key, Object element) { DatabasePageManagerPrincipalKeyCacheObject cacheObject = (DatabasePageManagerPrincipalKeyCacheObject)element; // remove cache object from local principal properties cache String principalKey = ((cacheObject != null) ? cacheObject.getPrincipalKey() : (String)key); if (principalKey != null) { synchronized (DatabasePageManagerCache.class) { DatabasePageManagerCache.principalPropertiesCache.removeQuiet(principalKey); } } } }, false);
/** * Evicts all entries * */ public void evictAll() { this.cache.clear(); }
CacheElement element = cache.get(key); CacheElement updatedElement = cache.createElement(key, updatedEntry); cache.put(updatedElement);
protected void addToCache(NodeCache content) { CacheElement cachedElement = preferenceCache.createElement(content.getCacheKey(), content); cachedElement.setTimeToIdleSeconds(preferenceCache.getTimeToIdleSeconds()); cachedElement.setTimeToLiveSeconds(preferenceCache.getTimeToLiveSeconds()); preferenceCache.put(cachedElement); }