io.undertow.server.handlers.cache.LRUCache Java Examples

The following examples show how to use io.undertow.server.handlers.cache.LRUCache. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CachingResourceManager.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public CachingResourceManager(final int metadataCacheSize, final long maxFileSize, final DirectBufferCache dataCache, final ResourceManager underlyingResourceManager, final int maxAge) {
    this.maxFileSize = maxFileSize;
    this.underlyingResourceManager = underlyingResourceManager;
    this.dataCache = dataCache;
    this.cache = new LRUCache<>(metadataCacheSize, maxAge);
    this.maxAge = maxAge;
    if(underlyingResourceManager.isResourceChangeListenerSupported()) {
        try {
            underlyingResourceManager.registerResourceChangeListener(new ResourceChangeListener() {
                @Override
                public void handleChanges(Collection<ResourceChangeEvent> changes) {
                    for(ResourceChangeEvent change : changes) {
                        invalidate(change.getResource());
                    }
                }
            });
        } catch (Exception e) {
            UndertowLogger.ROOT_LOGGER.couldNotRegisterChangeListener(e);
        }
    }
}
 
Example #2
Source File: ServletContextImpl.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
public ServletContextImpl(final ServletContainer servletContainer, final Deployment deployment) {
    this.servletContainer = servletContainer;
    this.deployment = deployment;
    this.deploymentInfo = deployment.getDeploymentInfo();
    sessionCookieConfig = new SessionCookieConfigImpl(this);
    sessionCookieConfig.setPath(deploymentInfo.getContextPath());
    if (deploymentInfo.getServletContextAttributeBackingMap() == null) {
        this.attributes = new ConcurrentHashMap<>();
    } else {
        this.attributes = deploymentInfo.getServletContextAttributeBackingMap();
    }
    attributes.putAll(deployment.getDeploymentInfo().getServletContextAttributes());
    this.contentTypeCache = new LRUCache<>(deployment.getDeploymentInfo().getContentTypeCacheSize(), -1, true);
    this.defaultSessionTimeout = deploymentInfo.getDefaultSessionTimeout() / 60;
}
 
Example #3
Source File: CachingResourceManager.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
public CachingResourceManager(final int metadataCacheSize, final long maxFileSize, final DirectBufferCache dataCache, final ResourceManager underlyingResourceManager, final int maxAge) {
    this.maxFileSize = maxFileSize;
    this.underlyingResourceManager = underlyingResourceManager;
    this.dataCache = dataCache;
    this.cache = new LRUCache<>(metadataCacheSize, maxAge);
    this.maxAge = maxAge;
}
 
Example #4
Source File: PathHandler.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
public PathHandler(int cacheSize) {
    if(cacheSize > 0) {
        cache = new LRUCache<>(cacheSize, -1, true);
    } else {
        cache = null;
    }
}
 
Example #5
Source File: ProteusHandler.java    From proteus with Apache License 2.0 5 votes vote down vote up
public ProteusHandler(int cacheSize)
{
    if (cacheSize > 0) {
        cache = new LRUCache<>(cacheSize, -1, true);
    } else {
        cache = null;
    }
}
 
Example #6
Source File: ServletContextImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public ServletContextImpl(final ServletContainer servletContainer, final Deployment deployment) {
    this.servletContainer = servletContainer;
    this.deployment = deployment;
    this.deploymentInfo = deployment.getDeploymentInfo();
    sessionCookieConfig = new SessionCookieConfigImpl(this);
    sessionCookieConfig.setPath(deploymentInfo.getContextPath());
    if (deploymentInfo.getServletContextAttributeBackingMap() == null) {
        this.attributes = new ConcurrentHashMap<>();
    } else {
        this.attributes = deploymentInfo.getServletContextAttributeBackingMap();
    }
    attributes.putAll(deployment.getDeploymentInfo().getServletContextAttributes());
    this.contentTypeCache = new LRUCache<>(deployment.getDeploymentInfo().getContentTypeCacheSize(), -1, true);
    this.defaultSessionTimeout = deploymentInfo.getDefaultSessionTimeout() / 60;
}
 
Example #7
Source File: PathHandler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public PathHandler(int cacheSize) {
    if(cacheSize > 0) {
        cache = new LRUCache<>(cacheSize, -1, true);
    } else {
        cache = null;
    }
}
 
Example #8
Source File: LearningPushHandler.java    From quarkus-http with Apache License 2.0 4 votes vote down vote up
public LearningPushHandler(int maxEntries, int maxAge, HttpHandler next) {
    this.next = next;
    cache = new LRUCache<>(maxEntries, maxAge);
}
 
Example #9
Source File: LearningPushHandler.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public LearningPushHandler(int maxEntries, int maxAge, HttpHandler next) {
    this.next = next;
    cache = new LRUCache<>(maxEntries, maxAge);
}