public List<String> getKeys() { return ehCache.getKeys(); }
public Set<K> keys() { try { @SuppressWarnings({"unchecked"}) List<K> keys = cache.getKeys(); if (!isEmpty(keys)) { return Collections.unmodifiableSet(new LinkedHashSet<K>(keys)); } else { return Collections.emptySet(); } } catch (Throwable t) { throw new CacheException(t); } }
public Collection<V> values() { try { @SuppressWarnings({"unchecked"}) List<K> keys = cache.getKeys(); if (!isEmpty(keys)) { List<V> values = new ArrayList<V>(keys.size()); for (K key : keys) { V value = get(key); if (value != null) { values.add(value); } } return Collections.unmodifiableList(values); } else { return Collections.emptyList(); } } catch (Throwable t) { throw new CacheException(t); } }
/** * {@inheritDoc} */ public List getKeys() throws IllegalStateException, CacheException { return underlyingCache.getKeys(); }
@SuppressWarnings("unchecked") @Override public Iterable<K> generateKeys(Ehcache cache) { return cache.getKeys(); }
/** * Returns a list of all elements in the cache, whether or not they are expired. * <p> * The returned keys are unique and can be considered a set. * <p> * The List returned is not live. It is a copy. * <p> * The time taken is O(n). On a single cpu 1.8Ghz P4, approximately 8ms is required * for each 1000 entries. * * @return a list of {@link Object} keys */ public List getKeys() throws RemoteException { List keys = cache.getKeys(); if (keys instanceof Serializable) { return keys; } return new ArrayList(keys); }
/** * {@inheritDoc} */ public List getKeys() throws IllegalStateException, CacheException { // THIS IS GENERATED CODE -- DO NOT HAND MODIFY! Thread t = Thread.currentThread(); ClassLoader prev = t.getContextClassLoader(); t.setContextClassLoader(this.classLoader); try { return Collections.unmodifiableList(new ClassLoaderAwareList(this.cache.getKeys())); } finally { t.setContextClassLoader(prev); } }
public void notifyRemoveAll(Ehcache ehcache) { // TODO Auto-generated method stub Iterator ite = ehcache.getKeys().iterator(); while (ite.hasNext()) { Element e = ehcache.get(ite.next()); try { Object model = e.getObjectValue(); if (model instanceof LifeCycle) { LifeCycle lf = (LifeCycle) model; lf.stop(); } } catch (Exception ex) { } } }
/** * Performs bootstrap loading. May be executed on a independent thread. */ protected void doLoad(Ehcache cache) { int loadedElements = 0; final Iterator iterator = cache.getKeys().iterator(); while (iterator.hasNext() && !isInMemoryLimitReached(cache, loadedElements)) { if (cache.get(iterator.next()) != null) { ++loadedElements; } } LOG.debug("Loaded {} elements from disk into heap for cache {}", loadedElements, cache.getName()); }
/** * @return a copy of the cache Elements as a Map */ public final Map toMap() { try { Map result = new HashMap(); for (Object key : cache.getKeys()) { Element e = cache.get(key); if (e != null) { result.put(key, e.getObjectValue()); } } return result; } catch (Exception e) { throw new CacheException(e); } }
this.cacheKeys = cache.getKeys(); } else { this.cacheKeys = null;
/** * {@inheritDoc} */ public Map toMap() { try { Map<Object, Object> result = new HashMap<Object, Object>(); for (Object key : cache.getKeys()) { Element e = cache.get(key); if (e != null) { result.put(key, e.getObjectValue()); } } return result; } catch (Exception e) { if (e instanceof NonStopCacheException) { HibernateNonstopCacheExceptionHandler.getInstance().handleNonstopCacheException((NonStopCacheException) e); return Collections.emptyMap(); } else { throw new CacheException(e); } } }
/** * {@inheritDoc} */ public List getKeys() throws IllegalStateException, CacheException { return underlyingCache.getKeys(); }
/** * Returns the keys for this cache. * * @return a list of {@link Object} keys for this cache. This is not a live set, so it will not track changes to the key set. */ public List getKeys() throws CacheException { return cache.getKeys(); }
public List<String> getKeys() { ArrayList<String> keys = new ArrayList<String>(); List<?> eKeys = cache.getKeys(); for (Object object : eKeys) { if (object != null) { keys.add(object.toString()); } } return keys; }
public List<String> getKeys() { ArrayList<String> keys = new ArrayList<String>(); List<?> eKeys = cache.getKeys(); for (Object object : eKeys) { if (object != null) { keys.add(object.toString()); } } return keys; }
/** * * @return */ @Override protected Collection keySet() { Ehcache cache = getOrCreateCache(cacheName); return cache.getKeys(); }
@Override public Set keys() { if (springCache.getNativeCache() instanceof Ehcache) { Ehcache ehcache = (Ehcache) springCache.getNativeCache(); return new HashSet(ehcache.getKeys()); } throw new UnsupportedOperationException("invoke spring cache abstract keys method not supported"); }
@Override public Set keys() { if (springCache.getNativeCache() instanceof Ehcache) { Ehcache ehcache = (Ehcache) springCache.getNativeCache(); return new HashSet(ehcache.getKeys()); } throw new UnsupportedOperationException("invoke spring cache abstract keys method not supported"); }
@Override public void run() { final List keys = cache.getKeys(); for (Object key : keys) { final Element element1 = cache.get(key); if (element1 == null || element1.getObjectValue() == null || ((LdapUser) element1.getValue()).getDn() == null) { cache.remove(key); } } } }, delay, TimeUnit.SECONDS);