@Override
    @Nonnull
    public Collection<V> values() {
        // First, clear all entries that have been in cache longer than the
        // maximum defined age.
        deleteExpiredEntries();

        synchronized (this) {
            return map.values().stream()
                .map(cachedObject -> cachedObject.object)
                .collect(Collectors.toList());
        }
    }
Create a new default cache and specify the maximum size of for the cache in
bytes, and the maximum lifetime of objects.

@param name a name for the cache.
@param maxSize the maximum size of the cache in bytes. -1 means the cache
     has no max size.
@param maxLifetime the maximum amount of time objects can exist in
     cache before being deleted. -1 means objects never expire.
xmppserver/src/main/java/org/jivesoftware/util/cache/DefaultCache.java